Electronic device with defined and undefined bus communication mechanisms and communication method thereof
By introducing a proxy function library and proxy driver into USB devices, the problem of insufficient operational flexibility of USB devices in the prior art is solved, enabling flexible sending and receiving of defined and undefined commands, and improving the flexibility of device use.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- REALTEK SEMICON CORP
- Filing Date
- 2022-05-09
- Publication Date
- 2026-07-14
AI Technical Summary
Existing USB device operating system drivers limit the types of operations that applications can perform on the device, resulting in insufficient flexibility in device usage and an inability to customize command sending and receiving.
An electronic device employing both defined and undefined bus communication mechanisms establishes links in the user mode and kernel mode of the operating system through a proxy function library and a proxy driver, enabling the sending and receiving of both defined and undefined instructions.
The transmission of non-defined instructions is achieved without affecting the communication of standard defined instructions and without rewriting the driver, thus improving the flexibility of device use.
Smart Images

Figure CN117076366B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to bus communication technology, and more particularly to an electronic device and its communication method that combines defined and undefined bus communication mechanisms. Background Technology
[0002] Universal Serial Bus (USB) is a widely used bus interface, largely due to its ease of use. USB devices support hot-plugging and plug-and-play, meaning they can be used immediately after plugging in the device without restarting the computer.
[0003] To achieve this convenience, besides requiring hardware support for hot-plugging, a significant portion of the functionality comes from the built-in drivers (inboxUSB class drivers) provided by various operating systems for devices of different Universal Serial Bus (USB) standards. However, while these standard drivers offer convenience, they also limit the types of USB devices that applications can operate on, and may even disallow custom command transmission and reception. This design approach impacts the flexibility of device usage. Summary of the Invention
[0004] In view of the problems of the prior art, the object of the present invention is to provide an electronic device and its communication method that combine defined and undefined bus communication mechanisms to improve the prior art.
[0005] This invention includes a communication method that combines defined and undefined bus communication mechanisms, applied in an electronic device. The method comprises: enabling an application related to a peripheral electronic device to establish a link with the peripheral electronic device through a built-in driver of the operating system running in the electronic device; the application launching a proxy library and a proxy driver, wherein the proxy library corresponds to the user mode of the operating system, and the proxy driver corresponds to the kernel mode of the operating system; the application establishing a link between the proxy library and the proxy driver and the peripheral electronic device; the application sending and receiving defined instructions defined by the built-in driver with the peripheral electronic device via the bus through the built-in driver; and the application sending and receiving undefined instructions not defined by the built-in driver with the peripheral electronic device via the proxy library and the proxy driver through the bus.
[0006] The present invention also includes an electronic device with both defined and undefined bus communication mechanisms, comprising: peripheral electronic devices, a bus, storage circuitry, and processing circuitry. The storage circuitry is configured to store computer-executable instructions. The processing circuitry is configured to access and execute the computer-executable instructions to perform a communication method comprising the following steps: enabling an application program associated with the peripheral electronic devices to establish a link with the peripheral electronic devices through a built-in driver of an operating system running in the electronic device; starting a proxy function library and a proxy driver program by the application program, wherein the proxy function library corresponds to the user mode of the operating system, and the proxy driver program corresponds to the kernel mode of the operating system; enabling the proxy function library and the proxy driver program to establish a link with the peripheral electronic devices by the application program; sending and receiving defined instructions defined by the built-in driver program with the peripheral electronic devices via the bus through the built-in driver program; and sending and receiving undefined instructions not defined by the built-in driver program with the peripheral electronic devices via the bus through the proxy function library and the proxy driver program.
[0007] Regarding the features, operation, and functions of this invention, the preferred embodiments will be described in detail below with reference to the accompanying drawings. Attached Figure Description
[0008] Figure 1 A block diagram of an electronic device with both defined and undefined bus communication mechanisms is shown in one embodiment of the present invention;
[0009] Figure 2 A flowchart of a communication method that combines defined and undefined bus communication mechanisms is shown in one embodiment of the present invention;
[0010] Figure 3 An embodiment of the present invention is shown. Figure 1 A block diagram of a system established by an electronic device based on a communication method;
[0011] Figure 4 An embodiment of the present invention is shown. Figure 3 A sequence diagram of the system's operation;
[0012] Figure 5 Another embodiment of the invention is shown. Figure 3 A sequence diagram of the system's operation;
[0013] Figure 6 Another embodiment of the present invention is shown. Figure 3 The system's timing diagram; and
[0014] Figure 7 Another embodiment of the invention is shown. Figure 3 The timing diagram of the system operation.
[0015] Symbol explanation:
[0016] 100: Electronic devices
[0017] 110: Peripheral electronic devices
[0018] 120: Bus
[0019] 130: Storage circuit
[0020] 135: Computer-executable instructions
[0021] 140: Processing Circuit
[0022] 200: Communication Method
[0023] S210~S250: Steps
[0024] 300: System
[0025] 310: Application
[0026] 320: Built-in driver
[0027] 330: Proxy Function Library
[0028] 340: Agent Driver
[0029] S410~S430: Steps
[0030] S510~S550: Steps
[0031] S610~S640: Steps
[0032] S710~S730: Steps
[0033] DBC: Defined Instructions
[0034] KM: Kernel Mode
[0035] NBC: Undefined Instructions
[0036] UM: User Mode Detailed Implementation
[0037] The purpose of this invention is to provide an electronic device and its communication method that combine defined and undefined bus communication mechanisms. By setting up a proxy function library and a proxy driver, the purpose of undefined instruction communication can be achieved without affecting the communication of standard defined instructions and without rewriting the driver.
[0038] Please refer to Figure 1 . Figure 1A block diagram of an electronic device 100 with both defined and undefined bus communication mechanisms is shown in one embodiment of the present invention. The electronic device 100 includes: peripheral electronics 110, bus 120, storage circuit 130, and processing circuit 140.
[0039] Peripheral electronic device 110 is a device having a data transmission interface conforming to the specifications of bus 120, and can be accessed by processing circuitry 140 via bus 120. In one embodiment, bus 120 is a universal serial bus (USB). Peripheral electronic device 110 can be, for example, but not limited to, storage devices, digital camera devices, or other types of universal serial bus electronic devices. It should be noted that the number of peripheral electronic devices 110 included in electronic device 100 can be one or more, and not limited to... Figure 1 The number shown is limited.
[0040] Storage circuitry 130 can be any storage device configured to store data, such as, but not limited to, random access memory (RAM), read-only memory (ROM), or a hard disk. It should be noted that in different embodiments, storage circuitry 130 may include only a single storage device or multiple storage devices to store different types of data. In one embodiment, storage circuitry 130 is configured to store computer-executable instructions 135.
[0041] Processing circuitry 140 is electrically coupled to storage circuitry 130. In one embodiment, processing circuitry 140 may be configured to retrieve and execute computer-executable instructions 135 from storage circuitry 130. Computer-executable instructions 135 include, for example, but not limited to, firmware / drivers, instructions, and applications associated with hardware modules such as peripheral electronics 110, bus 120, and storage circuitry 130. Processing circuitry 140 can perform operations by executing computer-executable instructions 135 to access signals or data from peripheral electronics 110, bus 120, and storage circuitry 130, thereby performing the functions of electronic device 100.
[0042] Please refer to the following as well. Figure 2 as well as Figure 3 The operation of the electronic device 100 will be explained.
[0043] Figure 2 A flowchart of a communication method 200 combining defined and undefined bus communication mechanisms is shown in one embodiment of the present invention. Communication method 200 is applied to, for example, but not limited to, [various applications]. Figure 1 In the electronic device 100.
[0044] Figure 3 An embodiment of the present invention is shown. Figure 1 A block diagram of the system 300 established by the electronic device 100 according to the communication method 200.
[0045] System 300 can be divided into two parts, corresponding to the user mode UM and kernel mode KM accessible by the operating system (not shown) running in electronic device 100. Specifically, application program 310 corresponds to the user mode UM, which is operable by the user and has relatively limited access to the hardware. Peripheral electronic device 110 corresponds to the kernel mode KM, which is operable by the operating system and has full access to the hardware.
[0046] The components included in System 300 will be combined Figure 2 The process of communication method 200 is described below. An implementation of communication method 200 is as follows: Figure 2 As shown, it includes the following steps.
[0047] In step S210, the application 310 associated with the peripheral electronic device 110 establishes a link with the peripheral electronic device 110 through the built-in driver 320 of the operating system running in the electronic device 100. The built-in driver 320 operates in kernel mode (KM).
[0048] In step S220, the application 310 starts the proxy function library 330 and the proxy driver 340, wherein the proxy function library 330 corresponds to the user mode UM of the operating system and the proxy driver 340 corresponds to the kernel mode KM of the operating system.
[0049] Please refer to Figure 4 . Figure 4 An embodiment of the present invention is shown. Figure 3 The timing diagram of the operation of System 300. Figure 2 The more detailed content of step S220 will be provided through Figure 4 The steps described are presented in a top-down sequence among the components of system 300. Note that the execution of step S220 is independent of the built-in driver 320. Figure 4 The built-in driver 320 is not shown.
[0050] In step S410, the application 310 initializes the proxy function library 330.
[0051] In step S420, the proxy function library 330 installs the proxy driver 340 and sets the driver handle of the proxy driver 340, thereby establishing a link between the proxy driver 340 and the application 310. The driver handle is used by the application 310 and the proxy function library 330 to reference and manage the proxy driver 340.
[0052] In step S430, the proxy function library 330 transmits the driver handle to the application 310 for recording.
[0053] then, Figure 2 In the process, in step S230, the application 310 will enable the proxy function library 330 and the proxy driver 340 to establish a link with the peripheral electronic device 140.
[0054] Please refer to Figure 5 . Figure 5 Another embodiment of the invention is shown. Figure 3 The timing diagram of the operation of System 300. Figure 2 The more detailed content of step S230 will be provided through Figure 5 The steps shown are explained in a top-down sequence among the components of system 300. Note that the execution of step S230 is unrelated to the built-in driver 320. Figure 5 The built-in driver 320 is not shown.
[0055] In step S510, the application 310 transmits device information related to the peripheral electronic device 140 to the proxy function library 330.
[0056] In step S520, the agent function library 330 finds and sets the electronic device handle of the peripheral electronic device 140, and transmits the electronic device handle to the agent driver 340.
[0057] In step S530, the agent driver 340 locates the peripheral electronic device 140 based on the electronic device handle and establishes a link with the peripheral electronic device 140.
[0058] In step S540, the peripheral electronic device 140 is set with a reference count corresponding to the application 310.
[0059] In step S550, the proxy function library 330 is instructed to transfer the electronic device handle to the application program 310.
[0060] then, Figure 2In the process, in step S240, the application 310 will send and receive the defined instructions DBC defined by the built-in driver 320 with the peripheral electronic device 110 through the bus 120 via the built-in driver 320.
[0061] The built-in driver 320 defines defined instructions (DBC) including, for example, but not limited to, standard requests and class requests. Standard requests can be used for all different types of devices conforming to the specifications of bus 120. Class requests, however, vary depending on the type of device (e.g., the aforementioned storage devices and digital camera devices).
[0062] then, Figure 2 In the process, in step S250, the application 310 will send and receive undefined instructions (NBC) from the built-in driver 320 to the peripheral electronic device 110 via the bus 120 through the proxy function library 330 and the proxy driver 340.
[0063] In one embodiment, the proxy function library 330 can perform data translation on undefined instructions NBC corresponding to bus 120, so that instructions not defined by the built-in driver 320 can also be transmitted via bus 120. Undefined instructions may be, for example, but not limited to, access requests or close link requests.
[0064] Please refer to Figure 6 . Figure 6 Another embodiment of the invention is shown. Figure 3 The timing diagram for System 300 operation. When an undefined instruction is an access request... Figure 2 Step S250 contains more detailed information, which will be provided through... Figure 6 The steps shown are explained in a top-down sequence among the components. Note that the execution of step S250 is unrelated to the built-in driver 320. Figure 6 The built-in driver 320 is not shown.
[0065] In step S610, the application 310 transmits an access request to the proxy driver 340 through the proxy function library 330.
[0066] In step S620, the agent driver 340 transmits the access request to the peripheral electronic device 140.
[0067] In step S630, the peripheral electronic device 140 executes the access request and transmits the request execution result to the agent driver 340.
[0068] In step S640, the proxy driver 340 transmits the request execution result to the application 310 through the proxy function library 330.
[0069] Please refer to Figure 7 . Figure 7 Another embodiment of the invention is shown. Figure 3 The timing diagram for System 300 operation. When the undefined instruction is a close connection request... Figure 2 Step S250 contains more detailed information, which will be provided through... Figure 7 The steps shown are explained in a top-down sequence among the components. Note that the execution of step S250 is unrelated to the built-in driver 320. Figure 7 The built-in driver 320 is not shown.
[0070] In step S710, the application 310 transmits a close link request to the proxy driver 340 through the proxy function library 330.
[0071] In step S720, the agent driver 340 clears the resources associated with the peripheral electronic device 140.
[0072] In step S730, the peripheral electronic device 140 removes the reference count corresponding to the application 310.
[0073] In some technologies, to achieve the transmission of non-defined instructions, it is often necessary to use interfaces reserved in the built-in driver or to write a new driver to replace the built-in driver. However, the interfaces reserved in the built-in driver often have many restrictions on non-defined instructions. Newly written drivers are not only more expensive, but may also affect the transmission of standard defined instructions.
[0074] Since the proxy driver in this invention does not need to be loaded onto peripheral electronic devices, but is only set in kernel mode by the proxy function library, it can transmit non-defined instructions without affecting the related functions of standard defined instructions or rewriting the driver.
[0075] The above embodiments only describe implementations where the application sends and receives undefined instructions through the proxy function library and proxy driver. In some embodiments, defined instructions may also be selectively used to enable the application to send and receive instructions with peripheral electronic devices via a bus through the proxy function library and proxy driver.
[0076] It should be noted that the above-described implementation is merely an example. In other embodiments, those skilled in the art can make modifications without departing from the spirit of the invention.
[0077] In summary, the electronic device and its communication method in this invention, which combine defined and undefined bus communication mechanisms, can achieve the purpose of undefined instruction communication through the setting of proxy function libraries and proxy drivers, without affecting the communication of standard defined instructions and without rewriting the driver.
[0078] Although preferred embodiments of the present invention have been disclosed above, these embodiments are not intended to limit the present invention. Those skilled in the art can make changes to the technical features of the present invention based on the explicit or implicit content of the present invention. All such changes fall within the scope of patent protection sought by the present invention. In other words, the scope of patent protection of the present invention shall be determined by the number of claims in this application.
Claims
1. An electronic device that combines defined and undefined bus communication mechanisms, characterized in that, The electronic device includes: Peripheral electronic devices; bus; Storage circuitry, configured to store computer-executable instructions; and Processing circuitry, configured to access and execute the computer-executable instructions to perform a communication method, includes: This enables applications associated with the peripheral electronic device to establish a link with the peripheral electronic device through the built-in drivers of the operating system running in the electronic device. The application starts the proxy function library and the proxy driver, wherein the proxy function library corresponds to the user mode of the operating system and the proxy driver corresponds to the kernel mode of the operating system; The application enables the proxy function library and the proxy driver to establish a link with the peripheral electronic device; The application uses the built-in driver to send and receive predefined instructions defined by the built-in driver with the peripheral electronic device via the bus. as well as The application uses the proxy function library and the proxy driver to send and receive undefined instructions not defined by the built-in driver with the peripheral electronic device via the bus.
2. The electronic device as claimed in claim 1, characterized in that, The step of launching the proxy function library and the proxy driver by the application further includes: The proxy function library is initialized by the application. The proxy driver is installed by the proxy function library, and the driver handle of the proxy driver is set, thereby establishing a link between the proxy driver and the application. as well as The proxy function library transmits the driver handle to the application for recording.
3. The electronic device as claimed in claim 1, characterized in that, The step of the application establishing a link between the proxy function library and the proxy driver and the peripheral electronic device further includes: The application transmits device information related to the surrounding electronic devices to the proxy function library; The agent function library locates and sets the electronic device handle of the surrounding electronic device, and transmits the electronic device handle to the agent driver. The agent driver locates the surrounding electronic device based on the electronic device handle and establishes a link with the surrounding electronic device. Configure the peripheral electronic device to set a reference count corresponding to the application. as well as The proxy function library is used to transfer the electronic device handle to the application.
4. The electronic device as claimed in claim 1, characterized in that, The undefined instruction is an access request, and the communication method further includes: The application transmits the access request to the proxy driver through the proxy function library; The proxy driver transmits the access request to the peripheral electronic device; The peripheral electronic device executes the access request and transmits the request execution result to the agent driver. The proxy driver transmits the result of the request execution to the application through the proxy function library.
5. The electronic device as claimed in claim 1, characterized in that, The undefined instruction is a request to close the connection, and the communication method further includes: The application transmits the close link request to the proxy driver through the proxy function library; The agent driver removes resources associated with the peripheral electronic device; as well as The peripheral electronic device is caused to remove the reference count corresponding to the application.
6. The electronic device as claimed in claim 1, characterized in that, The communication method further includes: The proxy function library performs data conversion on the undefined instructions corresponding to the bus.
7. The electronic device as claimed in claim 1, characterized in that, The bus is a universal serial bus.
8. The electronic device as claimed in claim 1, characterized in that, The defined instructions include standard requests and category requests.
9. The electronic device as claimed in claim 1, characterized in that, The communication method further includes: The application sends and receives the defined instructions with the peripheral electronic device via the bus through the proxy function library and the proxy driver.
10. A communication method that combines defined and undefined bus communication mechanisms, applied in an electronic device, characterized in that, Include: This enables applications related to peripheral electronic devices to establish links with the peripheral electronic devices through built-in drivers of the operating system running in the electronic device. The application starts the proxy function library and the proxy driver, wherein the proxy function library corresponds to the user mode of the operating system and the proxy driver corresponds to the kernel mode of the operating system; The application enables the proxy function library and the proxy driver to establish a link with the peripheral electronic device; The application uses the built-in driver to send and receive predefined instructions defined by the built-in driver with the peripheral electronic device via the bus. as well as The application uses the proxy function library and the proxy driver to send and receive undefined instructions not defined by the built-in driver with the peripheral electronic device via the bus.