CN117708902A - USB port enabling control method and device for intelligent terminal - Google Patents

USB port enabling control method and device for intelligent terminal Download PDF

Info

Publication number
CN117708902A
CN117708902A CN202311676655.6A CN202311676655A CN117708902A CN 117708902 A CN117708902 A CN 117708902A CN 202311676655 A CN202311676655 A CN 202311676655A CN 117708902 A CN117708902 A CN 117708902A
Authority
CN
China
Prior art keywords
usb port
usb
state
node
intelligent terminal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311676655.6A
Other languages
Chinese (zh)
Inventor
刘福利
柳美勋
徐芳芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Wintec System Co ltd
Original Assignee
Qingdao Wintec System Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Wintec System Co ltd filed Critical Qingdao Wintec System Co ltd
Priority to CN202311676655.6A priority Critical patent/CN117708902A/en
Publication of CN117708902A publication Critical patent/CN117708902A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a USB port enabling control method and a device for an intelligent terminal, wherein the USB port enabling control method comprises the following steps: USB port detection: detecting at least one USB port of the intelligent terminal in real time, and outputting a first signal to a kernel of the intelligent terminal when a USB device is inserted into any USB port; a USB port state confirmation step: the kernel confirms the preset state of the USB port according to the first signal; USB port control step: the kernel controls the enabling of the USB port according to the preset state to add USB equipment; or; and the kernel controls the USB port to be disabled according to the preset state so as to refuse to add the USB device.

Description

USB port enabling control method and device for intelligent terminal
Technical Field
The invention relates to the technical field of USB port enabling control of intelligent terminals, in particular to a USB port enabling control method and device for an intelligent terminal which is unattended and self-service shopping and settlement.
Background
The intelligent commercial terminal market faces unattended operation, customers shop and settle accounts by self, terminal equipment exposes multiple USB ports, abnormal USB equipment insertion exists in the scene, and the terminal has a certain use risk no matter copying files or other means.
In order to avoid this use risk in the prior art, the following two methods are mostly adopted:
firstly, adopting a white list management mode, writing USB equipment information with authority into equipment platform hardware FLASH, and enabling the USB equipment if the USB equipment information is in a white list when USB port equipment is accessed; if not, the USB device is disabled. The proposal has the defects that if a manager has a new USB device to be normally accessed for use, the manager also needs to check manufacturer information, product information and the like of the USB device, write the manufacturer information, the product information and the like into a white list, then configure the USB device into terminal equipment through a USB flash disk, and then access the USB device for use, so that the steps are slightly more, the operation is slightly complicated, and the experience effect is poor;
secondly, a PC end com command control mode is adopted, a command is sent to a main control board through the PC end to control the power supply enabling of the USB port, and when the USB port is disabled, the PC needs to be controlled to send a corresponding command for closing the USB port to the main control board. The method also requires PC end instruction regulation and control, is affected by the reliability of multi-line communication, and comprises the communication success rate of the PC and the com port of the main control board, and the communication success rate of the main board and the USB interface circuit.
Therefore, through intensive researches of the inventor, a USB port enabling control method and device for an intelligent terminal for unattended and self-service shopping settlement, which overcome the defects, are developed.
Disclosure of Invention
In view of the above problems, the present invention provides a USB port enabling control method for an intelligent terminal, including:
USB port detection: detecting at least one USB port of an intelligent terminal in real time, and outputting a first signal to a kernel of the intelligent terminal when a USB device is inserted into any USB port;
a USB port state confirmation step: the kernel confirms a preset state of the USB port according to the first signal;
USB port control step: the kernel controls the USB port to enable according to the preset state so as to add the USB equipment; or; and the kernel controls the USB port to be forbidden according to the preset state so as to refuse to add the USB equipment.
The USB port enabling control method described above, wherein the USB port detecting step includes:
and detecting each USB port in real time through a USB controller of the intelligent terminal, and outputting the first signal to the kernel when the USB device is detected to be inserted into the USB port.
The method for controlling the enabling of the USB port, wherein the step of confirming the status of the USB port includes:
storing the preset state of each USB port in a memory of the intelligent terminal;
the kernel reads the preset state in the memory according to the first signal to determine the current preset state of the USB port.
The USB port enabling control method described above, wherein the USB port controlling step includes:
configuring a controllable file node for each USB port in the USB subsystem of the kernel correspondingly;
correspondingly setting the node state of the controllable file node according to the preset state of the USB port;
when the node state is open, the USB subsystem controls the USB port to enable and registers the USB device to add the USB device;
and when the node state is forbidden, the USB subsystem controls the USB port to be forbidden and refuses to register the USB equipment so as to forbidden the USB equipment.
The above method for controlling the enabling of a USB port, further includes:
a node state modifying step: and modifying the current node state of the controllable file node and correspondingly presetting the state according to the node state modification instruction.
The above method for controlling USB port enablement, wherein the step of modifying a node state includes:
configuring a node state writing module for each controllable file node;
the USB subsystem modifies the current node state of the controllable file node through the node state writing module according to the node state modification instruction;
the USB subsystem correspondingly modifies the pre-stored state in the memory according to the modified node state.
The above method for controlling the enabling of a USB port, further includes:
a node state reading step: and reading the preset state of each USB port and displaying the preset state through a display screen of the intelligent terminal.
The method for controlling the enabling of the USB port, wherein the step of reading the node state includes:
configuring a node state reading module for each controllable file node;
configuring a visual switch for each controllable file node, wherein each visual switch has a switch state;
the USB subsystem reads the current node state of the controllable file node through the node state reading module, and correspondingly sets the switch state according to the node state;
and displaying the visual switch and the switch state through a display screen of the intelligent terminal.
In the above method for controlling the enabling of USB ports, the preset state, the node state and the switch state of the same USB port are the same.
The above-mentioned USB port enabling control method, wherein the node state modifying step further includes:
after the kernel is restarted, the preset state, the node state and the switch state of the USB port are all restored to the state before modification.
The invention also provides a USB port enabling control device for an intelligent terminal, wherein the USB port enabling control device comprises:
the USB controller is arranged in the intelligent terminal, detects at least one USB port of the intelligent terminal in real time through the USB controller, and outputs a first signal to the kernel of the intelligent terminal when a USB device is inserted into any USB port;
the memory is internally arranged in the intelligent terminal and used for storing the preset state of the USB port;
the kernel is arranged in the intelligent terminal, and after confirming the preset state of the USB port according to the first signal, the kernel controls the USB port to enable according to the preset state so as to add the USB device; or; and the kernel controls the USB port to be forbidden according to the preset state so as to refuse to add the USB equipment.
The USB port enable control device described above, wherein the kernel includes: the USB subsystem is configured with a controllable file node corresponding to each USB port, and each controllable file node has a node state corresponding to the preset state; the USB port-enabled control device further includes: and each visual switch is provided with a switch state corresponding to each controllable file node, and each visual switch and each switch state are displayed through a display screen of the intelligent terminal.
Compared with the prior art, the invention has the following effects:
firstly, the invention does not need to write new USB equipment information into the white list and suddenly remove the white list, and only needs to open the visual switch when the USB equipment needs to be accessed and close the visual switch when the USB equipment is forbidden;
secondly, the invention does not need to access a PC to realize the power supply enabling of the USB interface for command issuing management and control, and only needs to add a USB device registration control method in a system kernel driver so as to control the registration result of the USB device, thereby reducing the coupling degree of line communication to a certain extent.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention may be realized and attained by the structure particularly pointed out in the written description and drawings.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a USB port enable control method of the present invention;
FIG. 2 is a flow chart of the execution of the visualization switch;
FIG. 3 is a kernel driven registration flow diagram;
fig. 4 is a schematic structural diagram of a USB port enable control device according to the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The exemplary embodiments of the present invention and the descriptions thereof are intended to illustrate the present invention, but not to limit the present invention. In addition, the same or similar reference numerals are used for the same or similar parts in the drawings and the embodiments.
The terms "first," "second," "S1," "S2," …, and the like, as used herein, do not denote a particular order or sequence, nor are they intended to limit the invention, but rather are merely intended to distinguish one element or operation from another in the same technical terms.
With respect to directional terms used herein, for example: upper, lower, left, right, front or rear, etc., are merely references to the directions of the drawings. Thus, directional terminology is used for purposes of illustration and is not intended to be limiting.
As used herein, the terms "comprising," "including," "having," "containing," and the like are intended to be inclusive and mean an inclusion, but not limited to.
As used herein, "and/or" includes any or all combinations of such things.
Reference herein to "a plurality" includes "two" and "more than two"; the term "plurality of sets" as used herein includes "two sets" and "more than two sets".
The terms "about," "approximately" and the like as used herein are used to modify any quantitative or positional deviation that could vary slightly without such slight variation or positional deviation altering its nature. In general, the range of slight variations or errors modified by such terms may be 20% in some embodiments, 10% in some embodiments, 5% in some embodiments, or other values. It should be understood by those skilled in the art that the above mentioned values can be adjusted according to the actual requirements, and are not limited thereto.
Certain terms used to describe the application will be discussed below, or elsewhere in this specification, to provide additional guidance to those skilled in the art in connection with the description of the application.
Referring to fig. 1, fig. 1 is a flowchart of a USB port enable control method according to the present invention. As shown in fig. 1, the method for controlling the enabling of the USB port for the intelligent terminal of the present invention is based on the idea that the registration flow of the plug-and-play USB device in the kernel driver of the operating system is controlled, and specifically includes:
USB port detection step S1: detecting at least one USB port of an intelligent terminal in real time, and outputting a first signal to a kernel of the intelligent terminal when a USB device is inserted into any USB port;
USB port status confirmation step S2: the kernel confirms a preset state of the USB port according to the first signal;
USB port control step S3: the kernel controls the USB port to enable according to the preset state so as to add the USB equipment; or; and the kernel controls the USB port to be forbidden according to the preset state so as to refuse to add the USB equipment.
The USB port detection step S1 includes:
and detecting each USB port in real time through a USB controller of the intelligent terminal, and outputting the first signal to the kernel when the USB device is detected to be inserted into the USB port.
Based on the above, the USB port enabling control method of the invention guides the registration result of the USB device by adding the USB device registration control method in the system kernel driver. When the plug-and-play USB device is plugged in, the kernel driver judges the preset state of the USB device before the USB device is registered, the registration flow of the device is stopped in the disabled state, and the USB device is normally registered in the enabled state.
Further, the USB port status confirmation step S2 includes:
storing the preset state of each USB port in a memory of the intelligent terminal;
the kernel reads the preset state in the memory according to the first signal to determine the current preset state of the USB port.
Still further, the USB port control step S3 includes:
configuring a controllable file node for each USB port in the USB subsystem of the kernel correspondingly;
correspondingly setting the node state of the controllable file node according to the preset state of the USB port;
when the node state is open, the USB subsystem controls the USB port to enable and registers the USB device to add the USB device;
and when the node state is forbidden, the USB subsystem controls the USB port to be forbidden and refuses to register the USB equipment so as to forbidden the USB equipment.
Based on the above, when the plug-and-play USB device is plugged in, the kernel driver can judge the switch file node of the USB device before the USB device is registered, the registration flow of the device is stopped in a disabled state, and the USB device is normally registered in an enabled state.
Still further, the USB port enable control method of the present invention further includes a node state modification step S4: and modifying the current node state of the controllable file node and correspondingly presetting the state according to the node state modification instruction.
The node state modifying step S4 includes:
configuring a node state writing module for each controllable file node;
the USB subsystem modifies the current node state of the controllable file node through the node state writing module according to the node state modification instruction;
the USB subsystem correspondingly modifies the pre-stored state in the memory according to the modified node state.
In this embodiment, the node state modifying step S4 further includes:
after the kernel is restarted, the preset state, the node state and the switch state of the USB port are all restored to the state before modification.
The USB port enabling control method of the invention further comprises the following steps: node state reading step S5: and reading the preset state of each USB port and displaying the preset state through a display screen of the intelligent terminal.
The node state reading step S5 includes:
configuring a node state reading module for each controllable file node;
configuring a visual switch for each controllable file node, wherein each visual switch has a switch state;
the USB subsystem reads the current node state of the controllable file node through the node state reading module, and correspondingly sets the switch state according to the node state;
and displaying the visual switch and the switch state through a display screen of the intelligent terminal.
In this embodiment, the preset state, the node state and the switch state of the same USB port are the same.
Based on the above, the invention adds the terminal equipment exposed USB port control switch drive in the system kernel drive, namely, the exposed USB port file node switch is generated when the system kernel is initialized.
The invention provides a USB port enabling control method, by providing a control switch for each exposed USB port, a manager can manage the actual exposed USB port enabling through controlling the switch, if the exposed USB port function is to be disabled, the corresponding control switch is turned off, and therefore, the exposed USB port cannot be used no matter what USB device is inserted.
Referring to fig. 2-3, fig. 2 is a flowchart illustrating the implementation of the visual switch; FIG. 3 is a flow chart of kernel driven registration. As shown in fig. 2-3, the USB port enabling control method of the present invention is specifically described as follows:
the method aims to realize that an intelligent terminal device supports the exposed USB port to enable dynamic control. The terminal equipment actually exposes the USB ports, each has a corresponding user visual control switch, and the actual corresponding operation is that of the operating system file node. If one of the devices is to be disabled and the USB port is exposed, writing 0 to the corresponding file node, if the USB device is inserted into the port, detecting that the file node corresponding to the switch is 0 in the kernel driver registration flow of the USB device, and immediately stopping the driver registration flow, so that the USB device cannot access the device system.
One of the operating system file nodes is/sys/devices/platform/wt_usb_typeA_ctrl.1/usbcfgTypeA, and the actual generation process is as follows: a drive initialization flow is added to the corresponding kernel. When the new driver is initialized, all exposed USB ports of the terminal are generated into corresponding controllable file nodes one by one, and when the kernel is initialized, a read function and a write function of the controllable file nodes are registered, wherein the controllable file nodes are used for returning to an upper layer, namely a user layer, through the file nodes, and the USB ports correspond to switch states; the latter is used for recording the actual state of the upper layer user control USB port in real time through the file node: default 0 is on and 1 is off.
The system execution flow of the user-controlled visible switch of the exposed USB port is shown in fig. 2, where the value written by the operating system file node corresponding to the user is valid only at the current startup, and the kernel driver is reinitialized to a default value after the restart, so that when the user performs a write operation on the file node each time, the write function in the kernel driver directly writes the written value into the flash for storage, and thus the terminal is started again, and the enabled state of one exposed USB port is still the state controlled by the previous user.
The kernel driver registration flow of the USB device is shown in figure 3, the method of the invention performs intervention control before the kernel driver USB device is added, if the exposed USB port is forbidden, the kernel driver forbids the addition of all devices inserted into the USB port, and cuts off the device node path of the interaction between the user space and the USB device, thereby realizing the purpose of enabling the USB device to be closed.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a USB port enable control device according to the present invention. As shown in fig. 4, a USB port enabling control device for an intelligent terminal according to the present invention, wherein the USB port enabling control device includes:
the USB controller 11 is arranged in the intelligent terminal 1, detects at least one USB port 12 of the intelligent terminal in real time through the USB controller, and outputs a first signal to the kernel of the intelligent terminal when a USB device is inserted into any USB port;
a memory 13, which is built in the intelligent terminal and is used for storing the preset state of the USB port;
the kernel 14 is built in the intelligent terminal, and after confirming the preset state of the USB port according to the first signal, the kernel controls the USB port to enable according to the preset state so as to add the USB device; or; and the kernel controls the USB port to be forbidden according to the preset state so as to refuse to add the USB equipment.
Further, the kernel 14 includes: the USB subsystem 141, in which a controllable file node P corresponding to each USB port is configured in the USB subsystem 141, and each controllable file node P has a node state corresponding to the preset state; the USB port-enabled control device further includes: each visual switch 15 has a switch state corresponding to each controllable file node P, and each visual switch 15 and the switch state are displayed by the display screen 16 of the intelligent terminal.
Further, each controllable file node P is configured with a node status writing module P1 and a node status reading module P2; the USB subsystem 141 modifies the current node state of the controllable file node P through the node state writing module P1 according to a node state modification instruction; the USB subsystem 141 modifies the pre-stored state in the memory 13 correspondingly according to the modified node state; the USB subsystem 141 reads the current node state of the controllable file node P through the node state reading module P2, and correspondingly sets the switch state according to the node state; and displaying the visual switch 15 and the switch state through a display screen 16 of the intelligent terminal.
In summary, the invention does not need to write new USB device information into the white list and suddenly remove the white list, only needs to turn on the visual switch when the USB device needs to be accessed, and turns off the visual switch when the USB device is disabled; meanwhile, the invention does not need to access a PC to realize the power supply enabling of the USB interface for command issuing management and control, and only needs to add a USB device registration control method in a system kernel driver so as to control the registration result of the USB device, thereby reducing the coupling degree of line communication to a certain extent.
Although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A USB port enabling control method for an intelligent terminal, comprising:
USB port detection: detecting at least one USB port of an intelligent terminal in real time, and outputting a first signal to a kernel of the intelligent terminal when a USB device is inserted into any USB port;
a USB port state confirmation step: the kernel confirms a preset state of the USB port according to the first signal;
USB port control step: the kernel controls the USB port to enable according to the preset state so as to add the USB equipment; or; and the kernel controls the USB port to be forbidden according to the preset state so as to refuse to add the USB equipment.
2. The USB port-enabling control method according to claim 1, wherein the USB port detection step includes:
and detecting each USB port in real time through a USB controller of the intelligent terminal, and outputting the first signal to the kernel when the USB device is detected to be inserted into the USB port.
3. The USB port-enabled control method of claim 2, wherein the USB port status validation step includes:
storing the preset state of each USB port in a memory of the intelligent terminal;
the kernel reads the preset state in the memory according to the first signal to determine the current preset state of the USB port.
4. The USB port-enabling control method according to claim 3, wherein the USB port control step includes:
configuring a controllable file node for each USB port in the USB subsystem of the kernel correspondingly;
correspondingly setting the node state of the controllable file node according to the preset state of the USB port;
when the node state is open, the USB subsystem controls the USB port to enable and registers the USB device to add the USB device;
and when the node state is forbidden, the USB subsystem controls the USB port to be forbidden and refuses to register the USB equipment so as to forbidden the USB equipment.
5. The USB port-enabled control method of claim 4, further comprising:
a node state modifying step: and modifying the current node state of the controllable file node and correspondingly presetting the state according to the node state modification instruction.
6. The USB port-enabled control method of claim 5, wherein the node state modifying step includes:
configuring a node state writing module for each controllable file node;
the USB subsystem modifies the current node state of the controllable file node through the node state writing module according to the node state modification instruction;
the USB subsystem correspondingly modifies the pre-stored state in the memory according to the modified node state.
7. The USB port-enabled control method of claim 6, further comprising:
a node state reading step: and reading the preset state of each USB port and displaying the preset state through a display screen of the intelligent terminal.
8. The USB port-enabled control method of claim 7 wherein the node status reading step includes:
configuring a node state reading module for each controllable file node;
configuring a visual switch for each controllable file node, wherein each visual switch has a switch state;
the USB subsystem reads the current node state of the controllable file node through the node state reading module, and correspondingly sets the switch state according to the node state;
and displaying the visual switch and the switch state through a display screen of the intelligent terminal.
9. A USB port-enabling control device for an intelligent terminal, wherein the USB port-enabling control method according to any one of claims 1 to 8 is applied, the USB port-enabling control device comprising:
the USB controller is arranged in the intelligent terminal, detects at least one USB port of the intelligent terminal in real time through the USB controller, and outputs a first signal to the kernel of the intelligent terminal when a USB device is inserted into any USB port;
the memory is internally arranged in the intelligent terminal and used for storing the preset state of the USB port;
the kernel is arranged in the intelligent terminal, and after confirming the preset state of the USB port according to the first signal, the kernel controls the USB port to enable according to the preset state so as to add the USB device; or; and the kernel controls the USB port to be forbidden according to the preset state so as to refuse to add the USB equipment.
10. The USB port-enabled control device of claim 9, wherein the core comprises: the USB subsystem is configured with a controllable file node corresponding to each USB port, and each controllable file node has a node state corresponding to the preset state; the USB port-enabled control device further includes: and each visual switch is provided with a switch state corresponding to each controllable file node, and each visual switch and each switch state are displayed through a display screen of the intelligent terminal.
CN202311676655.6A 2023-12-07 2023-12-07 USB port enabling control method and device for intelligent terminal Pending CN117708902A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311676655.6A CN117708902A (en) 2023-12-07 2023-12-07 USB port enabling control method and device for intelligent terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311676655.6A CN117708902A (en) 2023-12-07 2023-12-07 USB port enabling control method and device for intelligent terminal

Publications (1)

Publication Number Publication Date
CN117708902A true CN117708902A (en) 2024-03-15

Family

ID=90143538

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311676655.6A Pending CN117708902A (en) 2023-12-07 2023-12-07 USB port enabling control method and device for intelligent terminal

Country Status (1)

Country Link
CN (1) CN117708902A (en)

Similar Documents

Publication Publication Date Title
US7042459B2 (en) System for providing a video signal to a display device in a scalable platform
US20060212694A1 (en) Method of updating firmware in computer server systems
WO2005024613A1 (en) Host apparatus, device, and communication system control method
US10235185B2 (en) Computer and controlling method thereof
KR20180085192A (en) System including hot plug module and memory module
JP4409681B2 (en) Information processing apparatus and memory control method for information processing apparatus
CN117708902A (en) USB port enabling control method and device for intelligent terminal
CN116028125A (en) Remote control startup display mode setting method, system, terminal and storage medium
KR100791464B1 (en) Display apparatus and method of controlling the same
JPH0935026A (en) Card for computer
US5987534A (en) Radio selective paging receiver provided with an I/O memory card which can be easily upgraded to include new attributes
KR20040095723A (en) Information processing apparatus
CN112463691B (en) I2C-based line switching circuit and communication system
JPH0778043A (en) Image processor
US8799567B2 (en) Method for accessing files in a management system
JP2003022101A (en) Pio controller
CN117806924B (en) Control method and device of indicating device, server and medium
JPH11110333A (en) Central supervisory system
CN116755651A (en) Configuration method, device, equipment and storage medium of multi-display system
CN117918010A (en) Control method and device of display device, display device and readable medium
CN115168125A (en) Fault detection function test method of RAID card and related components thereof
JP2664168B2 (en) Starting method of information processing device
JP2022081035A (en) Switching circuit and controller
US20070097105A1 (en) Video controller switching system and method
CN116483401A (en) Domain controller firmware upgrading device and upgrading method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination