Equipment access method, data exchange method and related equipment
Patent Information
- Application Number
- CN202380054980.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2022-08-08
- Filing Date
- 2023-08-03
- Publication Date
- 2025-03-04
AI Technical Summary
Existing access devices have single functions and high security risks. Especially when the device needs application expansion, driver software needs to be installed on the computer host. It is easy to capture packets and expose real data sources and network communication data. There is a risk of being maliciously programmed. Risk of cracking.
Configure the scenario configuration information of networked devices through preset generation policies, including descriptor sets and function instruction sets. Preload these configuration information to establish communication connections with the target device to ensure the flexibility and security of device functions. The server stores the preset Set configuration information to monitor and cut off device connections in real time to prevent data leakage.
It realizes the richness and security of device functions, avoids the risk of device being captured and maliciously cracked, and ensures the security of data sources and the privacy of communication.
Smart Images

Figure CN119563304A_ABST
Abstract
Description
Device access method, data exchange method and related devices
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to a Chinese patent application filed with the China Patent Office on August 8, 2022, with application number 202210946796.4 and application name “Device access method, data exchange method, device, equipment and storage medium”, the entire contents of which are incorporated herein by reference. Technical Field
[0003] The present application relates to the field of communication and data security technology, and in particular to a device access method, a data exchange method, an apparatus, a networking device, a server, and a computer-readable storage medium. Background Art
[0004] Currently, the functions of some access devices (such as Universal Serial Bus (USB) devices) are fixed at the factory and cannot be changed after leaving the factory, or their functions can only be changed by rewriting the software. Furthermore, when the access device needs to be expanded, it is necessary to install driver and other control software on the host computer. This makes it easy for the host computer to capture packets, thereby exposing the real data source and network communication data. It may also cause the access device to be hacked by malicious programs, posing a high security risk.
[0005] Summary of the Invention
[0006] The present application provides a device access method, a data exchange method, an apparatus, a networking device, a server, and a computer-readable storage medium to solve the technical problem that current access devices have single functions and high security risks.
[0007] In a first aspect, the present application provides a device access method, applied to a networked device, the method comprising:
[0008] Configuring configuration information of the networked device based on a preset generation strategy, the configuration information including scenario configuration information of the networked device in at least one application scenario, the scenario configuration information including at least one of a first descriptor set and a function instruction set, and data source configuration information, the first descriptor set being used to define a device type of the networked device, and the function instruction set including a descriptor instruction set;
[0009] Preloading the scene configuration information;
[0010] Based on the loaded scenario configuration information, a communication connection is established between the networked device and the target device, so that the networked device is connected to the target device.
[0011] In some implementations of the first aspect, the preloading the scene configuration information includes:
[0012] The networked device preloads the scene configuration information before accessing the target device. The scene configuration information is stored in a server or the networked device, where the server is represented by all electronic devices that are communicatively connected to the networked device and can load the scene configuration information.
[0013] It should be noted that the server in this application can be an electronic device terminal that uses a network connection (such as a connection using TCP / IP for remote communication) or a non-network connection (such as a point-to-point connection using WIFI, Bluetooth, LoRA, etc. for near-field communication). For example, two terminals establish a data interaction relationship, and the first terminal provides scene configuration information or a data source to the second terminal (such as a networked device, an access device, etc.). Then the first terminal can be understood as a server. Of course, the server can also be understood as a server deployed on a network side, a virtual server, a cloud server, a server cluster, or a personal computer, an embedded computer, a mobile phone, a tablet computer, a smart wearable device, as well as a client, a control terminal, and the like.
[0014] In some implementations of the first aspect, the preloading the scene configuration information includes:
[0015] The networked device sends a scene information acquisition request to the server when starting up, wherein the scene information acquisition request includes an identity identifier of the networked device;
[0016] The server responds to the scene information acquisition request and filters the scene configuration information to obtain the scene configuration information that matches the identity identifier of the networked device as the scene configuration information;
[0017] The scenario configuration information is sent to the networked device.
[0018] In some implementations of the first aspect, configuring the scenario configuration information of the networked device includes:
[0019] The scene configuration information is generated after configuring at least one of the first descriptor set and the descriptor instruction set and the data source configuration information through a server connected to the networked device, or a client connected to the server, or the networked device in accordance with a preset generation strategy. The preset generation strategy includes at least one of a custom creation strategy, a template creation strategy, and an external import creation strategy.
[0020] In some implementations of the first aspect, establishing a communication connection with the target device based on the loaded scenario configuration information includes:
[0021] According to the mode selection information in the scenario configuration information, the networked device is set to at least one of a host mode, a slave mode, and a peer-to-peer communication mode.
[0022] In some implementations of the first aspect, if the networked device is set to host mode, establishing a communication connection with the target device based on the descriptor instruction set includes:
[0023] Sending a handshake connection request to the target device;
[0024] receiving a second descriptor set sent by the target device in response to the handshake connection request;
[0025] enumerating a plurality of descriptors in the second descriptor set based on a descriptor instruction set of the functional instruction set;
[0026] If the multiple descriptors of the second descriptor meet the preset device requirements, determining that the handshake connection is successful;
[0027] If multiple descriptors do not meet the preset device requirements, it is determined that the handshake connection has failed, and the obtained second descriptor set is sent to the server, the corresponding third descriptor set is downloaded from the server, and re-enumeration is performed based on the descriptors in the third descriptor set.
[0028] In some implementations of the first aspect, the descriptor instruction set includes a get device descriptor instruction, a get configuration descriptor instruction, a get interface descriptor instruction, a get endpoint descriptor instruction, a get string descriptor instruction, and a get BOS descriptor instruction.
[0029] In some implementations of the first aspect, the method further includes:
[0030] If the handshake connection based on the descriptor in the third descriptor set is successful, a target data source is configured when the networked device communicates with the target device, and the target data source is located in the target device, or the server, or a client connected to the server, or any electronic device that is communicatively connected to the networked device.
[0031] In some implementations of the first aspect, the functional instruction set includes a data source instruction set, and configuring a target data source when the networked device communicates with the target device includes:
[0032] Based on the data source instruction set and according to the data source configuration information, a target data source is determined when the networked device communicates with the target device.
[0033] In some implementations of the first aspect, the target data source includes at least one of a storage medium, a storage space address interval (such as a sector address interval), a mirror storage file, a specific folder, a database, and a data stream.
[0034] In some implementations of the first aspect, the data source configuration information includes at least one of capacity information of the data source, storage media, storage space address range (such as sector address range), read / write status, mirror storage file, specific folder, database, and data stream; and the capacity information includes at least one of the last logical block address of the data source, the total number of formattable logical blocks, and block capacity.
[0035] In some implementations of the first aspect, the descriptor instruction set includes at least one of a first standard instruction set, a first special instruction set, and a setting instruction set, wherein:
[0036] The first standard instruction set is used to send an instruction to the target device to request descriptor data of the target device;
[0037] The special instruction set is used to obtain data of the device type to which the target device belongs;
[0038] The setting instruction set is used to send setting instructions, wherein the setting instructions at least include at least one of instructions such as setting address, enabling configuration, enabling endpoint or starting peripheral module.
[0039] In some implementations of the first aspect, if the networked device is set to host mode, establishing a communication connection with the target device based on the descriptor instruction set includes:
[0040] Sending a handshake connection request to the target device;
[0041] acquiring descriptor data of the target device according to the first standard instruction set;
[0042] Acquiring data of the target device according to the special instruction set;
[0043] According to the setting instruction set, obtaining at least one of a setting address status, an enabling configuration status, an enabling endpoint status, and a starting peripheral module status of the target device;
[0044] If it is determined that at least one of the descriptor data of the target device, the data of the target device, the state of the set address, the state of the enabled configuration, the state of the enabled endpoint, or the state of the started peripheral module of the target device does not meet the conditions specified by the first access state judgment rule, it is determined that the handshake connection has failed, and the descriptor data of the target device is sent to the server;
[0045] receiving new scene configuration information or a new descriptor instruction set sent by the server, wherein the server determines the new scene configuration information or the new descriptor instruction set according to the descriptor data of the target device;
[0046] A communication connection is established between the networked device and the target device according to the new scene configuration information or the new descriptor instruction set.
[0047] In some implementations of the first aspect, if the networked device is set to slave mode, establishing a communication connection with the target device based on the first descriptor set includes:
[0048] Receiving a handshake connection request sent by the target device;
[0049] In response to the handshake connection request, returning the first descriptor set to the target device, so that the target device enumerates the first descriptor set;
[0050] If the handshake connection request meets the preset device requirements, determining that the handshake connection is successful;
[0051] If the handshake connection request does not meet the preset device requirements, it is determined that the handshake connection has failed, and the handshake connection request data is sent to the server, the corresponding fourth descriptor set is downloaded from the server, and re-enumeration is performed based on the descriptors in the fourth descriptor set.
[0052] In some implementations of the first aspect, the first descriptor set includes at least one of a standard data set, a special data set, and an execution setting instruction, wherein:
[0053] The standard data set is used to return descriptor data according to the type and parameters of the standard instruction when the target device sends the standard instruction;
[0054] The special data set is used to return data according to the type and parameters of the special instruction and the type of the networked device when the target device sends a special instruction;
[0055] The execution setting instruction is used to set at least one of the network device address, enable configuration, enable endpoint, and start peripheral module when the target device sends the setting instruction.
[0056] In some implementations of the first aspect, if the networked device is set to slave mode, establishing a communication connection with the target device based on the first descriptor set includes:
[0057] Receiving a handshake connection request sent by the target device;
[0058] receiving at least one of a standard instruction, a special instruction, or a setting instruction sent by the target device; if at least one of the standard instruction, the special instruction, or the setting instruction does not meet the conditions specified by the second access status determination rule, determining that the handshake connection has failed, and sending a descriptor instruction of the target device to the server;
[0059] receiving new scene configuration information or a new first descriptor set sent by the server, wherein the server determines the new scene configuration information or the new first descriptor set according to a descriptor instruction of the target device;
[0060] A communication connection is established between the networked device and the target device according to the new scene configuration information or the new first descriptor set.
[0061] In some implementations of the first aspect, the first descriptor set includes at least one of a device descriptor, a configuration descriptor, an interface descriptor, an endpoint descriptor, a string descriptor, a BOS descriptor, and a preset custom descriptor.
[0062] In some implementations of the first aspect, if the networked device is set to a peer-to-peer communication mode, establishing a communication connection with the target device based on the configuration information includes:
[0063] Configuring the first interface of the networked device as a sending end, and sending data to the target device through the first interface;
[0064] The second interface of the networked device is configured as a receiving end, and data sent by the target device is received through the second interface.
[0065] In some implementations of the first aspect, the configuration information includes at least one of a third mode, a third interface type, an interaction data set, a third state determination rule, and a third state response rule, wherein:
[0066] The third mode is used to set the working mode of the networked device to peer mode;
[0067] The third interface type is used to set the first interface as the sending end and the second interface as the receiving end;
[0068] The interaction data set is used to set the data sent by the networked device to the target device;
[0069] The third status judgment rule is used to judge the access success status or access failure status of the networked device through the data sent by the target device;
[0070] The third status response rule is a rule for responding according to the access status of the networked device.
[0071] In some implementations of the first aspect, the target device includes at least one first target device and at least one second target device, the networked device serves as a host device communicatively connected to the at least one first target device, and as a slave device communicatively connected to the at least one second target device, and establishing a communication connection with the target device based on the target scene descriptor information includes:
[0072] enumerate, based on a descriptor instruction set of the functional instruction set, a plurality of descriptors in a second descriptor set of the at least one first target device;
[0073] If the handshake connection of the multiple descriptors in the second descriptor set is successful, configuring a first target data source when the networked device communicates with the at least one first target device to complete the communication connection between the networked device and the at least one first target device;
[0074] receiving a handshake connection request sent by the at least one second target device;
[0075] In response to the handshake connection request, the first descriptor set is returned to the at least one second target device so that the at least one second target device enumerates the first descriptor set, and after the handshake connection of the first descriptor set is successfully completed, the second target data source when the networked device communicates with the at least one second target device is configured according to the data source configuration information.
[0076] In a second aspect, the present application provides a data exchange method, which is applied to a networked device. The networked device establishes a communication connection with a server and a target device based on the above-mentioned device access method. The method includes:
[0077] Obtaining a data exchange request sent by a first target party;
[0078] Based on a preset processing strategy, respond to the data exchange request and return the target data to the first target party, where the target data is the data sent by the second target party. If the first target party is the server, the second target party is the target device; if the first target party is the target device, the second target party is the server.
[0079] In some implementations of the second aspect, the target device includes at least one first target device and at least one second target device, and the networked device serves as a host device that is communicatively connected to the first target device, and as a slave device that is communicatively connected to the second target device, wherein if the first target party is the server, the second target party is the first target device or the second target device, and if the first target party is the second target device, the second target party is the server or the first target device.
[0080] In some implementations of the second aspect, responding to the data exchange request based on a preset processing strategy and returning the target data to the first target party includes:
[0081] In response to the data exchange request, forwarding the data exchange request to the second target party;
[0082] receiving target data returned by the second target in response to the data exchange request, and forwarding the target data to the first target.
[0083] In a third aspect, the present application provides a data exchange method, which is applied to a networked device, wherein the networked device establishes a communication connection with a target device based on the above-mentioned device access method, and the method includes:
[0084] Determine the target data source according to the data source configuration information in the scenario configuration information;
[0085] Based on the target data source, data interaction is achieved between the networked device and the target device.
[0086] In some implementations of the third aspect, the data source configuration information includes capacity information, storage media, and read / write status of the data source, and the capacity information includes at least one of the last logical block address of the data source, the total number of formattable logical blocks, or the block capacity.
[0087] In some implementations of the third aspect, the target data source is located in the target device, or the networked device, or the server, or the client connected to the server, or any electronic device communicatively connected to the networked device.
[0088] In some implementations of the third aspect, implementing data interaction between the networked device and the target device based on the target data source includes:
[0089] Configuring an automatic running script when the networked device communicates with the target device, the scenario configuration information including the automatic running script;
[0090] Based on the automatic execution script, sending a first data exchange request to the target device, and receiving first data sent by the target device in response to the first data exchange request; or
[0091] Based on the automatic running script, a second data exchange request sent by the target device is received, and second data is sent to the target device in response to the second data exchange request, wherein the first data or the second data is data in the target data source.
[0092] In some implementations of the third aspect, the receiving data sent by the target device in response to the first data exchange request further includes:
[0093] The data sent by the target device is sent to the server, wherein the server is characterized by all electronic devices that are communicatively connected with the networked device and can configure the configuration information.
[0094] In some implementations of the third aspect, the method further includes:
[0095] receiving a first low-level instruction sent by the server, where the first low-level instruction is sent by the client to the server, and the first low-level instruction includes an operation type, an operation storage space, an operation length, and a data packet;
[0096] sending the first low-level instruction to the target device;
[0097] If the operation type of the first low-level instruction is a read operation, receiving data of a first sector address returned by the target device in response to the first low-level instruction, wherein the target device determines the first sector address according to the operation storage space and the operation length;
[0098] If the operation type of the first low-level instruction is a write operation, the data in the data packet is written to the first sector address of the target device.
[0099] In some implementations of the third aspect, the method further includes:
[0100] receiving a search instruction sent by the server, wherein the search instruction is sent by the client to the server, and the search instruction includes file information;
[0101] According to the search instruction, traverse and read the relevant storage space addresses (such as sector addresses) of the target device or the networked device to search for corresponding storage data;
[0102] The stored data is sent to the server, so that the server sends the file data to the client.
[0103] In some implementations of the third aspect, the automatically executed script is a high-level instruction, and the high-level instruction includes a create file instruction, a delete file instruction, a modify file attribute instruction, a read file content instruction, and a modify file content instruction.
[0104] In a fourth aspect, the present application further provides a device access method, applied to a server, the method comprising:
[0105] When communicating with a networked device, target configuration information is issued to the networked device, the target configuration information being used for the networked device to establish a communication connection with the target device, the target configuration information including scenario configuration information of the networked device in at least one application scenario, the scenario configuration information including at least one of a first descriptor set and a descriptor instruction set, the first descriptor set being used to define a device type of the networked device; the scenario configuration information stored on the server is generated by configuring at least one of the first descriptor set and the descriptor instruction set of the networked device and data source configuration information based on a preset generation strategy before preloading the target configuration information;
[0106] Based on the target scenario configuration information, a communication connection is established with the target device so that the networked device is connected to the target device, wherein the target scenario configuration information is one type of the scenario configuration information.
[0107] In some implementations of the fourth aspect, delivering the target configuration information to the networked device includes:
[0108] receiving a scene information acquisition request sent by the networked device, responding to the scene information acquisition request, and filtering the scene configuration information to obtain scene configuration information that matches the identity identifier of the networked device in the scene information acquisition request;
[0109] The scenario configuration information is sent to the networked device.
[0110] In some implementations of the fourth aspect, the method further includes:
[0111] receiving a descriptor set of a target device sent by the networked device, wherein the descriptor set is received by the networked device from the target device;
[0112] The server determines new scene configuration information based on the descriptor set of the target device, and sends the new scene configuration information to the networked device, so that the networked device establishes a communication connection between the networked device and the target device based on the new scene configuration information.
[0113] In a fifth aspect, the present application further provides a data exchange method, which is applied to a server, wherein the server establishes a communication connection with a networked device based on the above-mentioned device access method, and the method includes:
[0114] Sending a data exchange request to the networked device, and receiving target data returned by the networked device, wherein the data exchange request is used for the networked device to respond to the data exchange request based on a preset processing strategy, and the target data is data sent by the target device;
[0115] And / or, according to the data exchange request responded by the networked device based on a preset processing strategy, the target data is sent to the networked device, the target data is returned by the networked device to the target device, and the data exchange request is initiated by the target device.
[0116] In some implementations of the fifth aspect, the method further includes:
[0117] receiving a read operation instruction sent by the networked device, determining data from a data source on the server side according to the read operation instruction, and sending the determined data to the networked device; or
[0118] Receive a write operation instruction and a write data packet sent by the networked device, and write the write data packet into the data source of the server according to the write operation instruction.
[0119] In a sixth aspect, the present application also provides a server, which includes a processor and a memory, and the server can implement the above-mentioned device access method or the above-mentioned data exchange method.
[0120] In a seventh aspect, the present application further provides a data exchange device, which is applied to a networked device, wherein the networked device establishes a communication connection with a server and a target device based on the above-mentioned device access method, and the device includes:
[0121] An acquisition module, configured to acquire a data exchange request sent by a first target party;
[0122] A response module is used to respond to the data exchange request based on a preset processing strategy and return the target data to the first target party, where the target data is the data sent by the second target party. If the first target party is the server, the second target party is the target device; if the first target party is the target device, the second target party is the server.
[0123] In an eighth aspect, the present application also provides a networking device, comprising a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the device access method or the data exchange method is implemented.
[0124] In a ninth aspect, the present application also provides a computer-readable storage medium storing a computer program, which implements the above-mentioned device access method or the above-mentioned data exchange method when executed by a processor.
[0125] In a tenth aspect, the present application further provides a device access method, applied to a networked device, the method comprising:
[0126] When communicating with a server, preloading target configuration information, the server storing at least one preset configuration information, the target configuration information being one of the preset configuration information, the target configuration information including scenario configuration information of the networked device in at least one application scenario, the scenario configuration information including at least one of a first descriptor set and a descriptor instruction set, the first descriptor set being used to define a device type of the networked device; the scenario configuration information stored in the server is generated, before preloading the target configuration information, by configuring at least one of the first descriptor set and the descriptor instruction set of the networked device and the data source configuration information based on a preset generation strategy;
[0127] Based on the target scenario configuration information, a communication connection is established with the target device so that the networked device is connected to the target device, wherein the target scenario configuration information is one type of the scenario configuration information.
[0128] In some implementations of the tenth aspect, preloading target configuration information when communicating with the server includes:
[0129] When communicating with the server, sending a configuration acquisition request to the server, the configuration acquisition request carrying the identification information of the networked device;
[0130] Receive target configuration information corresponding to the identification information returned by the server.
[0131] In some implementations of the tenth aspect, the networked device serves as a host device that is communicatively connected to a target device, and the descriptor instruction set includes a plurality of functional instruction sets, which are used to control data exchange between the networked device and the target device.
[0132] In some implementations of the tenth aspect, establishing a communication connection with the target device based on the target scene descriptor information includes:
[0133] enumerate multiple descriptors in a second descriptor set of the target device based on a function instruction set in the descriptor instruction set;
[0134] If the enumeration is successful, a target data source is configured when the networked device communicates with the target device, and the target data source is set on the target device.
[0135] In some implementations of the tenth aspect, the functional instruction set includes an acquisition instruction set and a verification instruction set, and enumerating multiple descriptors in the second descriptor set of the target device based on the functional instruction set in the descriptor instruction set includes:
[0136] Based on the acquisition instruction set, read a second descriptor set of the target device;
[0137] Verifying the plurality of descriptors in the second descriptor set based on the verification instruction set;
[0138] If the plurality of descriptors meet the preset device requirements, the enumeration is determined to be successful.
[0139] In some implementations of the tenth aspect, the functional instruction set further includes a data source instruction set, the target scenario configuration information further includes data source configuration information, and configuring a target data source when the networked device communicates with the target device includes:
[0140] Based on the data source instruction set and according to the data source configuration information, a target data source is determined when the networked device communicates with the target device.
[0141] In some implementations of the tenth aspect, the networked device is a network read / write control device, and establishing a communication connection with the target device based on the target scene descriptor information includes:
[0142] enumerate multiple descriptors in a second descriptor set of the target device based on a functional instruction set in the descriptor instruction set;
[0143] If the enumeration is successful, a request is made to the server to issue a driver instruction set corresponding to the target device to complete the communication connection. The driver instruction set is used to exchange data with the target device.
[0144] In some implementations of the tenth aspect, the networked device is a network proxy control device, and establishing a communication connection with the target device based on the target scene descriptor information includes:
[0145] enumerate multiple descriptors in a second descriptor set of the target device based on a function instruction set in the descriptor instruction set;
[0146] If the enumeration is successful, the second descriptor set is sent to the server, so that the server virtualizes the target device and generates a virtual device corresponding to the target device, thereby establishing a communication connection with the target device.
[0147] In some implementations of the tenth aspect, the networked device serves as a slave device in communication with the target device, and establishing a communication connection with the target device based on the target scene descriptor information includes:
[0148] receiving an enumeration request sent by the target device;
[0149] In response to the enumeration request, the first descriptor set is returned to the target device so that the target device enumerates the first descriptor set, and after the enumeration is successful, the target data source when the networked device communicates with the target device is configured according to the data source configuration information, and the target data source is set on the server.
[0150] In some implementations of the tenth aspect, the data source configuration information includes capacity information of the data source, and the capacity information includes the last logical block address and block capacity of the data source.
[0151] In some implementations of the tenth aspect, the descriptor set includes at least one of a device descriptor, a configuration descriptor, an interface descriptor, an endpoint descriptor, a string descriptor, and a preset custom descriptor.
[0152] In some implementations of the tenth aspect, the target device includes at least one first target device and at least one second target device, the networked device serves as a host device communicatively connected to the first target device, and as a slave device communicatively connected to the second target device, and establishing a communication connection with the target device based on the target scene descriptor information includes:
[0153] enumerate multiple descriptors in a second descriptor set of the first target device based on a function instruction set in the descriptor instruction set;
[0154] If the enumeration is successful, configuring a first target data source when the networked device communicates with the first target device to complete a communication connection with the first target device, wherein the first target data source is located at the first target device;
[0155] receiving an enumeration request sent by the second target device;
[0156] In response to the enumeration request, the first descriptor set is returned to the second target device so that the second target device enumerates the first descriptor set, and after the enumeration is successful, the second target data source is configured when the networked device communicates with the second target device according to the data source configuration information, and the second target data source is set at the server or the first target device.
[0157] In an eleventh aspect, the present application further provides a data exchange method, which is applied to a networked device, wherein the networked device establishes a communication connection with a server and a target device based on the above-mentioned device access method, and the method includes:
[0158] Obtaining a data exchange request sent by a first target party;
[0159] Based on a preset processing strategy, respond to the data exchange request and return the target data to the first target party, where the target data is the data sent by the second target party. If the first target party is the server, the second target party is the target device; if the first target party is the target device, the second target party is the server.
[0160] In some implementations of the eleventh aspect, the target device includes at least one first target device and at least one second target device, and the networked device serves as a host device that is communicatively connected to the first target device, and as a slave device that is communicatively connected to the second target device, wherein if the first target party is the server, the second target party is the first target device or the second target device, and if the first target party is the second target device, the second target party is the server or the first target device.
[0161] In some implementations of the eleventh aspect, responding to the data exchange request based on a preset processing strategy and returning the target data to the first target party includes:
[0162] In response to the data exchange request, forwarding the data exchange request to the second target party;
[0163] receiving target data returned by the second target in response to the data exchange request, and forwarding the target data to the first target.
[0164] In some implementations of the eleventh aspect, the networked device is a network USB key device, the target device is a computer host, and in response to the data exchange request, forwarding the data exchange request to the second target party includes:
[0165] In response to the data exchange request sent by the computer host, the data exchange request is forwarded to the server, wherein the data exchange request carries the credential information of the network USB key device, so that the server verifies the credential information.
[0166] In some implementations of the eleventh aspect, responding to the data exchange request based on a preset processing strategy and returning the target data to the first target party includes:
[0167] Based on a preset processing script, data processing is performed on the data exchange request to obtain a data processing result;
[0168] Based on the data processing result, sending a target data acquisition request to the second target party;
[0169] Receive target data corresponding to the data processing result returned by the second target party in response to the target data acquisition request, and return the target data to the first target party.
[0170] In a twelfth aspect, the present application further provides a device access method, applied to a server, the method comprising:
[0171] When communicating with a networked device, target configuration information is issued to the networked device, the target configuration information being used by the networked device to establish a communication connection with the target device, the server storing at least one preset configuration information, the target configuration information being one of the preset configuration information, the target configuration information including scenario configuration information of the networked device in at least one application scenario, the scenario configuration information including at least one of a first descriptor set and a descriptor instruction set, the first descriptor set being used to define a device type of the networked device; the scenario configuration information stored by the server being generated, before preloading the target configuration information, by configuring at least one of the first descriptor set and the descriptor instruction set of the networked device and the data source configuration information based on a preset generation strategy;
[0172] Based on the target scenario configuration information, a communication connection is established with the target device so that the networked device is connected to the target device, wherein the target scenario configuration information is one type of the scenario configuration information.
[0173] In a thirteenth aspect, the present application further provides a data exchange method, which is applied to a server, wherein the server establishes a communication connection with a networked device based on the above-mentioned device access method, and the method includes:
[0174] Sending a data exchange request to the networked device, and receiving target data returned by the networked device, wherein the data exchange request is used for the networked device to respond to the data exchange request based on a preset processing strategy, and the target data is data sent by the target device;
[0175] And / or, according to the data exchange request responded by the networked device based on a preset processing strategy, the target data is sent to the networked device, the target data is returned by the networked device to the target device, and the data exchange request is initiated by the target device.
[0176] In a fourteenth aspect, the present application further provides a device access apparatus, applied to a networked device, the apparatus comprising:
[0177] A preloading module, configured to preload target configuration information when communicating with a server, the server storing at least one type of preset configuration information, the target configuration information being one type of the preset configuration information, the target configuration information including scenario configuration information of the networked device in at least one application scenario, the scenario configuration information including at least one of a first descriptor set and a descriptor instruction set, the descriptor set being used to define a device type of the networked device; the scenario configuration information stored on the server being generated, before preloading the target configuration information, by configuring at least one of the first descriptor set and the descriptor instruction set of the networked device, and data source configuration information, based on a preset generation strategy;
[0178] The first establishing module is used to establish a communication connection with a target device based on target scene configuration information so that the networked device can access the target device. The target scene configuration information is one type of the scene configuration information.
[0179] In a fifteenth aspect, the present application further provides a data exchange device, which is applied to a networked device, wherein the networked device establishes a communication connection with a server and a target device based on the above-mentioned device access method, and the device includes:
[0180] An acquisition module, configured to acquire a data exchange request sent by a first target party;
[0181] A response module is used to respond to the data exchange request based on a preset processing strategy and return the target data to the first target party, where the target data is the data sent by the second target party. If the first target party is the server, the second target party is the target device; if the first target party is the target device, the second target party is the server.
[0182] In the sixteenth aspect, the present application also provides a networking device, including a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it implements the above-mentioned device access method or the above-mentioned data exchange method.
[0183] In the seventeenth aspect, the present application also provides a server, which includes a processor and a memory, and the server can implement the above-mentioned device access method or the above-mentioned data exchange method.
[0184] In the eighteenth aspect, the present application also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, it implements the above-mentioned device access method or the above-mentioned data exchange method.
[0185] This application configures the scene configuration information of the networked device and preloads the scene configuration information. The scene configuration information includes at least one of a first descriptor set and a descriptor instruction set. The first descriptor set is used to define the device type of the networked device, so that the device function of the networked device can be redefined according to the target configuration information, making the device function richer. In addition, this application also stores preset configuration information on the server side for real-time monitoring. When the networked device is lost, the communication connection with the networked device can be cut off on the server side to ensure the data source security of the networked device; finally, based on the scene configuration information, a communication connection is established with the target device to enable the networked device to access the target device, thereby effectively avoiding the leakage of the real data source and network communication data by the computer host by obtaining the configuration information and establishing a communication connection with the target device, and effectively avoiding being cracked by malicious programs to ensure the device security of the networked device. BRIEF DESCRIPTION OF THE DRAWINGS
[0186] FIG1 is a flow chart of a device access method in an embodiment of the present application.
[0187] FIG2 is a schematic diagram of the structure of a networking device in an embodiment of the present application.
[0188] 3A-3B are schematic diagrams of a networked device as a portable device interacting with a control terminal in one embodiment of the present application.
[0189] FIG3C is a schematic diagram of an embodiment of the present application in which a networked device as a mobile terminal interacts with a control terminal.
[0190] FIG3D is a schematic diagram of an embodiment of the present application in which a networked device as a smart watch interacts with a control terminal.
[0191] FIG3E is a schematic diagram of an embodiment of the present application in which a networked device as a vehicle-mounted terminal interacts with a control terminal.
[0192] FIG3F is a schematic diagram of a networked device as a multi-interface device interacting with a control terminal in an embodiment of the present application.
[0193] FIG4 is an architectural diagram of target configuration information for configuring networked devices in one embodiment of the present application.
[0194] FIG5A is a structural diagram of a networking device in another embodiment of the present application.
[0195] FIG5B is a structural diagram of a networking device in another embodiment of the present application.
[0196] FIG6 is a flow chart of a device access method provided in another embodiment of the present application.
[0197] FIG7 is a flow chart of a device access method provided in another embodiment of the present application.
[0198] FIG8 is a flow chart of a device access method provided in another embodiment of the present application.
[0199] FIG9 is a flow chart of a device access method provided in another embodiment of the present application.
[0200] FIG10 is a flow chart of a data exchange method provided in an embodiment of the present application.
[0201] FIG11 is a flow chart of a data exchange method in another embodiment of the present application.
[0202] FIG12 is a flow chart of a data exchange method in one embodiment of the present application.
[0203] FIG13 is a flow chart of a data exchange method in another embodiment of the present application.
[0204] [Corrected 11.01.2024 according to Rule 91] Figure 14A is a schematic diagram of controlling the sector address, data packet or status of the "read instruction (single sector read)" from the data exchange perspective in one embodiment of the present application.
[0205] FIG14B is a schematic diagram of the sector address, data packet or status of a “read instruction (multi-sector continuous read)” from the perspective of data exchange in one embodiment of the present application.
[0206] FIG14C shows the sector address, data packet or status of a “write command (single sector write)” from the perspective of data exchange in one embodiment of the present application.
[0207] FIG14D shows the sector address, data packet or status of the “write command (multi-sector continuous write)” controlled from the perspective of data exchange in one embodiment of the present application.
[0208] FIG15 is a flow chart of a data exchange method in another embodiment of the present application.
[0209] FIG16 is a flow chart of a data exchange method in another embodiment of the present application.
[0210] FIG17 is a flow chart of a data exchange method in another embodiment of the present application.
[0211] FIG18 is a flow chart of a data exchange method in another embodiment of the present application.
[0212] FIG19 is a flow chart of a data exchange method in another embodiment of the present application.
[0213] FIG20 is a flow chart of a data exchange method in another embodiment of the present application.
[0214] FIG21 is a flow chart of a data exchange method in another embodiment of the present application.
[0215] FIG22 is a structural block diagram of a device access apparatus provided in an embodiment of the present application.
[0216] FIG23 is a flow chart of a device access method provided in another embodiment of the present application.
[0217] FIG24 is a structural block diagram of a device access apparatus provided in another embodiment of the present application.
[0218] FIG25 is a structural block diagram of a data exchange device provided in an embodiment of the present application.
[0219] FIG26 is a structural block diagram of a data exchange device provided in another embodiment of the present application.
[0220] FIG27 is a schematic diagram of the structure of a networking device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0221] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0222] As documented in the relevant technology, the device functions of some access devices are fixed when they leave the factory and cannot be changed after leaving the factory, or their functions can only be changed by rewriting the software. For example, a USB flash drive with a USB interface is specified to be used only as a storage device when leaving the factory, and in subsequent applications, the USB flash drive can only store data locally. Although some access devices have multiple device functions that can be switched, these functions are pre-set before leaving the factory, so that the access device can only switch between fixed functions and cannot be changed after leaving the factory. In addition, some access devices have a relatively small number of access interfaces, which makes it difficult to meet the needs of multiple functional scenarios. For example, the number of USB communication interfaces of vehicle-mounted equipment is limited (usually 1), and can generally only be used as a USB flash drive reading function.
[0223] In addition, due to the complexity of the actual application of access devices, in the event of hardware incompatibility, such as the new device model not being adapted or the omission of adaptation data for a specific model at the factory, the target device may not be able to recognize the access device access information, resulting in access failure of the access device and an increase in the error correction cost of the access device. For example, if the access device (in this case, the access device is a slave device) fails to access the host device, or the access device (in this case, the access device is a master device) fails to access the slave device, the receiving device needs to be recycled and the hardware needs to be updated, resulting in a waste of resources or an increase in costs.
[0224] Furthermore, data related to device functions or applications is stored locally on the device, which compromises data confidentiality and protection. If the device is lost, the data within it is also lost. Because data, such as critical software and drivers, is stored locally on the device, it can be easily reverse engineered even with protection software. Furthermore, when an access device requires application expansion, control software such as drivers must be installed on the host computer, making it vulnerable to packet capture by the host computer, exposing the true data source and network communication data. This can also lead to the access device being hacked by malicious programs, posing a high security risk.
[0225] The above problems lead to the single function of the equipment on the one hand, the increased cost of error correction on the other hand, and the inability to guarantee the data security of local data when connected to the computer host on the other hand.
[0226] Before introducing the embodiments of the present application, some technical terms used in this document are briefly explained:
[0227] 1. Communication rules between the host and the slave. It is divided into host mode and slave mode. The host actively sends data interaction instructions to the slave, and the slave passively responds according to the data interaction instructions. Taking USB communication rules as an example, USB is divided into host (such as a computer host) and slave (such as a USB flash drive). The host sends a token packet (or token packet + data packet) to the endpoint of the slave, and the slave responds according to the token packet (or token packet + data packet) received by the endpoint. The token packet includes but is not limited to:
[0228] SETUP token packet: used by the host to send data packets to the slave, execute settings, or send data packets to the slave, etc.
[0229] IN token packet: used by the host to obtain data packets from the slave. The slave returns the data packet and ACK status packet; if the slave cannot return the corresponding data packet, it returns a NAK status packet.
[0230] OUT Token Packet: This packet is used by the host to send a data packet to a slave device, along with the data packet itself. The slave device receives the data packet and returns a status packet such as ACK or NYET. If the slave device cannot receive the data packet, it returns a status packet such as NAK or STALL. In some cases, before sending an OUT Token Packet, the host sends a PING Token Packet to test whether the slave device is able to receive data packets.
[0231] In addition, taking USB as an example, the token packet also includes the SOF token packet and other status packets, which will not be described in detail.
[0232] 2. About the principle of enumeration (or establishing a handshake connection). For the host device, enumeration (or establishing a handshake connection) is the process of reading the communication parameters of the slave device to further realize data exchange. Taking the USB mass storage device type as an example: First, read the basic parameters such as the slave descriptor, including the parameters of the hardware descriptor, configuration descriptor, port descriptor, and endpoint descriptor, and load the driver information according to different parameters to enable the hardware to connect and communicate, such as obtaining relevant information of the endpoint. The second is to read the parameters of the mobile storage device, such as capacity, whether it is read-only, etc.; the third is to read the file system information so that it can display the drive letter on the computer operating system. However, in the use of this application, the enumeration process of the operating system is not necessarily strictly followed, but the data necessary for the enumeration of the mobile storage device must be read.
[0233] To this end, an embodiment of the present application provides a device access method, which configures configuration information of the networked device based on a preset generation strategy, the configuration information including scenario configuration information of the networked device in at least one application scenario, the scenario configuration information including at least one of a first descriptor set and a function instruction set, and data source configuration information, the first descriptor set being used to define the device type of the networked device, and the function instruction set including a descriptor instruction set; preloading the scenario configuration information; and establishing a communication connection between the networked device and a target device based on the loaded scenario configuration information so that the networked device can access the target device.
[0234] Optionally, the configuration information is stored in a networked device, a server, or a client.
[0235] An embodiment of the present application provides a device access method, which configures target configuration information of a networked device based on a preset generation strategy, the target configuration information including scenario configuration information of the networked device in at least one application scenario, the scenario configuration information including at least one of a first descriptor set and a function instruction set, and data source configuration information, the first descriptor set being used to define the device type of the networked device, the function instruction set including a descriptor instruction set, and the descriptor instruction set being used to control data exchange between the networked device and a target device; preloading the target configuration information when the networked device is in communication connection with a server; and storing the target configuration information on the server at the same time to facilitate real-time monitoring of the networked device. When the networked device is lost, the communication connection with the networked device can be cut off on the server to ensure the security of the data source of the networked device; establishing a communication connection between the networked device and the target device based on the loaded first descriptor set and at least one of the function instruction set and the data source configuration information, so that the networked device can access the target device.
[0236] An embodiment of the present application provides a device access method. When communicating with a server, target configuration information is preloaded. The server stores a plurality of preset configuration information. The target configuration information is one of the plurality of preset configuration information. The target configuration information includes scene configuration information of the networked device in at least one application scenario. The scene configuration information includes at least one of a first descriptor set and a descriptor instruction set. The first descriptor set is used to define the device type of the networked device. Based on the target scene configuration information, a communication connection is established with the target device to enable the networked device to access the target device. The target scene configuration information is one of the scene configuration information.
[0237] Please refer to Figure 1, which is a flowchart of a device access method provided in an embodiment of the present application.
[0238] The method of the embodiment of the present application can be applied to networked devices, including but not limited to single-chip microcomputers or embedded devices with network functions, terminal devices such as smart phones or laptops, vehicle-mounted terminal devices, vehicle-mounted entertainment terminals, network USB key devices (such as bank U shields, digital certificates, encryption dogs, etc.), network proxy control devices (such as multi-port forwarders), remote controllers (including but not limited to network read and write control devices, network controllers (such as routers and smart gateways, etc.)), communication devices (Communication Device Class, CDC, such as network cards, modems, ISDN (Integrated Services Digital Network) terminals), human interface devices (Human Interface Device, HID, such as keyboards or mice), mass storage devices (Mass Storage Device Class, MSC, such as USB flash drives, network USB flash drives, card readers, network card readers), printer devices (Printer devices, such as printers with USB interfaces), static image acquisition devices (Still Imaging devices), video devices (Video devices), audio and video devices (Audio / Video Devices), smart card devices, USB hub devices (Universal Serial Bus Hub) and custom devices, etc.
[0239] In one embodiment of the present application, a networked device communicates with a server via a wired or wireless network (e.g., an Ethernet interface such as twisted pair or optical fiber, a Wi-Fi hotspot, ultra-wideband (UWB), Bluetooth, 4G or 5G mobile cellular networks, LoRa long-range radio, etc.), and the server includes but is not limited to a personal computer, a mobile phone, a mobile terminal, a laptop computer, an embedded computer, a physical server, a virtual server, a server cluster, and a cloud server. During the networking process between the networked device and the server, a virtual private network (VPN) or dedicated network line may be further configured to enhance network security.
[0240] In one embodiment of the present application, the server is a control terminal. The control terminal includes a server, or a client. The client communicates with the networked device. For example, the client directly connects to the networked device via P2P communication. The communication data between the client and the networked device does not pass through the server, which can improve transmission efficiency during the data exchange process.
[0241] In one embodiment of the present application, the control terminal is located locally on the networked device and is connected to the networked device via near field communication methods such as Bluetooth. In one embodiment of the present application, the control terminal is located locally on the networked device and is connected to the networked device via near field communication methods such as Bluetooth, and has functions such as creating scenes, issuing scenes, and controlling data exchange. In another embodiment of the present application, the control terminal may also be located remotely from the networked device and communicate remotely with the device via a TCP / IP network. In another embodiment of the present application, the control terminal can directly connect to the networked device as a client on the one hand, and on the other hand, the control terminal has the functions of a server, such as creating scenes, issuing scenes, and controlling data exchange.
[0242] In an embodiment of the present application, a scene may be created by a server or a networked device.
[0243] Referring to Figure 2, there is a schematic diagram of the structure of a networking device in one embodiment of the present application. The networking device includes but is not limited to a networking unit 201, a storage unit 202, an interaction unit 203, a first interface 204 and a second interface 205 and a main control module (not shown in the figure), wherein the networking unit 201 is used to communicate with the server, the interaction unit 203 is used to interact with the user, and the first interface 204 and the second interface 205 are used to establish a communication connection with the target device. The first interface 204 can enable the networking device to be connected to the target device (host) as a slave device alone, and the second interface can enable the networking device to be connected to the target device (slave) as a host device alone. The first interface and the second interface can also enable the networking device to be simultaneously a host device and a slave device, and respectively access different target devices. For example, the first interface is communicated with a computer device as a host, and the second interface is communicated with a storage device as a slave to achieve communication connection between the computer device, the networking device (and the server) and the storage device.
[0244] In one embodiment of the present application, the networking unit 201 includes, but is not limited to, an Ethernet interface unit such as a twisted pair or optical fiber for implementing the aforementioned wired connection, as well as a WiFi unit, Bluetooth unit, UWB unit, 4G or 5G communication unit, LoRa long-distance radio communication unit, etc. for implementing the aforementioned wireless connection. The interaction unit 203 includes a display unit, a button, a switch, or a sliding switch. The display unit can be a display screen or a touch screen. The main control module includes at least one of a microcontroller unit (MCU) chip and a host computer.
[0245] In one embodiment of the present application, the first interface 204 or the second interface 205 can be at least one of a USB interface, an HDMI interface, a SCSI interface, an IEEE1394 interface, a SATA interface, an eMMC interface, an SDIO interface, an M.2 interface, a serial communication interface, and the like.
[0246] It should be noted that any device connected to a "networked device" can serve as a "target device." Both the "networked device" and the "target device" can be a host or a slave, or they can serve as peer-to-peer communication devices. A peer-to-peer communication device refers to a communication device that does not distinguish between hosts and slaves. If a networked device serves as a peer-to-peer communication device, the networked device receives data sent by the target device at the first interface (the first interface is the receiving endpoint) and sends data to the target device at the second interface (the second interface is the sending endpoint). Similarly, if the target device serves as a peer-to-peer communication device, the target device receives data sent by the networked device at the receiving endpoint and sends data to the networked device at the sending endpoint.
[0247] In one embodiment of the present application, a user or device manufacturer can pre-configure scenario configuration information for a networked device on a server. Before the networked device connects to a target device, it reads a first descriptor set corresponding to the scenario configuration information from the server, sets the physical communication interface of the networked device, such as the first interface and the second interface, to a host mode, a slave mode, or a peer-to-peer communication mode based on the first descriptor set, and connects to the target device, thereby establishing a connection with the target device and exchanging data.
[0248] In one embodiment of the present application, when the networked device is in slave mode, the data required for communication between the networked device (e.g., the networked device is a USB flash drive) and the host computer can be stored on the server. When the networked device is in host mode, data such as the communication protocol between the networked device and the target device (e.g., the target device is a USB flash drive) can be stored on the server. After powering on, the networked device obtains the required access data, such as the first descriptor set, from the server to complete access and data exchange with the target device.
[0249] It should be noted that the "host" or "host mode" described in the embodiments of this application refers to the relative identity relationship of device A as the host relative to device B. This does not mean that device A can only be a "host" or "host mode" and can also be a "slave" or "slave mode" relative to another device C. Similarly, the "slave" or "slave mode" described in the embodiments of this application refers to the relative identity relationship of device A as a slave relative to device B, and will not be further explained here.
[0250] In one embodiment of the present application, the display unit displays a variety of scenarios preset by the user, and allows the user to choose to switch between different device access scenarios, where "*" represents the currently selected scene. The networked device receives the scenario selected by the user and sends a configuration request to the server or the client connected to the server, wherein the configuration request includes the selected scenario. The server or the client obtains the scenario configuration information that matches the configuration request, and sends the scenario configuration information to the networked device through the server connected to the networked device or the client connected to the server, and the networked device sets the device function of the networked device according to the scenario configuration information.
[0251] For example, when you select one of the scenarios of USB flash drive - 64G, USB flash drive - 1024G or USB flash drive - 16G, the networked device is in the form of a network USB flash drive. The available storage space of the USB flash drive is 64G, 1024G and 16G respectively. The stored data is different, and the corresponding formatted file systems are FAT32, ExFat or CDFS, which are used to store work materials, multimedia materials or operating system startup boot programs respectively.
[0252] When using the digital certificate scenario, the connected device takes the form of a USB key and can be used for identity authentication. For example, when communicating with a computer host and logging into a business system, the USB key can be used for close-range or remote identity authentication.
[0253] When the proxy mode scenario is selected, the networked device is controlled by a network proxy, and the device connected to the interface can be virtualized to the server or control end.
[0254] When the general read-write control mode is selected, the networked device is in the form of a network read-write control device, and can perform read and write control on the device connected to the second interface according to the server instructions or preset rules.
[0255] When the audio enhancement mode is selected, the networked device is in the form of a network intermediate control device, the first interface is connected to the computer host, and the second interface is connected to the audio playback device. The audio data sent by the computer host can be sent to the server in real time for calculation, or the enhanced script model can be downloaded from the server to process the data in the networked device, and the processed audio data can be sent to the audio playback device for audio playback.
[0256] Specifically, after the user selects one of the scenarios from "U disk - 64G, U disk - 1024G, U disk - 16G, digital certificate, universal read-write control mode, proxy mode, universal read-write control mode, audio enhancement mode" through the display unit, the networked device receives the scenario selected by the user and sends a configuration request including the scenario to the server or a client connected to the server. The server or client obtains the configuration information of the selected scenario and sends the scenario configuration information corresponding to the scenario to the networked device through the server connected to the networked device or the client connected to the server. The networked device sets the device function of the networked device to the function or data source (such as different data sources in the form of a U disk) of the selected scenario based on the scenario configuration information.
[0257] It should be understood that in other embodiments, the networked device also includes more or fewer components. For example, the network USB flash drive only has a first interface but no second interface. If the first interface is a male port and is used as an interface when a slave device is needed, then when it needs to be used as a host device, the male port is converted to a female port through an interface converter to serve as an interface when the host device is used. For another example, the networked device includes multiple first interfaces or second interfaces to simultaneously access multiple host devices or slave devices. The networked device may also not require a display unit, and the operation of switching scenes is completed on the server side, or the networked device is controlled by other terminals through Wifi, Bluetooth, NFC, mobile cellular networks (such as 4G, 5G communications) or satellite networks. The display unit may also include more or fewer scenes, which will not be repeated here.
[0258] In one embodiment of the present application, a networked device is connected to a control terminal via a networking unit 201. The control terminal can serve as a server terminal, or a combination of a server terminal and a client terminal. For example, Figures 3A to 3F illustrate schematic diagrams of the interaction between a networked device and a control terminal. The control terminal can be a mobile terminal, a desktop computer, or a server terminal (cloud server), etc. The control terminal pre-creates, edits, configures, or imports scenes (or further selects scenes) based on the server terminal (such as a cloud server) or the control terminal itself. The control terminal can have full permissions or control permissions. For example, user A (desktop display) has the permission to create / configure / import scenes and can create or edit scenes; user B (mobile terminal) has the permission to select scenes and can select scenes based on the scenes created or edited by user A. When the networked device obtains scene information (or further obtains selected scene information) from the cloud server (such as through remote communication) or the control terminal (such as through near-field communication), and enables the corresponding networked device to access the scene according to the configuration, the networked device may have the permission to select scenes; or it may not have the permission to select scenes, and the control terminal will perform the scene preset selection.
[0259] [Corrected 11.01.2024 according to Rule 91] For example, Figures 3A and 3B show schematic diagrams of a networked device as a portable device interacting with a control terminal, wherein the networked device in Figure 3A has a display screen and a second interface 205, and the scene information (or further obtains the scene of the selected corresponding interface) obtained through a cloud server (such as remote communication) or a control terminal (such as near-field communication) can be selected according to the scene list on the display screen; or the networked device in Figure 3B does not have a display screen, but has a second interface 205, and the enabled scene is selected by sliding a switch according to the sequence of scene numbers, etc., and the switching of different scenes (functions) of a single device can be achieved according to the sequence of scene numbers. Figure 3C shows a schematic diagram of a networked device as a mobile terminal interacting with a control terminal, and scene information can be received or selected from the server, or scene information can be created, edited, or imported locally on the mobile terminal; Figure 3D shows a schematic diagram of a networked device as a smart wearable device (such as a smart watch) interacting with a control terminal, and scene information can be received or selected from the server. The networked devices shown in Figures 3C and 3D include a second interface 205. Furthermore, based on the second interface 205, the networked device realizes the conversion between the mobile phone interface (such as TYPE-C interface) and the USB male port (male head in slave mode) or female port (female head in host mode) through a data cable or an interface conversion cable.
[0260] For example, FIG3E shows a schematic diagram of a networked device as an in-vehicle terminal interacting with a control terminal. The networked device has a display screen and a second interface 205. By obtaining scene information from a cloud server (such as remote communication) or a control terminal (such as near-field communication) (or further obtaining scenes corresponding to selected interfaces), the device can select different scene (function) extensions based on the scene list on the display screen, effectively solving the problem of function expansion when the number of interfaces is limited. For example, the USB interface of the in-vehicle device can be used as a host device to connect to a USB flash drive, camera, and other devices, and store data in local storage or on the control terminal or cloud server; or as a slave device (such as a USB flash drive, etc.) to connect to a laptop computer, etc., and the stored interactive data can be stored locally on the in-vehicle device or on the network.
[0261] Exemplarily, FIG3F shows a schematic diagram of a networked device interacting with a control terminal as a multi-interface device. The networked device has multiple second interfaces 205, and scenes are pre-created, configured, or imported according to different interfaces, or scenes are further selected. The networked device obtains scene information from a cloud server (such as remote communication) or a control terminal (such as near-field communication), or further obtains scenes of selected corresponding interfaces, and enables scenes of corresponding interfaces of the networked device according to the configuration. In addition, each interface can also select an enabled scene by sliding a switch according to the sequence of scene numbers. Switching between different scenes (functions) of multiple interfaces of a single device can be achieved.
[0262] It should be noted that the above 3A-3F may also include the networking unit 201 of Figure 2, etc., which will not be repeated here.
[0263] Referring to FIG. 1 , the device access method of this embodiment includes the following steps.
[0264] Step S101, configuring target configuration information of a networked device based on a preset generation strategy, the target configuration information including scenario configuration information of the networked device in at least one scenario, the scenario configuration information including at least one of a first descriptor set and a descriptor instruction set, and data source configuration information, the first descriptor set being used to define a device type of the networked device.
[0265] In this step, the scenario configuration information is configuration information that defines the device type (or device function) of the networked device, and includes but is not limited to descriptor sets, descriptor instruction sets, data source configuration information, and device roles. Descriptor sets include but are not limited to device descriptors, configuration descriptors, interface descriptors, endpoint descriptors, string descriptors, BOS descriptors, and custom descriptors. The descriptor instruction set is an instruction set that implements the host function of the networked device, and includes multiple functional instruction sets, including but not limited to an acquirer instruction set, a verification instruction set, a data source instruction set, an interaction instruction set, and a custom instruction set. The acquire instruction set is used to acquire a descriptor set, the verification instruction set is used to verify various descriptors in the descriptor set, the data source instruction set is used to acquire configuration parameters such as data source configuration information, the interaction instruction set is used to implement data interaction between the networked device and other devices, and includes but is not limited to read instructions, write instructions, create instructions, modify instructions, delete instructions, and set instructions. The custom instruction set is used to define the desired networked device functions. Device roles include host role, slave role and / or peer role. When the networked device acts as a host device, the device role is the host role. When the networked device acts as a slave device, the device role is the slave role. When the networked device acts as a peer communication device, the device role is the peer role.
[0266] Refer to FIG4 , which is an architectural diagram of target configuration information for configuring networked devices in an embodiment of the present application.
[0267] In one embodiment of the present application, the scene configuration information is configured through a server connected to the networked device and a client connected to the server, and the preset generation strategy includes at least one of a custom creation strategy, a template creation strategy or an external import creation strategy.
[0268] In one embodiment of the present application, when the preset generation strategy is a custom creation strategy, the client creates scenario configuration information and sends it to the server. The networked device determines a scenario and sends a request to the server to obtain the scenario. The server sends the scenario configuration information corresponding to the scenario to the networked device in response to the request sent by the networked device.
[0269] Optionally, when the preset generation strategy is a custom creation strategy, the first descriptor set and data source configuration information of the networked device are configured based on the device role of the networked device selected by the user. For example, if the device role of the networked device is selected as a host role (i.e., as a host communicating with the target device), a functional instruction set for host enumeration is configured, such as an acquisition instruction set, a verification instruction set, a setting instruction set, an interaction instruction set, a data source instruction set, and a custom instruction set. The data source configuration information is also configured to bind the data source used in the data exchange process between the networked device and the target device. The data source includes, but is not limited to, mirrored storage files, specific folders, databases, and data streams. If the device role of the networked device is selected as a slave role (i.e., as a slave communicating with the target device), descriptor parameters, device type parameters, and data source configuration information for replying to the host are configured. If the device role of the networked device is selected as a peer role, device exchange configuration information is configured. Configuring the device exchange configuration information includes configuring the data sender or data receiver of the networked device, for example, configuring interface 1 of the networked device as a data sender and configuring interface 2 of the networked device as a receiver.
[0270] In one embodiment of the present application, when the preset generation strategy is a template creation strategy, at least one of the first descriptor set and the descriptor instruction set, and data source configuration information of the networked device are configured based on the preset scenario template. For example, if the application scenario is a networked device acting as a slave device (such as a mass storage device, audio and video device, etc.), then based on the preset scenario template corresponding to the application scenario, the manufacturer, identification information, and string information in the descriptor are configured, as well as the data source configuration information.
[0271] In one embodiment of the present application, when the preset generation strategy is an external import creation strategy, at least one of the first descriptor set and descriptor instruction set of the networked device and data source configuration information are configured based on the imported scenario template; or the data source configuration information is configured based on the imported scenario information.
[0272] It should be noted that this embodiment creates configuration information corresponding to different application scenarios or device roles (device modes) so that the networked device can be applied to multiple application scenarios, thereby improving the applicability of the networked device.
[0273] In one embodiment of the present application, a user can select a scene on the display unit of the networked device, including but not limited to a USB flash drive scene, a USB key scene, a network proxy control scene, and a network intermediate control scene.
[0274] In one embodiment of the present application, the scenario type can be a single device, such as a large-capacity storage device scenario such as a USB flash drive, or multiple scenarios such as a USB flash drive and a camera can be connected to the target device at the same time. For example, a combination of multiple scenarios (USB flash drive scenario + camera scenario) can be connected.
[0275] In one embodiment of the present application, the device corresponding to a single scenario can be a single device, such as a separate USB flash drive connected to the target device; it can also be a composite device type such as a USB flash drive, a camera, etc. that connects to the target device at the same time; or it can be a multi-functional device (such as a USB flash drive, a camera) that selectively connects to the target device.
[0276] In one embodiment of the present application, when creating scenario configuration information, at least one of the first descriptor set and the descriptor instruction set of the networked device and the data source configuration information can be configured based on the device role of the networked device. For example, if the device role of the networked device is a host (for example, as a host communicating with a target device), a descriptor instruction set for the host to enumerate slaves and / or data source configuration information for the host and the slave to exchange data are configured. The data source configuration information is used to bind the data source in the process of data exchange between the networked device and the target device. The data source includes but is not limited to storage media, storage space address intervals (such as sector address intervals), mirror storage files, specific folders, databases, and data streams.
[0277] In one embodiment of the present application, the scene configuration information also includes scene basic information and scene switching strategy. The scene basic information includes one or more of a scene identifier and a scene name. The scene identifier is used to characterize the unique identity of the scene. For example, the unique identity can be the unique ID value of the scene. The scene name is used to characterize the name of the scene. For example, the scene name can be "U disk (work)", "U disk (life)", etc. The scene switching strategy is used to characterize the strategy for selecting or switching scenes of networked devices. The scene switching strategy includes at least a manual operation selection strategy, an automatic operation selection strategy, an allowed or prohibited selection strategy, an allowed or prohibited access strategy, and an interface selection strategy.
[0278] In one embodiment of the present application, the manual selection strategy represents a scenario in which a user selects a networked device through an interactive interface or physical interactive control of a client, server, networked device, control terminal, or target device. For example, the user selects a scenario through an interface of a client application or a web browser.
[0279] Optionally, after the networked device establishes a connection with the target device, the networked device may transmit scene information to the target device through data exchange, and the target device selects the scene of the networked device.
[0280] Optionally, after the networked device establishes a connection with the target device, the networked device can receive scene information transmitted by the target device through data exchange, and the scene of the networked device is selected by the target device, or the networked device, or the server, or the client.
[0281] In another embodiment of the present application, the manual operation selection strategy represents the user selecting a scene in the interactive space of the networked device. For example, the user selects the scene through a button, switch or sliding switch of the networked device. Optionally, the scene can be selected on the display unit of the networked device. Exemplarily, the networked device is provided with a display unit, which displays options for the user to select an application scene, and determines the application scene based on the user's selection operation, so that when the networked device is connected to the server for communication, the configuration information based on the scene selected by the user is preloaded. Similarly, the selection process on the networked device can be a real-time process or a non-real-time process. Optionally, the preset application scene can also be selected on the physical switch of the networked device. Exemplarily, the networked device is provided with a physical switch, and the scene corresponding to the current switch pointer is selected by toggling the physical switch, so that when the networked device is connected to the server for communication, the configuration information based on the scene selected by the user is preloaded.
[0282] Automatic operation selection policies represent pre-set rules for selecting scenarios. A scenario is automatically selected when the client, server, networked device, or target device meets the pre-set selection rules. Pre-set selection rules include selecting scenarios based on a timer. For example, when the local or network timer on a client, server, or networked device matches a pre-set timer, the corresponding scenario is selected.
[0283] In one embodiment of the present application, a scene is selected based on data from a client, server, or peripheral module of a networked device. For example, when the location information of a location module (such as a GPS positioning module or a Beidou positioning module) of a networked device meets a first preset location, or when the signal of a communication module such as a Wi-Fi or Bluetooth device meets a first preset condition (such as whether the signal carries or does not carry a preset MAC address), or when the data of a sensor module of a networked device meets a first preset value (such as a temperature and humidity sensor meets a corresponding first preset value), or when a near-field communication module (such as an NFC communication module) of a networked device receives a specific signal, the corresponding scene is selected.
[0284] In one embodiment of the present application, the networked device automatically selects a corresponding application scenario based on preset interaction data of the target device (such as descriptor content, descriptor instructions, or data communication (or data exchange) content).
[0285] The allowed or prohibited selection policy represents the scenario of allowing / forbidding the selection of networked devices based on the basic information of the scenario, access configuration or data exchange configuration. According to the preset rules of access configuration information (device descriptor, configuration descriptor, interface descriptor, endpoint descriptor, string descriptor, BOS descriptor, etc.) and data exchange configuration information, the selection of specific hardware types is prohibited / allowed, for example, the selection of large-capacity device types (such as USB flash drives) is prohibited, etc. According to the preset rules of peripheral module data, the selection of specific scenarios is prohibited / allowed, for example, when the location information of the location module (such as GPS, Beidou positioning, etc.) of the networked device meets the second preset location, or the signal of the communication module such as WIFI and Bluetooth meets the second preset condition (such as the presence or absence of a preset MAC address), or the data of the sensor module of the networked device meets the second preset value (such as the temperature and humidity sensor meets the corresponding second preset value), or when the NFC communication module of the networked device receives a specific signal, the selection of the corresponding scenario is allowed or prohibited.
[0286] In one embodiment of the present application, the networked device allows or prohibits the corresponding application scenario based on preset interaction data of the target device (such as descriptor content, descriptor instructions or data communication (or data exchange) content sent by the target device).
[0287] The access policy of allowing or prohibiting indicates that based on preset rules, according to the data sent by the target device, the interface of the networked device is allowed / prohibited to access the target device. When at least one of the descriptors (such as the device's vendor ID (Vendor ID), device ID (Product ID) or device type (class, subclass, interface command set, endpoint transmission mode used), descriptor instructions or data communication content) sent by the target device meets the preset requirements, access to the target device is allowed / prohibited. For example, if the access policy allowed or prohibited is to prohibit access to large-capacity storage devices, then when the networked device acts as a host, after sending a descriptor instruction, if the response data of the target device meets the characteristics of a large-capacity device type (such as a USB flash drive), the networked device disconnects to protect the security of the server or control end. Exemplarily, when the networked device acts as a host, the network proxy control device determines the vendor ID (Vendor ID), device ID (Product ID) or device type (class, subclass, interface command set, endpoint transmission mode used) of the access device by reading the descriptor based on a preset script. Remote mapping is allowed only when the accessed target device meets the conditions of the vendor ID, device ID or device type to protect the security of the server or control end.
[0288] The interface selection strategy indicates that if the networked device has only one interface, the selected scenario is enabled by default on the only interface (for example, the only interface of a USB flash drive device). If the networked device has multiple interfaces (for example, multiple interfaces of a USB HUB device), the selected scenario further selects at least one interface to be enabled from the multiple interfaces. For example, if the networked device has two interfaces, scenario A can be selected to enable interface 1, scenario B can be selected to enable interface 2, or scenario A can be selected to enable both interface 1 and interface 2. It should be understood that in other embodiments, the networked device also includes more or fewer components, such as only the first interface but no second interface. If the first interface is a male port and is used as an interface for a slave device (such as a network USB flash drive mode), then when it needs to be used as a host device (such as a read-write USB flash drive mode), an interface converter (such as an OTG adapter) is used to convert the male port to a female port to serve as the interface for the host device. For another example, the networked device includes multiple first interfaces or second interfaces to simultaneously connect to multiple host devices or slave devices. The networked device may also not need a display unit, and the scene switching operation is completed on the server side, or the networked device is controlled by other terminals through Wifi, Bluetooth, NFC, etc. The display unit may also include more or fewer scenes, which will not be repeated here.
[0289] In one embodiment of the present application, when creating scenario configuration information, if the device role of the networked device is a host role (i.e., a host communicating with a target device), first device access configuration information is configured. The first device access configuration information includes a first mode, a first interface type, a standard instruction set, a special instruction set, a setting instruction set, a first access status determination rule, and a first status response rule.
[0290] The first mode sets the networked device to host mode. The first interface type is used to set the physical interface type of the networked device, for example, to a USB interface, HDMI interface, SCSI interface, IEEE1394 interface, SATA interface, eMMC interface, SDIO interface, M.2 interface, serial communication interface, etc. The first interface type can also be further bound to the communication protocol instructions corresponding to the interface type, such as binding USB token packets (such as SETUP, IN, OUT, PING, etc.), or status packets (such as ACK, NAK, NYET, etc.), or transmission methods (such as control transmission, bulk transmission, interrupt transmission, synchronous transmission, etc.), or standard communication protocols, etc. The first standard instruction set includes a descriptor instruction set, which is used to send instructions to the target device (slave) (such as obtaining device descriptors, obtaining configuration descriptors, obtaining interface descriptors, obtaining endpoint descriptors, obtaining string descriptors, obtaining BOS descriptors, etc.), requesting the corresponding descriptor data of the slave to access the target device. The special instruction set includes an instruction set for obtaining device type data, which is used to obtain data of different device types. It should be noted that different networked devices have different special instruction sets corresponding to them. For example, the special instruction set of USB-related U disks (USB Mass Storage Class) includes a descriptor for indicating MAXLUN to obtain the maximum number of logical units, the special instruction set of keyboard and mouse devices (Human Interface Device) includes a descriptor for obtaining HID, and the special instruction set of cameras (USB Video Class) includes a descriptor for indicating GET_RES to obtain resolution attribute, etc. A setting instruction set is used to send setting instructions. Setting instructions include at least one or more instructions such as setting address, enabling configuration (setting configuration), enabling endpoint, or starting peripheral modules. The first access status judgment rule is a rule for judging whether the networked device has successfully accessed / failed based on the data or response status (with response / or no response) returned by the target device. The data returned by the target device includes the data returned by the target device during the access phase or data exchange phase of the networked device. The first status response rule is a rule for responding based on the access status of the networked device. For example, if the networked device successfully connects, it sends a successful connection message to the server, prompting the client to proceed to the next step. If the networked device fails to connect, it sends a failed connection message to the server, obtains a new instruction set, and resends the instruction to the target device. It should be noted that the instruction set described above can be at least one data exchange instruction or multiple data exchange instructions.
[0291] In one embodiment of the present application, multiple pre-selected scenes can be preset for automatic selection when access fails. For example, when the selected scene A (such as accessing a USB flash drive scene) fails to access, scene B (such as accessing a camera device scene) or scene C (such as accessing a keyboard device scene) is switched to retry access until all pre-selected scenes are tried or access is successful.
[0292] In one embodiment of the present application, the server further retrieves, compares, analyzes and judges the returned data based on the relevant access data submitted by the networked device when the access fails (such as the data returned by the target device to the networked device (such as all or part of the descriptor or related handshake data, etc.)), confirms the device type of the target device, and then sends a new descriptor acquisition instruction set to the networked device or selects a new scenario, so that the networked device can retry to access the target device.
[0293] In another embodiment of the present application, when creating the scenario configuration information, if the device role of the networked device is a slave role (ie, a slave communicating with the target device), the second device access configuration information is configured.
[0294] In one embodiment of the present application, the second device access configuration information includes a second mode, a second interface type, a standard data set, a special data set, an execution setting instruction, a second access status judgment rule, and a second status response rule.
[0295] The second mode sets the networked device to slave mode. The second interface type is used to set the type of physical communication interface of the networked device, such as a USB interface, an HDMI interface, a SCSI interface, an IEEE1394 interface, a SATA interface, an eMMC interface, an SDIO interface, an M.2 interface, a serial communication interface, and the like. The first interface type can also be further bound to communication protocol instructions corresponding to the interface type, such as responding to token packets in USB (such as SETUP, IN, OUT, PING, etc.), or status packets (such as ACK, NAK, NYET), or transmission modes (such as control transmission, bulk transmission, interrupt transmission, synchronous transmission, etc.), or standard communication protocols, etc. The standard data set includes a first descriptor data set (such as a device descriptor, a configuration descriptor, an interface descriptor, an endpoint descriptor, a string descriptor, a BOS descriptor, etc.), which is used to return corresponding descriptor data according to the type and parameters of the sent instruction when the target device (the target device is a host device) sends an instruction, so as to establish a communication connection with the networked device. Special data sets include device type special data sets (such as MAXLUN maximum number of logical units, GET_RES resolution attribute, etc.), which are used to return corresponding data according to the type and parameters of the sent instruction, and the networking device scenario configuration or device type when the target device sends an instruction. The execution setting instruction is used to execute the operation of setting the networking device, the physical communication interface of the networking device or the peripheral module when the target device sends the setting instruction according to the type and parameters of the sent setting instruction (such as setting address, enabling configuration (setting configuration), enabling endpoint or starting peripheral module, etc.). The second access status judgment rule is used to judge whether the networking device has successfully / failed to access based on the data sent by the target device (including data sent by the target device during the device access phase or the data exchange phase), for example, the instructions for requesting a USB flash drive device and requesting a camera device are different. The second status response rule is used to respond according to the status of the networking device access (i.e., handshake or enumeration). For example, when it is determined that the networked device has successfully connected (or the handshake is successful, or the enumeration is successful), a successful connection message is sent to the server, and the server prompts the client to proceed to the next step. When it is determined that the networked device has failed to connect, an access failure message is sent to the server, a new data set is obtained, and a signal to establish a connection (such as an enumeration signal) is resent to the target device. It should be noted that the data set described above can be the return data of at least one data exchange instruction, or it can be multiple return data of multiple data exchange instructions.
[0296] In one embodiment of the present application, multiple pre-selected scenes can be preset for automatic selection when access fails. For example, when the selected scene A (as a USB flash drive scene) fails to access, scene B (as a camera device scene) or scene C (as a keyboard device scene) is switched to retry access until all pre-selected scenes are tried or access is successful.
[0297] In one embodiment of the present application, the server further searches, compares, analyzes and judges the sent instruction data based on the relevant access data submitted by the networked device when the access fails (such as the data sent by the target device to the networked device (such as standard instructions, or special instructions, or setting instructions and other instruction data or other related handshake data, etc.), confirms the device type that the target device needs to access, and then sends a new descriptor set to the networked device or selects a new scenario, so that the networked device can retry to access the target device.
[0298] It should be noted that the interface of the networked device in the embodiment of the present application can be switched between host mode and slave mode after leaving the factory (such as an interface with OTG function), or it can be fixed to host mode or fixed to slave mode (such as an interface without OTG function, which is designed to be fixed as a host or slave interface in the hardware circuit). When the interface is fixed to the host or slave mode, the scene corresponding to the interface can only be different scenes in the host mode or slave mode, and there is no need to configure it in the scene configuration. At the same time, depending on the type of interface, it can be fixed to a specific communication protocol without having to configure it in the scene configuration, for example, when the interface is a USB interface, it is fixed to the corresponding USB protocol, etc.
[0299] In another embodiment of the present application, when creating scenario configuration information, if the device role of the networked device is in peer-to-peer communication mode, third device access configuration information is configured. The third device access configuration information includes a third mode, a third interface type, an interaction data set, a setting instruction set, a third state determination rule, and a third state response rule.
[0300] The third mode is used to set the networked device to a peer-to-peer communication mode. The second interface type is used to set the type of physical communication interface of the networked device. The interactive data set is used to set the data sent to the target device during access. The execution setting instruction is used to execute the operation of setting the networked device, the interface of the networked device or the peripheral module according to the type and parameters of the setting instruction sent (such as setting the address or starting the peripheral module) when the target device sends the setting instruction. The third state judgment rule is used to judge the success / failure of the access of the networked device through the data sent by the target device (including the data sent by the target device during the data exchange phase). The third state response rule is used to respond according to the state of the access. For example, when it is judged that the networked device has successfully accessed, a successful access message is sent to the server, and the server prompts the client to proceed to the next step; when it is judged that the networked device has failed to access, while sending the failed access message to the server, a new data sending instruction or response data set is further obtained, and data is resent to the target device / or waits for data to be received.
[0301] In one embodiment of the present application, the scenario configuration information also includes data exchange configuration information. If the device role of the networked device is a host (e.g., a host communicating with a target device), the data exchange configuration information includes a data source instruction set, a data exchange instruction set, an automatic execution instruction script, a first binding interaction system or data source policy, and a first allow / disallow exchange policy.
[0302] The data source instruction set is used to send instructions to the target device to obtain or set the target device's data source information, such as obtaining the target device's capacity information (such as the maximum number of logical units, the total number of formattable logical blocks, the last logical block address, block capacity, total capacity, available space capacity, etc.) or read / write status (such as read-only status, write-only status, readable and writable status), etc. The data exchange instruction set is used to send instructions to the target device to cause the target device to execute preset instructions or return data. For example, a write instruction and a data packet are sent to the target device to cause the target device to write the data in the data packet to a specific location on its storage medium; or a read instruction is sent to the target device to cause the target device to return data at a specific location on its storage medium, or to read specific data from the target device's peripheral module, or sensor-specific data. The write instruction and the read instruction at least include the storage space address (such as the sector address) of the storage medium to be operated and the number of storage spaces to be operated (such as the number of sectors).
[0303] In one embodiment of the present application, the data exchange instruction set may be a low-level instruction. The data exchange instruction includes a USB communication protocol instruction. The USB communication protocol instruction includes: sending an IN token packet to a specific endpoint (e.g., endpoint 1) of a target device (e.g., a USB device) to obtain data returned by the target device (i.e., an IN data instruction to endpoint 1); and / or sending an OUT token packet and a data packet to a specific endpoint (e.g., endpoint 2) of the target device (USB device) to send data to the target device (i.e., an OUT data instruction to endpoint 2).
[0304] Data exchange instructions (e.g., low-level instructions) include Small Computer System Interface (SCSI) transparent command set instructions. SCSI transparent command set instructions send a read instruction to a target device (e.g., a USB storage device) to retrieve data from a specific sector address in the target device's storage space; and / or send a write instruction and data packet to a target device (e.g., a USB storage device) to write data to a specific sector address in the target device's storage space.
[0305] In another embodiment of the present application, the data exchange instruction set includes an automatic execution instruction script. The automatic execution instruction script represents that according to the preset script rules, interactive instructions (including low-level instructions, or high-level instructions, etc.) are automatically sent to the target device to realize automated operation. The automatic execution instruction script includes the automatic execution of the file directory reading script. For example, after the target device (such as a storage device) is successfully connected, the automatic operation rule is triggered, and the file directory reading script is automatically executed to read the file information, and the data of the read file information is converted and displayed in the interactive system (such as the client interface). Specifically, the automatic execution of the file directory reading script automatically reads all file directory data according to the file system protocol rules. The reading rules include: first reading the boot sector data (generally the sector address 0x00) to analyze the file system boot sector address; then reading the file system boot sector data to analyze the sector address of the root folder (or first directory) and related parameters such as the cluster (block) size, and then reading the root folder sector address data to analyze the file information; then based on the file information, subdirectories, subfiles, etc. can be analyzed.
[0306] Furthermore, the automatically executed command script can also include high-level commands. High-level commands are scripted instructions based on multiple low-level commands (such as read / write commands of the USB communication protocol and / or SCSI transparent command set), and are executed based on user operations or timing conditions. For example, file operation commands developed for different file system protocols (such as exFAT, FAT32, and other file systems) can automatically send multiple interactive commands (including multiple low-level commands and references between high-level commands) to the target device based on the parameters of the high-level command (such as file path and file name). Based on the context analysis of the read and write data of the interactive command, the script reads / writes specific storage space data (such as sector address data) in the target device's file system to implement specific file operation functions, such as "create file command," "delete file command," "modify file attributes command," "read file content command," "modify file content command," etc. High-level commands can be issued to networked devices by operators through trigger commands from clients, servers, or networked devices; they can also be issued to networked devices through trigger commands from peripheral modules such as timing devices and GPS. Advanced instructions can also reference each other. For example, the "Create and generate content advanced instruction" can first execute the create file instruction (the file name is the parameter of the create file instruction), and then execute the modify file content instruction (the file name and file content are the parameters of the modify file content instruction). For example, it can create a text file named test.txt with the file data as the test string.
[0307] In one embodiment of the present application, the high-level instructions may be file operation instructions developed according to different file system protocols, such as create file instructions, delete file instructions, modify file attribute instructions, read file content instructions, modify file content instructions, etc.
[0308] In one embodiment of the present application, the automatically executed instruction script includes a data monitoring script. The data monitoring script is used to automatically respond to the server or client when the preset rules are met. For example, the networked device sends an IN token packet to the IN endpoint of the target device (such as a USB video source device, a USB camera, etc.) to detect whether the target device has sent a data packet (non-NAK status packet) to the networked device through the IN endpoint. When the IN endpoint sends a data packet, the data packet received from the IN endpoint is forwarded to the client or server.
[0309] In one embodiment of the present application, automatically executing a command script includes automatically executing a preset script (such as a high-level command or a low-level command) based on data from a peripheral module (such as a positioning module GPS, a sensor, etc.), a timing device, or a network module. For example, when the location detected by the GPS positioning device is not at a preset location or the local IP address of the networked device is not at a specific address, a command to delete file data or a script to start data monitoring may be executed.
[0310] The first binding interaction system or data source strategy is used by the networked device to automatically convert the instructions issued by the client and the server into a preset data exchange instruction set (at least one instruction) and send the converted data exchange instruction set to the target device for execution. For example, the instructions issued can be for the client to read a file / or write a file, read / write a specific sector address, and other operations.
[0311] In another embodiment of the present application, the first binding interaction system or data source strategy is also used to automatically store the data after the networked device operates on the target device in any location such as a storage medium (such as a storage chip, hard disk, etc.) in the networked device, client, or server, a storage space (such as a sector interval), a specific database / or folder / or file (such as a mirror file), a storage space or a structured data string.
[0312] The first policy of allowing / forbidding exchange indicates whether to allow / forbid the client or server to send specific instructions to the target device through the networked device, for example, prohibiting sending instructions to write data to the target device.
[0313] In one embodiment of the present application, the first exchange policy may include a low-level instruction. The first exchange policy may include a USB communication protocol instruction, such as an instruction to allow or prohibit sending an IN or OUT token packet to a specific endpoint. The first exchange policy may also include a SCSI transparent command set instruction, such as an instruction to allow or prohibit sending a read or write request to a specific sector location.
[0314] In another embodiment of the present application, the first policy of allowing / forbidding exchange may include a high-level instruction. For example, the first policy of allowing / forbidding exchange may be a file operation instruction, such as only allowing / forbidding sending a delete file instruction.
[0315] The first allow / prohibit exchange policy can also represent control based on the data packet corresponding to the instruction, allowing / prohibiting the target device to send specific data (such as a data packet with specific characteristics) to the networked device. For example, the data packet attached to the allow / prohibit write instruction meets the specific characteristics, and the write instruction is sent to the target device. Or the data packet returned by the target device in the allow / prohibit read instruction meets the specific characteristics, and the read instruction is sent to the server and the client. The first allow / prohibit exchange policy can also represent a policy for executing allow / prohibit data exchange based on data from peripheral modules (such as positioning modules, sensors, network modules, etc.).
[0316] [Corrected 11.01.2024 according to Rule 91] In one embodiment of the present application, if the device role of the networked device is a slave (for example, as a slave connected to a target device for communication), the data exchange configuration information includes a command response operation, an automatic execution of a command response operation script, a second binding interaction system or data source policy, and a second allow / prohibit exchange policy.
[0317] The command response operation is used to respond to the data exchange command sent by the target device, such as executing a preset operation or returning data.
[0318] In one embodiment of the present application, the data exchange instruction set sent by the target device to the networked device may be a low-level instruction, such as a USB communication protocol instruction. The data exchange instruction set includes: when the target device (e.g., a USB device host) sends an IN token packet to a specific endpoint (e.g., endpoint 1) of the networked device, the target device sends a response data packet to endpoint 1; when the specific endpoint (e.g., endpoint 2) of the target device sends an OUT token packet and a data packet, the target device receives a data packet sent to endpoint 2 OUT.
[0319] In one embodiment of the present application, the data exchange instruction set sent by the target device to the networking device may be a SCSI transparent command set instruction. The data exchange instruction set includes: when the target device (acting as the host device) sends a read instruction to read data at a specific sector address, returning the data at the specific sector address in the data storage space to the target device; and when sending a write instruction (the write instruction includes the specific sector address and a data packet) to the target device, writing the data packet to the specific sector address in the data storage space.
[0320] In one embodiment of the present application, the data exchange instruction set sent by the target device to the networked device can be a high-level instruction, such as a file operation instruction developed according to different file system protocols. The data exchange instruction set includes at least one of a create file instruction, a delete file instruction, a modify file attribute instruction, a read file content instruction, and a modify file content instruction. The data exchange instruction set can also be an operation based on multiple low-level instructions (such as read / write instructions of the USB communication protocol and the SCSI transparent command set), or can be an automated script for performing operations according to specific rules.
[0321] In one embodiment of the present application, the objects operated by the instruction set of the data exchange instruction set of the networked device include storage objects and peripheral module objects. The storage objects include at least one of the local storage chip of the networked device, the database / folder / file (such as an image file) / storage space (such as a sector interval) in the client / server. The peripheral module objects include at least one of the positioning module, sensor module, audio and video source module, human-computer interaction module, and encryption module.
[0322] An automatic execution command response script allows a networked device to automatically return data to a target device, perform data-related read and write operations, or control peripheral modules according to pre-set script rules, achieving automated operations. For example, if backup is required and data at a specific sector address is protected, when the target device sends data to be written to a specific sector address, the data at that sector address will be automatically read and written to the backup storage space before the target device executes the data write operation.
[0323] In one embodiment of the present application, a networked device automatically executes a command response operation script, including a data monitoring script. The data monitoring script includes low-level instructions. When a preset rule is met, the data monitoring script automatically responds to a server, client, control terminal, or an electronic device connected to the networked device. For example, a target device sends an OUT token packet and a data packet to the OUT endpoint of the networked device. When the networked device detects that the endpoint number or data packet content meets the preset rule, it forwards the data packet to the client or server or issues a notification.
[0324] In one embodiment of the present application, automatically executing a command response operation script includes automatically executing a preset script (such as a high-level command or a low-level command) based on data from a peripheral module (such as a positioning module GPS, a sensor, etc.), a timing device, or a network module. For example, when the location detected by the GPS positioning device is not at a preset location or the local IP address of the networked device is not at a specific address, a command to delete file data or a script to start data monitoring may be executed.
[0325] The second binding interaction system / or data source is used to automatically convert the instructions issued by the target device into preset instruction response operations and execute them. For example, the instructions issued by the target device can be operation instructions such as reading a file / or writing a file, reading / writing a specific sector address, etc. The networked device performs the corresponding operation according to the instruction and returns a data packet or status packet. At the same time, the networked device also responds to capacity information (such as the maximum number of logical units, the total number of formattable logical blocks, the last logical block address, block capacity, total capacity, available space capacity, etc.) or read-write status (such as read-only status, write-only status, readable and writable status), etc. according to the instruction.
[0326] In another embodiment of the present application, the second binding interaction system or data source strategy is also used to automatically associate the data source of the command response operation to any location such as a storage medium (such as a storage chip, hard disk, etc.) in a networked device, client, or server, a storage space (such as a sector interval), a specific database / or folder / or file (such as an image file), a storage space or a structured data string.
[0327] The second policy of allowing / forbidding data exchange represents control based on instructions, and allows / forbids the client, server or networked device to operate (or respond) to specific instructions sent by the target device, such as prohibiting operation or response to the write data instruction sent by the target device.
[0328] In one embodiment of the present application, the second data exchange permission / prohibition policy includes a low-level instruction. The second data exchange permission / prohibition policy may be a USB communication protocol instruction, such as an instruction to allow / prohibit the operation (or response) of a token packet sent by the target device to an endpoint IN / or OUT of the networked device. The second data exchange permission / prohibition policy may also be a SCSI transparent command set instruction, such as an instruction to allow / prohibit the operation (or response) of the target device to send a read / write instruction to a specific sector location to the networked device.
[0329] [Corrected 11.01.2024 according to Rule 91] In another embodiment of the present application, the second exchange permission / prohibition policy may include a high-level instruction. For example, the second exchange permission / prohibition policy may be a file operation instruction, such as allowing / prohibiting an operation (or responding) to a delete file instruction sent by the target device to the networked device. The second exchange permission / prohibition policy may also represent control based on the data packet corresponding to the instruction, allowing / prohibiting an operation (or responding) on specific data sent by the target device to the networked device.
[0330] In another embodiment of the present application, when creating scenario configuration information, if the device role of the networked device is a peer-to-peer communication device, the device exchange configuration information is configured. Configuring the device exchange configuration information includes configuring the data sending end or the data receiving end of the networked device, for example, configuring interface 1 of the networked device as the data sending end, and sending data to the receiving end of the target device through interface 1; configuring interface 2 of the networked device as the receiving end, and receiving data sent by the target device through interface 2. In one embodiment of the present application, the specific content of configuring the data sending end of the networked device can refer to the data exchange configuration information for configuring the host above, and the specific content of configuring the data receiving end of the networked device can refer to the data exchange configuration information for configuring the slave above.
[0331] Step S102: preload the target configuration information.
[0332] Optionally, the scene configuration information is created locally on the networked device, and when the networked device is started (or before being connected), the scene configuration information is preloaded.
[0333] Optionally, the scene configuration information is created on the server, and the networked device preloads the scene configuration information obtained from the server.
[0334] Optionally, the scene configuration information is preset on the server, and the networked device preloads the scene configuration information obtained from the server.
[0335] Optionally, step S102 also includes: when communicating with the server, preloading target configuration information, the server stores a plurality of preset configuration information, the target configuration information is one of the plurality of preset configuration information, the target configuration information includes scene configuration information of the networked device in at least one application scenario, the scene configuration information includes at least one of a first descriptor set and a descriptor instruction set, and the first descriptor set is used to define the device type of the networked device.
[0336] Optionally, step S102 also includes: the scene configuration information stored by the server is: before preloading the target configuration information, based on a preset generation strategy, generated by configuring at least one of the first descriptor set and the descriptor instruction set of the networked device, and the data source configuration information.
[0337] Optionally, before step S102: based on a preset generation strategy, configure the first descriptor set and data source configuration information of the networked device to generate the scenario configuration information, and the preset generation strategy includes at least one of a custom creation strategy, a template creation strategy or an external import creation strategy.
[0338] In one embodiment of the present application, when the networked device is started (or before access), the networked device establishes a communication connection with the server and preloads the scene configuration information stored on the server. It is understood that in other embodiments, the preloading process can be performed at other times after the networked device establishes a communication connection with the server, and the communication establishment process can also be performed at other times after the networked device is started.
[0339] In one embodiment of the present application, the scene configuration information is associated with the identification information of the networked device. For example, the identification information of the networked device may be S123456. The user or manufacturer pre-associates the scene configuration information of a single scene, or the scene configuration information of multiple scenes, with the identification information S123456 of the networked device on the server. The networked device initiates a connection request to the server, and the connection request carries the identification information of the networked device. Based on the connection request sent by the networked device, the server sends the scene configuration information corresponding to the identification information of the networked device to the networked device. The identification information of the networked device may be data fixed in the main control chip of the networked device, data of a peripheral module of the networked device (such as an encryption chip), or user identification information. For example, after the user binds the device, the device retains the user's unique identification information. The identification information of the networked device may be a string or binary data. In addition, the scene configuration information may be associated with the user identification information. The scene configuration information associated with the user identification information may be used for permission control or multi-user scene sharing.
[0340] In one embodiment of the present application, all scenario configuration information corresponding to the networked device stored on the server can be preloaded, or the scenario configuration information of the networked device in the current application scenario can be preloaded. For example, based on a preset application scenario, the scenario configuration information corresponding to the application scenario is preloaded to the server.
[0341] In one embodiment of the present application, a networked device pre-sets a fixed scenario configuration template, obtains specific information in the scenario configuration from a server, and then combines the specific information with the pre-set scenario configuration template to generate and load the scenario configuration information. For example, a networked device is factory-preset with a USB flash drive scenario template. When switching scenarios, the scenario configuration information obtained from the server only includes storage capacity information, read / write status, related strings, vendor ID, device ID, and other data source-related configuration information, so as to switch between different USB flash drive data sources and achieve functional changes.
[0342] In one embodiment of the present application, the power supply method of the networking device includes but is not limited to: 1. When the networking device is connected to the target device, the power supply of the target device is used to power the networking device. For example, when the networking device acts as a slave, it is connected to the target device (such as a computer host) to obtain the power supply of the computer host; 2. The networking device has a built-in power supply device to use the built-in power supply for power supply; 3. The networking device is powered by an external power supply. For example, when the networking device acts as a host, it is connected to a mobile power supply or a charging head through a first interface to obtain power, and the second interface is connected to the target device (such as a slave device). When the networking device acts as a slave, it is connected to a mobile power supply or a charging head through the second interface to obtain power, and the first interface is connected to the host device.
[0343] Optionally, the process of establishing communication between the networked device and the server includes: sending a communication connection request to the server based on preset server configuration information. The preset server configuration information can be stored in the networked device, and includes but is not limited to the server's communication address (IP address or domain name address, etc.), port, user name and access password, etc. For example, when the networked device is powered on and started, it reads the local preset server configuration information, and based on the preset server configuration information, sends a communication connection request to the server to establish a communication connection.
[0344] Optionally, networked devices communicate with a server via a wired or wireless network (e.g., Ethernet interfaces such as twisted pair or optical fiber, Wi-Fi hotspots, ultra-wideband (UWB), Bluetooth, mobile cellular networks (e.g., 4G or 5G), satellite communications, and LoRa long-range radio). The server includes, but is not limited to, personal computers, laptops, embedded computers, physical servers, cloud servers, and other devices with network service capabilities, or electronic products such as mobile phones and mobile terminals. During the networking process, network security can be further enhanced by setting up a virtual private network or using dedicated network lines.
[0345] In one embodiment of the present application, a preset application scenario can be selected on the server. For example, the server is accessed through a client (such as an application or a web browser), and the user selects the scenario configuration information to be sent to the networked device on the user terminal. When the networked device communicates with the server, the scenario configuration information based on the user selection is preloaded.
[0346] It can be understood that the selection process on the server side can be a real-time process or a non-real-time process, that is, when the scene configuration information needs to be preloaded, the application scenario corresponding to the scene configuration information can be selected in real time on the server side, or the application scenario corresponding to the scene configuration information can be pre-selected, and when the scene configuration information needs to be preloaded, the scene configuration information can be preloaded based on the pre-selected application scenario.
[0347] In one embodiment of the present application, a preset application scenario can be selected on an interactive module of a networked device. For example, the interactive module of the networked device includes a display unit that displays options for a user to select an application scenario. Based on the user's selection, the application scenario is determined, and configuration information based on the user-selected scenario is preloaded when the networked device communicates with the server. Similarly, the selection process on the networked device can be real-time or non-real-time.
[0348] In one embodiment of the present application, the preset application scenario can also be selected on a physical switch of the networked device. For example, the networked device is provided with a physical switch, and by toggling the physical switch, the application scenario corresponding to the current switch pointer is selected. Thus, when the networked device communicates with the server, configuration information based on the scenario selected by the user is preloaded.
[0349] In one embodiment of the present application, a preset application scenario can also be automatically selected by the networked device. For example, the networked device automatically selects the corresponding application scenario based on preset interaction data of the target device (such as descriptor content, descriptor instructions, or data communication content). Alternatively, the corresponding application scenario is selected at a specific location based on the location information of the GPS module of the networked device; or the corresponding application scenario is automatically selected based on the local timer or network timer of the networked device.
[0350] After obtaining the scene information, the networked device can save it locally and use the scene information directly the next time it runs, without having to obtain it from the server. The scene information can also be deleted when the networked device fails to connect to the server or when the server issues a command to clear the scene data. It should be noted that the target configuration information of this application can be stored on the server to prevent the networked device from being maliciously reverse-engineered after it is lost. At the same time, the server is conducive to the real-time hot update of the target configuration information.
[0351] [Corrected 11.01.2024 according to Rule 91] In one embodiment of the present application, the carrier of the scenario information includes but is not limited to at least one of the following: (1) a transmitted binary data stream, such as a network data stream, which can be a string, a structure, etc., wherein the networked device can directly read and configure the usage scenario information from the server; (2) a binary file, such as a file such as "network U disk.txt" (single scenario) or "USER123456.txt" (user scenario set), wherein the networked device imports and configures the usage scenario information after downloading the file. (3) Link library files, such as dynamic link libraries such as "Network U disk.so" (single scenario) or "USER123456.so" (user scenario set), wherein the networked device further calls functions, variables, literals, etc. to configure the usage scenario information after downloading the link library file; and static link libraries such as "Network U disk.a" (single scenario) or "USER123456.a" (user scenario set), wherein the networked device further compiles or directly calls functions, variables, literals, etc. to configure the usage scenario information after downloading the link library file.
[0352] In one embodiment of the present application, after obtaining the scene information, the networked device enables the scene information on the first interface or the second interface of the networked device. If the networked device has only one interface, the scene defaults to enabling the only communication interface, such as the first interface or the second interface. If the networked device has multiple interfaces (as shown in FIG4 ), it is enabled according to the interface number in the scene configuration information. The enabling method can be selected on the client or the server, on the interactive module of the networked device, or by the data packet sent by the target device. For networked devices with more than two interfaces, scene information can be flexibly enabled on multiple interfaces, and the interfaces can share and collaborate on data sources.
[0353] The interfaces of networked devices can correspond to the following scenarios:
[0354] 1. Multiple scenes or scene device types can be the same. For example, interfaces of the same scene device type (such as a scene where the device type of a mass storage device is multiple USB flash drives) can be connected to different target devices.
[0355] 2. Multiple scenarios or scenario device types use the same scenario device type and data source (for example, in a scenario where a networked device of the mass storage device type has multiple USB flash drives, multiple USB flash drives share the same data source). They can be connected to different target devices to achieve data sharing and collaborative operations.
[0356] 3. Multiple scenes or scene device types are different scene device types. For example, if interface 1 is a scene device type in slave mode (such as USB flash drive mode), interface 1 can be connected to target device 1 in USB flash drive mode (target device 1 is a computer host). If interface 2 is a scene device type in host mode (such as a networked device with an instruction set for reading a large-capacity storage device type and can read target device 2), it can be connected to target device 2 (target device 2 is in USB flash drive mode).
[0357] 4. There is only one scenario, but the scenario consists of multiple interfaces, and the data between the interfaces are coordinated and collaborated. For example, interface 1 of the networked device (host mode + slave mode scenario) is in host mode, and the target device to be connected is a slave device (such as a USB flash drive). Interface 2 is in slave mode, and the target device to be connected is a host device (computer host). Furthermore, the data sent by the host device (computer host) through interface 2 is forwarded by the networked device to the slave device (such as a USB flash drive) through interface 1. The data responded by the slave device (such as a USB flash drive) is sent by interface 1 and then forwarded by the networked device to the host device through interface 2. Device (computer host), since the data of the computer host and the USB flash drive are controlled by the networked device, the networked device is used as an intermediate control device scenario, and the networked device, server or client can control the data interaction instructions between the computer host and the USB flash drive; for example, in the peer-to-peer communication mode, interface 1 of the networked device is the sending end (TX), and interface 1 is connected to the receiving end (RX) of the target device; interface 2 of the networked device is the receiving end (RX), and interface 2 is connected to the sending end (TX) of the target device, and interface 1 of the networked device sends data to the target device, and interface 2 receives the data sent by the target device.
[0358] 5. There is only one scenario, but the scenario is composed of multiple networked devices, and the data between the multiple networked devices are divided, coordinated, and collaborated. For example, taking Figure 5A as an example, the user selects scenario A. Scenario A sets interface 1 and physical communication interface 2 of networked device A and interface 1 and interface 2 of networked device B respectively, realizing division of labor, coordination, and collaboration among the two networked devices and four interfaces.
[0359] 6. Division of labor, coordination and collaboration among multiple scenarios. As shown in FIG5B , data sharing, division of labor, coordination and collaboration are carried out among multiple networked devices and multiple target devices under the control of multiple scenarios.
[0360] Step 103: establishing a communication connection between the networked device and the target device based on the loaded scenario configuration information, so that the networked device can access the target device.
[0361] In one embodiment of the present application, the networked device establishes a handshake connection with the target device through an interface based on scenario configuration information. When the networked device is in host mode, it is used to identify the type of the connected target device (in this case, the target device is a slave device) so as to load the target device's driver (such as an instruction set) and further operate the target device. When the networked device is in slave mode, it responds to the target device with data such as a descriptor based on the instructions sent by the target device, which is used for the target device to load the networked device's driver and further operate the networked device.
[0362] In this step, the target device can be a computer device acting as a host, such as a laptop computer, desktop computer, embedded host, industrial control equipment, vehicle-mounted equipment, mobile terminal, physical server, etc.; it can also be an electronic device acting as a slave, such as a USB flash drive, mobile hard drive, hard disk, flash memory device reader, SD card, TF card, external optical drive, etc. When the target device acts as a host, the networked device acts as a slave to communicate with the target device; when the target device acts as a slave, the networked device acts as a host to communicate with the target device.
[0363] Optionally, when the preloaded target configuration information includes scenario configuration information under all application scenarios, based on the current application scenario selected by the user on the networked device, the target scenario configuration information corresponding to the current application scenario is determined from multiple scenario configuration information; based on the target scenario configuration information, the device function of the networked device is defined, and a communication connection is established with the target device.
[0364] Optionally, when the preloaded target configuration information only includes scenario configuration information under the current application scenario, the device function of the networked device is defined based on the scenario configuration information, and a communication connection is established with the target device.
[0365] Optionally, the communication establishment method between the networked device and the target device can be implemented based on a handshake communication method. Among them, when the target device acts as a host and the networked device acts as a slave, the target device sends a handshake request to the networked device, and the networked device responds to the handshake request and returns the communication parameters in the target scene configuration information (such as descriptors such as device descriptors) to the target device to reach a handshake agreement, thereby establishing a communication connection. When the target device acts as a slave and the networked device acts as a host, the handshake request is initiated by the networked device. Optionally, in the process of reaching a handshake agreement, the communication parameters can be verified by enumeration.
[0366] It should be noted that this embodiment defines the device type of the networked device so that the networked device can be used as a host device or a slave device, which can be applicable to more application scenarios, thereby realizing the application expansion of the networked device. The communication data does not need to pass through the computer host, effectively avoiding the leakage of the real data source and network communication data by the computer host through packet capture, and effectively avoiding being cracked by malicious programs on the computer host, thereby ensuring the device security and data security of the networked device; and when the networked device is sold or lost, the communication relationship with the networked device can be authorized or terminated through the server, thereby further ensuring the data source security of the networked device.
[0367] It's important to note that the handshake process between a connected device and a target device is essentially a data exchange. Depending on the device's mode (e.g., host mode, slave mode, or peer-to-peer communication mode), the handshake method differs.
[0368] In one embodiment of the present application, if the device role of the networked device is selected as the host mode (i.e., as a host communicating with the target device), the functional instruction set in the descriptor instruction set for host enumeration is configured, such as the acquisition instruction set, verification instruction set, setting instruction set, interaction instruction set, data source instruction set, and custom instruction set, and the data source configuration information is configured to bind the data source in the process of data exchange between the networked device and the target device. The data source includes but is not limited to storage media, storage space address range (such as sector address range), mirror storage file, specific folder, database and data stream, etc. If the device role of the networked device is selected as the slave role (i.e., as a slave communicating with the target device), the descriptor parameters, device type parameters and data source configuration information used to reply to the host are configured.
[0369] In some embodiments, based on the embodiment shown in FIG1 , step S102 includes:
[0370] When communicating with the server, sending a configuration acquisition request to the server, the configuration acquisition request carrying the identification information of the networked device;
[0371] Receive target configuration information corresponding to the identification information returned by the server.
[0372] In one embodiment of the present application, since the server may be connected to multiple networked devices at the same time, the correspondence between the identification information of the networked devices and the target configuration information ensures that the networked devices accurately obtain the target configuration information.
[0373] In one embodiment of the present application, the identification information is identification information representing the networked device, such as the device number of the networked device, the user name (or user number, user session ID) of the user to which the networked device belongs, etc. Optionally, a correspondence between the identification information and the target configuration information is pre-established. This correspondence can be fixed when the networked device leaves the factory or can be changed. It is understood that all configuration information of the networked device can be accessed by the user terminal to the server terminal so as to be configured on the user terminal page, and will not be further described below.
[0374] In one embodiment of the present application, the configuration acquisition request also carries the current application scenario parameters of the networked device, so as to accurately obtain the target scenario configuration information corresponding to the current application scenario parameters based on the identification information and the current application scenario parameters.
[0375] It should be noted that when establishing a communication connection between devices, the host device performs a timeout judgment (usually a millisecond or microsecond timeout judgment) according to the communication protocol (such as the handshake protocol or the control transmission protocol, etc.), so in order to ensure that the communication connection is established within the preset time, the functional instruction set and the descriptor set are preloaded into the networked device. It should be understood that during the data transmission between devices, the transmission protocol is a batch transmission protocol, an isochronous transmission protocol, or an interrupt transmission protocol, that is, it has a longer timeout judgment, so for data transmission during the device interaction process, there is no need to preload the relevant data. In addition, in some access scenarios with longer timeout judgments, the functional instruction set and the descriptor set can be obtained from the server in real time.
[0376] In some embodiments, the networked device serves as a host device that is communicatively connected to a target device, and the descriptor instruction set includes a plurality of functional instruction sets, which are used to control data exchange between the networked device and the target device.
[0377] Based on the embodiment shown in FIG1 , step S103 includes:
[0378] enumerate multiple descriptors in a second descriptor set of the target device based on a functional instruction set in the descriptor instruction set;
[0379] If the enumeration is successful, a target data source is configured when the networked device communicates with the target device, and the target data source is set on the target device.
[0380] If the enumeration is unsuccessful, the obtained descriptor set is submitted to the server. After identification by the server, the corresponding descriptor set or function instruction set is downloaded from the server and the enumeration is performed again.
[0381] In this embodiment, since the networked device needs to actively initiate a request when acting as a host, in order to realize the host function of the networked device, a developed driver (i.e., a functional instruction set) is pre-set and stored on the server side to protect the functional instruction set data security of the networked device and prevent the device functions or data from being maliciously used or leaked or reversely cracked after the networked device is lost.
[0382] In some embodiments, the enumeration process includes:
[0383] Based on the acquisition instruction set, read a second descriptor set of the target device;
[0384] Verifying the plurality of descriptors in the second descriptor set based on the verification instruction set;
[0385] If the plurality of descriptors meet the preset device requirements, the enumeration is determined to be successful.
[0386] In one embodiment of the present application, if the networked device is in host mode or a host role, after the networked device is started and a scene is selected, the first device access configuration information is read from the scene configuration information. The networked device sets the interface of the networked device (such as the first interface or the second interface) to host mode according to the first mode in the first device access configuration information; and according to the interface type, for example, sets the communication protocol of the interface to the USB communication protocol. When the target device (slave device) sends an electrical signal that can be enumerated (accessed), the networked device sends an enumeration request (a request to establish a handshake connection) to the target device.
[0387] The networked device sends at least one data interaction instruction (for example, sending a standard request to the default endpoint 0 of the target device) to the target device through the set (or default) interface and in accordance with the communication protocol of the interface (such as the USB communication protocol) based on the standard instruction set (such as the instruction set for obtaining descriptor data), special instruction set (such as the instruction set for obtaining device type), and setting instruction set in the access configuration information of the first device, and receives the data returned by the target device. When the returned data meets the access success condition specified by the first access status judgment rule, the networked device determines that the handshake connection is successfully established, and sends a connection success data packet to the server according to the first status response rule; when the returned data meets the access failure condition specified by the first access status judgment rule, the networked device determines that the handshake connection is unsuccessful, sends a connection failure data packet to the server according to the first status response rule, and requests new instruction set data from the server to reconnect to the target device.
[0388] The device access method in this embodiment is described below using a scenario where a networked device reads and writes a USB flash drive as an example. Step S101 includes: configuring first device access configuration information. Specifically, the first mode is configured as the host mode, the first interface type is configured as the USB interface, one or more of the following standard instruction sets are configured: obtain hardware descriptors; obtain configuration descriptors; obtain interface descriptors; obtain endpoint descriptors; obtain string descriptors, one or more of the following special instruction sets are configured: obtain the total number of formattable logical blocks; obtain the last logical block address, one or more of the following setting instruction sets are configured: set device address; set device configuration (set enable configuration); set Bulk-Only Mass Storage Rese instructions, and the first access status judgment rule is configured as follows: determine whether the returned interface descriptor, endpoint descriptor data, capacity information and other parameters meet the parameters of the large-capacity device type; if they do not meet the parameters of the large-capacity device type, determine that the access failed; if they meet the parameters of the large-capacity device type, determine that the access is successful, and set the first status response rule as follows: if the access fails, use the "second descriptor set to re-access (enumeration); if the access still fails, send an access failure status data packet to the server; if the access is successful, send an access success status data packet to the server.
[0389] The step S102 includes: preloading the first device access configuration information.
[0390] Step S103 includes: when the network device interface detects that a device has been connected, accessing the USB flash drive according to the first device access configuration information. Specifically, according to the first mode in the first device access configuration information, the interface of the network device is set to host mode; according to the first interface type, the communication protocol of the interface is set to the USB communication protocol, and according to "Set Device Address", the communication address of the USB flash drive is set; according to at least one instruction of "Get Hardware Descriptor", "Get Configuration Descriptor", "Get Interface Descriptor", "Get Endpoint Descriptor", and "Get String Descriptor", the descriptor of the USB flash drive is obtained according to at least one instruction of "Get Total Formattable Logical Blocks" and "Get Last Logical Block Address", the capacity information of the USB flash drive is obtained according to at least one instruction of "Get Total Formattable Logical Blocks" and "Get Last Logical Block Address", the configuration of the USB flash drive (such as the endpoint of the USB flash drive startup response) is activated according to the "Set Device Configuration" instruction, and the mass storage function of the USB flash drive is activated according to the "Bulk-Only Mass Storage Reset" instruction. Based on the descriptor of the USB flash drive, at least one of the capacity information of the USB flash drive, the endpoint information of the USB flash drive, and the mass storage function of the USB flash drive, the success status and / or failure status of the USB flash drive access is determined according to the first access status judgment rule. If the first status response rule determines that the USB flash drive access has failed, use the second descriptor set to re-access or reselect the preset alternative scene and re-access, such as accessing the camera scene. If the access still fails, send an access failure status data packet to the server; if the access is successful, send a successful access status data packet to the server.
[0391] It should be noted that, in the actual implementation process, the various steps in the above-mentioned process of accessing the USB flash drive according to the first device access configuration information are not one-to-one corresponding, or not all of them are required.
[0392] In this optional embodiment, the descriptor set includes, but is not limited to, device descriptors, configuration descriptors, interface descriptors, endpoint descriptors, string descriptors, BOS descriptors, and preset custom descriptors. The preset device requirements are protocol requirements in the communication protocol. For example, Table 1 below shows an example of descriptors obtained through descriptor instructions and settings through setting instructions when the networked device acts as a host device. It should be understood that the descriptor acquisition instructions and setting instructions shown in Table 1 below are only examples. In other embodiments, more or fewer descriptors may be included, which will not be repeated here.
[0393] Illustratively, the following Table 1 shows the descriptor commands sent when the networking device acts as a host device or in host mode.
[0394] Table 1
[0395] Exemplarily, based on the descriptor instruction set, the networked device reads the following information in the device descriptor, configuration descriptor, and string descriptor: 1. Manufacturer, identification information, and strings, etc.; 2. The class used by the interface, such as the mass storage class; 3. Transmission endpoints, such as endpoint 1 for IN and endpoint 2 for OUT; 4. Endpoint transmission mode, such as bulk transmission mode. Based on the verification instruction set, verify whether the class, endpoint, and endpoint transmission mode used by the interface meet the application scenario requirements of the networked device. If they meet, the enumeration is determined to be successful (or the handshake connection is established successfully). If not, the enumeration is determined to have failed (or the handshake connection has failed to be established), and the connection failure information is returned to the server.
[0396] Optionally, the functional instruction set also includes a setup instruction set for sending setup instructions to a target device. For example, a networked device may send a setup instruction to a slave device, requesting the slave device to enable at least one of the following: enable a corresponding endpoint, set a bus address, or enable configuration. It should be noted that when acting as a host device, the networked device supports connecting to multiple slave devices and enumerating multiple slave devices.
[0397] It should be noted that this embodiment uses the networked device as a host device to communicate with the target device. For unknown access devices (target devices), it can obtain descriptors and other data sent by the target device and submit them to the server for identification, so as to download the corresponding descriptor set or function instruction set from the server, or automatically select other alternative scenarios, thereby fully expanding the networked device's access capabilities to deal with different types of target devices.
[0398] In some embodiments, the process of configuring the target data source includes:
[0399] Based on the data source instruction set and according to the data source configuration information, a target data source of the networked device is determined.
[0400] In this optional embodiment, based on the application scenario of the networked device, the data source instruction set of the networked device is configured to operate the data source of the target device. For example, in the application scenario where the networked device is connected to a large-capacity storage device, the corresponding data source instruction set of the networked device is configured to operate the data storage space of the target device. For another example, in the application scenario where the networked device is connected to a keyboard device, the corresponding data source instruction set of the networked device is configured to read the key values input by the keyboard. The interactive data of the above operations on the data source of the target device can be synchronized to the server in real time, or can be filtered (or converted) by a preset script or set rules and then synchronized to the server.
[0401] Optionally, for an application scenario in which a networked device is connected to a large-capacity storage device, the data source configuration information includes but is not limited to capacity information of the data source, the capacity information including the last logical block address of the data source, (last logical block address + 1) × block capacity = capacity information; the total number of formattable logical blocks and the block capacity (total number of formattable logical blocks) × block capacity = capacity information; the data source configuration information also includes the maximum number of logical units, where the maximum number of logical units represents the number of partitions; the maximum number of logical units; and read-write status (such as read-only status, write-only status, readable and writable status), etc.
[0402] For example, in host mode, take the scenario of reading a slave device (such as reading a USB flash drive) as an example: before or after the device is powered on, the networked device is set to network read-write control device mode on the server or the local device. Specifically, the networked device is powered on, a USB flash drive is inserted, and the interface of the networked device detects that a target device is connected, and enumeration is performed through a preset descriptor instruction. If the enumeration is successful, the device type is obtained, and a successful enumeration message (including the device type) is sent to the server to establish a communication connection; if the enumeration fails, the descriptor information that the networked device can read is sent to the server, and the server is requested to send a new function instruction set (obtain a descriptor instruction set or a data exchange instruction set, etc.) or new scene information, and re-enumerate after receiving the new descriptor instruction or scene information. The server loads the corresponding driver or operating software according to the device type. The driver or operating software sends relevant instructions (data source instruction set) to the networked device through the server, and performs calculations to obtain the maximum number of logical units, total space capacity, read and write status, available space capacity, related strings, vendor ID (Vendor ID), device ID (Product ID), etc. of the target device (such as a USB flash drive) to complete enumeration and operation preparation. The server or client performs read and write operations through software. Users can operate (target devices such as USB flash drives) through server software or client APP, web browser and other applications. For example, the user writes files from the client to the USB flash drive, or reads files from the USB flash drive and saves them to the client, or reads data from a specified sector location on the USB flash drive, or writes data to a specified sector location on the USB flash drive.
[0403] It should be noted that, for the scenario where the data of storage device A needs to be copied to storage device B (or the data of the server is downloaded to storage device A or B, or the data of storage device A or B is uploaded to the server), the current technology requires that storage device A and storage device B be connected to a computer for data copying (or application software must be installed in the computer device to connect to the server for operation), resulting in data leakage due to packet capture by the computer device during the data copying process. However, this embodiment uses the networked device as a host device to communicate with the target device, which can well solve the above scenario problems. Since this embodiment does not require the use of a computer device (with an operating system), it prevents data from being stolen by malicious programs during the copying process; uploaded data is directly stored on the server to prevent data loss or leakage due to device loss; the networked device is directly connected to the server, so that network traffic data does not need to pass through the computer device and the target device, thereby reducing the possibility of being captured by network data and ensuring data security.
[0404] In some embodiments, the networked device is a network read / write control device scenario, and establishing a communication connection with the target device based on the target scenario descriptor information includes:
[0405] enumerate multiple descriptors in a second descriptor set of the target device based on a functional instruction set in the descriptor instruction set;
[0406] If the enumeration is successful, a request is made to the server to issue a driver instruction set corresponding to the target device to complete the communication connection. The driver instruction set is used to exchange data with the target device.
[0407] In this embodiment, the driver instruction set is a driver instruction set developed for different devices, including but not limited to an interactive instruction set and a custom instruction set. For the enumeration process of obtaining descriptors, please refer to the relevant description when the networked device acts as a host device, which will not be repeated here.
[0408] This embodiment requests the server to issue a driver instruction set corresponding to the target device, so as to identify the device type of the target device according to the second descriptor set of the target device, thereby being able to load the corresponding driver instruction set from the server for the device type of different target devices, so as to be used for data exchange between the networked device and the target device, thereby realizing access and data exchange of multiple device types.
[0409] It should be noted that, for a network read / write control device, it may be configured with a target data source or not according to actual application requirements.
[0410] In some embodiments, the networked device is a network proxy control device scenario, and step S103 includes:
[0411] enumerate multiple descriptors in a second descriptor set of the target device based on a functional instruction set in the descriptor instruction set;
[0412] If the enumeration is successful, the second descriptor set is sent to the server, so that the target device is virtualized at the server, and a virtual device corresponding to the target device is generated, thereby establishing a communication connection with the target device.
[0413] In this embodiment, the descriptor enumeration process is described in detail for the case where the networked device acts as a host device, and will not be further elaborated here. Alternatively, the virtualization process can be performed internally on the server or by a computer front-end that controls the server. It should be noted that the network proxy control device can be configured with or without a target data source, depending on actual application requirements.
[0414] As an example and not a limitation, the following provides several application scenarios when the networked device acts as a host device:
[0415] 1. Use the networked device as a remote controller. A custom driver is used to enable direct server-side control of the program, without virtualizing the USB device (though it should be understood that USB devices can also be virtualized). This is achieved by developing a custom driver for control, i.e., developing your own driver instead of using the operating system's built-in drivers.
[0416] For example, a network read-write control device set as a host role (protocol conversion can be performed according to customized interactive instructions and scripts) reads and writes handshake protocol data (such as descriptor sets, etc.) of interface devices such as USB interfaces, HDMI interfaces, SCSI interfaces, IEEE1394 interfaces, SATA interfaces, eMMC interfaces, SDIO interfaces, M.2 interfaces, and serial communication interfaces, so as to enumerate the target devices based on the above enumeration process, thereby establishing a communication connection between the network read-write control device and the storage device. Based on the driver instruction set for read and write operations installed on the server side, the user side controls the server side or sends interactive instructions to the network read-write control device in the form of preset instructions on the server side. The network read-write control device converts the interactive instructions and sends them to the storage device to write the server side data to the storage device or upload the storage device data to the server side.
[0417] Similarly, network read and write control devices can also establish communication connections with sensor devices such as cameras and microphones, and read the data collected by the sensor devices and upload them to the server, or control the camera to adjust the direction and angle, or control the microphone to adjust the power, etc. according to the control instructions issued by the server (that is, the instructions in the custom instruction set).
[0418] 2. The networked device acts as a network proxy control device. By combining the networked device as a proxy device with the native driver, the target device is virtualized as a local USB device through software (such as registering the obtained descriptor and other information in the USB bus), so that the server or the computer front end controlling the server thinks that the target device is a local USB device, so that the target device can be normally identified and used without secondary driver development. Optionally, if the host device is connected to multiple target devices at the same time, it supports network mapping of all target devices to the computer front end or server, so that the target device can be virtualized as a local USB device on the computer front end or server.
[0419] It should be noted that the existing data implementation is USB device - computer host 1 - network sharing - computer host 2 - virtual USB device. This has the following problems: 1. Data must pass through computer host 1, which poses unknown risks; 2. Data passing through computer host 1 is easily captured, leading to the discovery of the data source address and data interaction logic, posing a security risk; 3. Computer host 1 is generally a PC or personal laptop, requiring an operating system and software to be installed; 4. This data is implemented purely in software. However, the network proxy control device of the present application can be a standalone hardware device, eliminating the need for a computer host, thus reducing security risks.
[0420] For example, the networked device uses the USB interface as the host interface and reads the basic descriptor set from the connected printer (target device) to enumerate the target device based on the above enumeration process. When the enumeration is successful, the networked device sends the printer's descriptor set to the server. The server generates a virtual USB device on the local computer using a virtual bus or other means. The native driver of the printer (i.e., the functional instruction set) remotely controls the mapped printer to print by operating the virtual USB device. That is, the communication relationship is: server (printer driver - virtual USB device) - networked USB device (host device) - printer. In other embodiments, the server can also be controlled through the computer front end to visualize the server's virtualization process, as well as the printer's data to be printed and printing progress, etc. on the computer front end, which will not be repeated here.
[0421] It is understandable that after the networked device is plugged into the printer on site, the remote server connected to the networked device uses the native printer driver to directly identify the printer to control the printer to print, thereby avoiding important files being copied to computers with unknown risks and causing data leakage.
[0422] It is understandable that the above application scenarios are only used as examples and not limitations. In other scenarios, it may be a combination of multiple application scenarios, such as developing and implementing in the manner of scenario 1 and scenario 2 at the same time, which will not be repeated here.
[0423] In some embodiments, based on the embodiment shown in FIG. 1 , the networked device acts as a slave device that is communicatively connected to the target device, and step S103 includes:
[0424] receiving an enumeration request sent by the target device;
[0425] In response to the enumeration request, the first descriptor set is returned to the target device so that the target device enumerates the first descriptor set, and after the enumeration is successful, the target data source when the networked device communicates with the target device is configured according to the data source configuration information, and the target data source is set on the server.
[0426] In this embodiment, similar to the communication connection process when the networked device acts as a master device, when the networked device in this embodiment acts as a slave device, the target device acts as the initiator of the enumeration request, and the networked device acts as the responder of the enumeration request. The target device performs the same enumeration actions as when the networked device acts as a master device, and the networked device responds to the enumeration actions of the target device. When the networked device acts as a slave device, it supports connecting to multiple master devices and responding to enumeration requests from multiple master devices. The specific enumeration process can be found in the embodiment when the networked device acts as a master device and will not be repeated here.
[0427] In one embodiment of the present application, if the networked device is in slave mode, after selecting a scenario, it reads the second device access configuration information from the scenario configuration information. Based on the first mode in the second device access configuration information, the networked device sets its interface (e.g., the first interface or the second interface) to slave mode and, depending on the interface type, sets the interface's communication protocol to the USB communication protocol. When the target device (host device) connects, it responds and sends an electrical signal indicating enumeration (access).
[0428] The networked device receives data interaction instructions sent by the target device (for example, the target device sends a standard request to endpoint 0 of the networked device) through a set (or default) interface. When the data interaction instruction meets the corresponding data of at least one of the standard data set (such as obtaining a descriptor data set), special data set (such as a device type data set), execution setting instruction set, second access status judgment rule, and second status response rule in the second device access configuration information, or meets the matching rule, the networked device returns data to the target device; when the data exchange instruction includes the data content in the execution setting instruction set, the networked device performs the preset operation. When the data sent by the networked device meets the access success condition specified by the second access status judgment rule, the networked device determines that the handshake connection is successfully established, and sends a connection success data packet to the server according to the first status response rule; when the data returned by the target device meets the access failure condition specified by the first access status judgment rule, the networked device determines that the handshake connection is unsuccessful, sends a connection failure data packet to the server according to the first status response rule, and requests new descriptor data from the server to reconnect to the target device.
[0429] The device access method in this embodiment is described below using a USB flash drive as an example.
[0430] The step S101 includes: configuring the second device access configuration information. Specifically, configuring the second mode to be a slave mode, configuring the second interface type to be a USB interface, configuring one or more of the following standard data sets: a first hardware descriptor, a second hardware descriptor, a first descriptor, a second descriptor, a first interface descriptor, a second interface descriptor, a first endpoint descriptor, a second endpoint descriptor, a first string descriptor, a second string descriptor, configuring one or more of the following special data sets: the total number of formattable logical blocks, the last logical block address, the maximum number of logical units, the read / write status, etc., configuring one or more of the following execution setting instructions: executing setting device address, executing setting device configuration, executing Bulk-Only Mass Storage Reset instruction, configure the second access status judgment rule as follows: judge whether the instructions sent by the networked device, such as the obtain first hardware descriptor instruction, the obtain first configuration descriptor instruction, the obtain first interface descriptor instruction, the obtain first endpoint descriptor instruction, the obtain first string descriptor instruction, the obtain total number of formattable logical blocks instruction, the obtain last logical block address instruction, and the obtain read / write status instruction, meet the parameters for reading the mass storage device type; if they do not meet the parameters of the mass storage device type, determine that the access has failed; if they meet the parameters of the mass storage device type, determine that the access is successful; set the second status response rule as follows: if the access fails, use the second hardware descriptor, the second configuration descriptor, the second interface descriptor, the second endpoint descriptor, and the second string descriptor in the descriptor set to re-access (enumerate); if the access still fails, send an access failure status data packet to the server; if the access is successful, send an access success status data packet to the server.
[0431] The step S102 includes: preloading the second device access configuration information.
[0432] The step S103 includes: connecting the networked device (U disk scenario) to the target device according to the second device access configuration information. Specifically, an enumerable electrical signal is sent to the target device through the interface, and when the target device responds to the enumerated electrical signal and returns a data interaction instruction, the interface of the networked device is set to slave mode according to the second mode in the second device access configuration information; according to the second interface type, the communication protocol of the interface is set to the USB communication protocol, and according to the execution of setting the device address, the USB communication address of the networked device is set; responding according to at least one of the instructions of obtaining the first hardware descriptor instruction, obtaining the first configuration descriptor instruction, obtaining the first interface descriptor instruction, obtaining the first endpoint descriptor instruction, and obtaining the first string descriptor instruction; enabling the endpoint and function corresponding to the interface of the networked device according to the execution of the setting device configuration instruction; and executing the Bulk-Only Mass Storage The reset instruction performs a self-test of the mass storage device type function and returns an execution status packet; according to the second access status judgment rule, it is judged whether the instructions such as the obtain first hardware descriptor instruction, the obtain first configuration descriptor instruction, the obtain first interface descriptor instruction, the obtain first endpoint descriptor instruction, the obtain first string descriptor instruction, the obtain total number of formattable logical blocks instruction, the obtain last logical block address instruction, and the obtain read / write status instruction comply with the instructions of the mass storage device type; if they do not comply with the instructions for obtaining the mass storage device type, it is determined that the access has failed; if they comply with the parameters of the mass storage device type, it is determined that the access is successful; if the access fails, the second hardware descriptor, the second configuration descriptor, the second interface descriptor, the second endpoint descriptor, and the second string descriptor in the descriptor set are used to re-access; if the access fails, an access failure status data packet is sent to the server, or an alternative scene is switched, such as a camera scene; if the access is successful, an access success status message is sent to the server.
[0433] For example, the following Table 2 shows the descriptors replied by the networked device when it acts as a slave device or in slave mode.
[0434] Table 2
[0435] In some embodiments, the target device includes at least one first target device and at least one second target device, the networked device serves as a host device communicatively connected to the first target device, and as a slave device communicatively connected to the second target device, and establishing a communication connection with the target device based on the target scene descriptor information includes:
[0436] enumerate multiple descriptors in a second descriptor set of the first target device based on a functional instruction set in the descriptor instruction set;
[0437] If the enumeration is successful, configuring a first target data source when the networked device communicates with the first target device to complete a communication connection with the first target device, wherein the first target data source is located at the first target device;
[0438] receiving an enumeration request sent by the second target device;
[0439] In response to the enumeration request, the first descriptor set is returned to the second target device so that the second target device enumerates the first descriptor set, and after the enumeration is successful, the second target data source is configured when the networked device communicates with the second target device according to the data source configuration information, and the second target data source is set at the server or the first target device.
[0440] In this embodiment, the descriptor enumeration process and the target data source configuration process are described in detail when the networked device acts as a host device or a slave device, and are not described in detail here. The networked device of this embodiment has at least two physical interfaces and acts as a "host device + slave device". The networked device obtains the second descriptor set of the first target device (slave) to complete the enumeration of the first target device; when the second target device (host) initiates an enumeration request, the networked device forwards the first descriptor set to the second target device to complete the enumeration in the second target device, thereby realizing multi-device interaction between the first target device, the networked device (and the server), and the second target device.
[0441] Optionally, the networked device may also directly forward the descriptor instruction sent by the second target device to the first target device, and directly forward the response data of the first target device to the second target device, so as to complete the enumeration.
[0442] Optionally, the server logs the data exchange between the first target device and the second target device for auditing of the first target device and the second target device; in the case of data exchange, the networked device or the server may also modify, replace, or perform other operations on the data to protect the data security of the first target device and the second target device.
[0443] As an example and not a limitation, the networked device acts as a network USB hub (e.g., a USBHUB). This embodiment can monitor the connected first target device and detect descriptor parameters and communication data. Specifically, when the first target device connects to the networked device, the server uploads the first target device's descriptor set (e.g., vendor ID, device ID, or device type (class, subclass, interface command set, endpoint transmission mode used)). The server determines that the first target device meets the requirements for vendor ID, device ID, or device type before allowing the first target device to exchange data with the networked device or the second target device.
[0444] Optionally, when the networked device functions as a slave device of a mass storage device, the data source configuration information includes, but is not limited to, data source capacity information. The capacity information includes the last logical block address and block capacity of the data source, where (last logical block address + 1) × block capacity = capacity information. The data source configuration information also includes the maximum number of logical units, where the maximum number of logical units represents the number of partitions. In another embodiment of the present application, the capacity information includes the total number of formattable logical blocks and block capacity of the data source, where (total number of formattable logical blocks) × block capacity = capacity information.
[0445] It should be noted that currently connected devices are single-function storage devices or external devices. When used as storage devices, they can only store data locally. Their storage capacity is limited by hardware, and their data storage space can be easily identified by computer devices, posing a risk of data theft. This embodiment, however, connects the networked device as a slave device to communicate with the target device. This allows for multiple functional configurations of a single device based on scenario switching, effectively resolving the risks of limited storage capacity and easily identified data storage space, thereby improving data source security.
[0446] As an example and not a limitation, several application scenarios when a networked device acts as a slave device are provided below.
[0447] 1. The networked device is used as a network USB flash drive or other storage medium. The networked device is set to a USB flash drive form (such as a mass storage device type, a bulk transfer endpoint, etc.), or an SD card form, a TF card form, or a hard disk form. The computer host obtains the descriptor set of the networked device and enumerates the descriptor set to establish a communication connection between the networked device and the computer host. In one embodiment, the computer host sends a read instruction or a write instruction to the network, and the networked device sends the read instruction or the write instruction to the server, client, or control end. The following is only explained by the server as an example. The networked device establishes an association relationship with the computer host based on the image file established on the server, client, or control end (such as a disk image file of a partitioned .dd or an optical disc image file of a partitioned .ISO) to read or write the target data source of the networked device. In the data writing scenario, when the computer host writes the interactive data to the network USB flash drive, network SD card, network TF card, or network hard disk, the network USB flash drive, network SD card, network TF card, or network hard disk uploads the interactive data to the server, and the server writes the interactive data to the specified offset position of the image file. In the data reading scenario, the specified offset data of the image file is read out on the server and returned to the computer host.
[0448] It's important to note that image file data is stored sequentially in the storage space. For example, according to the file system's analysis, image file A.dd is allocated a sector range from 0x1000 to 0x1007. Furthermore, the size of the sector range from 0x1000 to 0x1007 in the image file is merely an example; the sector range of actual storage media is larger than this.
[0449] Taking the FAT32 file system as an example, the file information of the image file contains the first cluster address. The FAT32 file system can find all cluster addresses based on the first cluster address and FAT (file allocation table), and then convert them into all sector addresses. For example, the A.dd file is converted into the sectors 0x1000 to 0x1007 mentioned above. The specified offset represents the offset of the read and write instruction operation address corresponding to the image file. For example, using the above-mentioned image file A.dd as the data source, if the sector address read and write by the target device (i.e., the specified offset) is 0, then it is converted to the 0 sector address (first sector address) of the image file A.dd, i.e., 0x1000. If the sector address read and write by the target device is 1, then it is converted to the (0+1) sector address of the image file A.dd, and so on, thereby mapping the specified offset to a specific sector address. Different data sources correspond to different sector addresses. For example, image file A.dd stores sectors 0x1000 to 0x1007, while image file B.dd stores sectors 0x2000 to 0x2007. If the data source is switched from image file A.dd to image file B.dd, the read and write operation addresses only need to be converted to sectors 0x2000 to 0x2007. Since the sector addresses corresponding to the data sources are different, the data source is also changed, and the data source can be switched. Alternatively, the data sources can use different physical storage media to achieve direct physical isolation of different data sources.
[0450] Table 3
[0451] Refer to Table 3, taking the FAT32 file system as an example (file information of A.txt, and the same applies to mirror files): the starting cluster number is 0x1d, and the first sector (starting sector address) can be obtained according to the calculation of the file system; the corresponding cluster chain can be obtained in the FAT table, and the sector address set of the file content data can be obtained by calculation based on the cluster chain. The data of the sector address set is the content data of the A.txt file, such as the binary data of the string 123456. If it is a mirror file, it is the corresponding sector data.
[0452] It is understood that different data sources may also have different capacity information (including the last logical block address, total formattable block capacity, block capacity, total space capacity, available space capacity, and maximum number of logical units), read / write status (such as read-only, write-only, and both readable and writable), related character strings, vendor ID, and device ID. Therefore, even if the device type is the same across multiple scenarios (such as a USB flash drive being a mass storage device), switching between different data source configurations and data sources effectively modifies the device's functionality.
[0453] Furthermore, when interacting with a host computer, networked devices can also manage storage space intervals (sector address intervals) directly rather than through files. For example, the sector interval 0x1000 to 0x1007 is allocated to a USB flash drive (e.g., the first USB flash drive), and the sector interval 0x2000 to 0x2007 is allocated to another USB flash drive (e.g., the second USB flash drive).
[0454] For U disk (USB interface), SD card (eMMC and other interfaces), TF card (eMMC and other interfaces) or hard disk (SATA, M.2 and other interfaces), the essence is just the data source (sector address) or capacity information (optional) is different. The networked device actually acts as a remote mapper of read and write instructions (that is, converting the data on the server side into a U disk with a USB interface, or an SD card or TF card with an eMMC or SDIO interface, or a hard disk with a SATA interface or an M.2 interface, etc.).
[0455] In one embodiment of the present application, the data source includes but is not limited to storage media, storage space address intervals (such as sector address intervals), mirror storage files, specific folders, databases and data streams. A specific file is a file pre-selected by the user that is allowed to be read and written by a computer device, and it can be displayed to the user on the computer device. Mapping a specific file to a target address refers to mapping the sector address of a specific file in a storage device to a target address. The mirror file can be connected to a computer host as a storage data source. The networked device is connected to the server via a wired or wireless communication method, and the server contains multiple mirror files. Optionally, in the case of distributed storage technology, optimized storage and CDN network acceleration, the mirror file can be database data, or a combination, patchwork and mapping of multiple files.
[0456] In one embodiment of the present application, a networked device connects to a server and sends an identification number to the server. The server associates the corresponding mirror file based on the identification number of the networked device. When the computer host sends a data interaction instruction, the server forwards the read and write requirements of the data interaction instruction (such as a read or write operation, the sector address where the operation starts, and the length of the operation sector) to the server. After receiving the read and write requirements sent by the networked device, the server returns the sector file data block address corresponding to the mirror file to achieve data space expansion of the networked device. In one embodiment of the present application, based on the identification number of the networked device, the target mirror file corresponding to the networked device is switched and controlled on the server to connect the target mirror file to the computer host. For example, based on the identification number of the networked device (or the identification number of the user (binding through account login)), three mirror files "partition 1.dd", "partition 2.dd" and "partition 3.dd" are bound to switch the data source connected to the computer host in the three mirror files.
[0457] In one embodiment of the present application, the target device is connected to the server, and the image file of "Partition 1.dd" stored in the server is connected to the computer host. The computer host sends a data interaction instruction in a single sector size of 512 bytes. If the data interaction instruction is used to read the data at the 0th sector address and write data to the 1st sector address, a request is sent to the server through the network device. The server converts the 0th sector to the first address of "Partition 1.dd" and converts the 1st sector to the 512th byte offset address of "Partition 1.dd". Based on the converted address, the server returns the data from 0 to the following 511 bytes of the first address of the image file "Partition 1.dd". Data is written to the 512th byte of "Partition 1.dd" as the offset address to the following 511 bytes, and the network device returns the result returned by the server to the computer host. The above-mentioned single sector size of 512 bytes is only an example and not a limitation of the embodiments of the present application. For example, the single sector size can also be 1024, 2048, 4096 bytes.
[0458] In one embodiment of the present application, the networked device can switch between different storage data sources at will without the need for the computer host to install software tools (such as through the USB read / write driver that comes with the operating system). The real address of the data source is invisible to the computer host, and the data source is stored in the cloud. When the networked device is lost, the data source can be remotely canceled, thereby improving the data security of the data storage device. At the same time, this embodiment directly reads and writes the specific offset address data of the file associated with the server (or the sector address data corresponding to the file), and forwards the data directly to the server or computer host in a forwarding manner, thereby not being limited by the storage space of the storage device itself, improving efficiency and expanding applicable scenarios.
[0459] The embodiment of the present application is different from the existing network USB flash drive. The related technology is to first download the file of the server to the network USB flash drive storage device, and then read the file of the file system of the storage device through the computer to download; or the computer first writes the file to the file system of the USB flash drive storage device, and then uploads it to the server through the network USB flash drive. In this case, the capacity of the network USB flash drive's own storage space is required. For example, a 16G network USB flash drive cannot transfer a 32G file, or a network USB flash drive with less than 4G of remaining space cannot transfer files larger than 4G. The present invention forwards data in a buffer (such as a single sector of 512 bytes as a buffer), and there is no file restriction problem. On the other hand, it is impossible to switch the data of the entire storage partition. In the present invention, based on the reading and writing of the sector address, partition 1.dd can be formatted as FAT32 file system, with files A.txt and B.txt; partition 2.dd can be formatted as ExFAT file system, with files C.txt and D.txt, and can be directly connected to the computer for display. The existing network USB flash drive can only select specific files for copying. In addition, the image files such as "partition 1.dd" mapped on the server side can be database data, or a combination, splicing, mapping, etc. of multiple files based on distributed storage technology, optimized storage and CDN network acceleration.
[0460] In one embodiment of the present application, if the networked device is an SD card or a TF card, the networked device can send or receive data packets via the Emmc interface or the SDIO interface and the corresponding communication protocol, such as sending read and write commands via the SDIO_CMD line and sending or receiving data packets via the SDIO_D line.
[0461] In one embodiment of the present application, if the networked device is a hard disk, the networked device can send or receive data packets through a SATA interface or an M.2 interface and a corresponding communication protocol.
[0462] 2. The networked device acts as a network USBkey device (such as a bank U shield, digital certificate, encryption dongle, etc.). Set the networked device to the USBkey form and connect it to the computer host. The network USBkey device includes: 1. PIN password (the password is input by the user or the data collected and converted by the sensor), 2. algorithm, 3. key. For the PIN password, the data input by the user or the data collected and converted by the sensor can be sent to the server through the network for PIN verification; for the algorithm, it can be remotely downloaded from the server through a script, that is, the algorithm can be updated or selected at any time; for the key, the key or the part that makes up the key (such as the encryption method of combining the local key and the server key) data can be stored on the server to improve security. Optionally, during the interaction between the networked device and the server, the server performs log recording and behavior analysis to block suspicious behavior and issue warnings in a timely manner to prevent the abuse of USBkey.
[0463] It should be noted that: 1. The USB key itself does not need to store important data, such as PINs, algorithms, and keys. During operation, important data is downloaded from the server to the USB key's memory and erased when the USB key loses power, improving security. 2. The server can log each time a user uses the USB key to prevent abuse. For example, virtualized USB device technology can share USB key data across multiple computers. 3. Lost USB keys can be remotely locked to prevent theft. 4. Satellite positioning modules such as GPS and Beidou can be installed to report the USB key's geographic location when requested to the server. The USB key is only allowed to be used when it meets the preset geographic location conditions. 5. The USB key's data source is stored on the server, and the network communication link does not need to pass through the host, ensuring the data security of the data source. 5. The USB key password can be remotely verified by the client or server at the time of use.
[0464] 3. Networking devices act as intermediary devices (e.g., storage devices with networking capabilities). The computer host sends read and write interaction instructions to the intermediary device, such as sending a read instruction to address 0, with a read data length of 512 bytes; a write instruction to address 1, with the written data being 0x1212... (512 bytes) and a write data length of 512 bytes. After receiving the instructions, the intermediary device calculates the address, the number of bytes in a single sector (e.g., 512 bytes), and the data length, and converts the sector address of the data interaction instruction operation into the address corresponding to the server data (or the server converts it according to preset rules based on the forwarded data interaction instruction), such as converting it into a read and write operation on the server's U.dd file data. For example, address 0 is converted into the sector 0 address of the server's U.dd file data, and address 1 is converted into the sector 1 address of the server's U.dd file data. After the conversion, the server's U.dd file data is operated on, such as returning the data at address 0 of the server's U.dd file data and writing data 0x1212... (512 bytes) to sector address 1 of the server's U.dd file data.
[0465] It is understandable that the above application scenarios are only used as examples and are not limiting. In other scenarios, other hardware forms may be used, such as input devices such as keyboards, etc., which will not be described in detail here.
[0466] Referring to FIG6 , there is shown a flow diagram of a device access method provided in one embodiment of the present application, in which the communication between the networked device and the slave device utilizes the USB communication protocol. The device access method in this embodiment is illustrated by a networked device (in host mode) reading slave device data (using a USB flash drive as an example) via a USB interface. It should be noted that this example and related data are non-limiting. For example, other target devices (slave devices) may be other device types, such as USB cameras, and will not be further described here.
[0467] The client creates (or stores) the "U disk read scene" configuration information through the server, or selects the existing "U disk read scene" configuration information. When the networked device requests the server, the server sends the "U disk read scene" configuration information to the networked device.
[0468] In another embodiment of the present application, the scene configuration information can also be created in the server. The networked device sends a configuration acquisition request to the server. The server obtains the scene configuration information of the USB flash drive reading scene from the server according to the configuration acquisition request, and sends the obtained scene configuration information of the USB flash drive reading scene to the networked device.
[0469] After the target device (i.e., a USB flash drive) is plugged into the interface of a networked device, the USB flash drive sends an enumeration request (e.g., an enumerable electrical signal) to the networked device. The networked device sends a Get Hardware Descriptor command to the USB flash drive and sends an IN token packet to a specific endpoint of the USB flash drive to query for data return. For example, the networked device sends a hardware descriptor command to endpoint 0 of the USB flash drive using a SETUP token packet.
[0470] It should be noted that, in the present embodiment, the networked device acts as a host and actively sends data interaction instructions to the slave (such as a USB flash drive), and the slave responds passively according to the data interaction instructions. For example, taking the USB communication rules as an example, the networked device sends a token packet (or token packet + data packet) to the endpoint of the slave, and the slave responds according to the token packet (or token packet + data packet) received by the endpoint (such as replying a data packet or status packet to the host). If the networked device acts as a slave, the networked device receives the token packet (or token packet + data packet) sent by the host and responds according to the received token packet (or token packet + data packet). The token packet includes but is not limited to at least one of the SETUP token packet, IN token packet, OUT token packet, PING token packet, and SOF token packet. The status packet includes but is not limited to at least one of the ACK, NAK, NYET, and STALL status packets. The handshake packet includes a token packet and a status packet.
[0471] Table 4 is a parameter table of the instruction format of the SETUP token packet, wherein 0x in this application represents a hexadecimal encoding value.
[0472] Table 4
[0473] Referring to Table 4, in one embodiment of the present application, the instruction format of the SETUP token packet includes an instruction first type field (SETUP), a first address field (ADDR), a first endpoint field (ENDP), a first data field (DATA), and a first status field (ACK or NAK). The first instruction type field records the SETUP instruction identifier to indicate that the first instruction type is a SETUP token packet, with 0x2D representing the identifier value. The first address field is used to record the address information of the recipient of the SETUP token packet (i.e., the USB flash drive). For example, the recorded USB bus address information of the USB flash drive is 0x25. The first endpoint field is used to record the endpoint information of the recipient of the SETUP token packet. For example, the recorded endpoint information of the USB flash drive is 0x00. The first data field (DATA) is used to record the data packet data of the SETUP token packet. For example, the data in the DTAT field is the Get Device Descriptor instruction. The first status field is used to record the status of the recipient of the SETUP token packet (i.e., the USB flash drive). The status field includes an ACK status packet and a NAK status packet, where the ACK status packet indicates the success status of the recipient and the NAK status packet indicates the failure status of the recipient.
[0474] Referring to Tables 5 and 6, in one embodiment of the present application, after receiving the ACK status packet sent by the USB flash drive in response to the SETUP token packet, the networked device continues to send IN token packets to the USB flash drive. Based on the IN token packets, the USB flash drive returns a hardware descriptor data packet of the USB flash drive to the networked device.
[0475] It should be noted that if the networked device sends an IN token packet to a specific endpoint of a slave device (USB flash drive) and then receives a NAK status packet (0x5A) from the USB flash drive, this indicates that the slave device (USB flash drive) cannot provide data, as shown in Table 5. The networked device repeatedly sends IN token packets to the USB flash drive (within the timeout period) until the USB flash drive returns the first ACK status packet, as shown in Table 6. This application will not elaborate further.
[0476] Table 5
[0477] Table 6
[0478] Referring to Table 6, in one embodiment of the present application, the instruction format of the IN token packet includes a second instruction type field (IN), a second address field (ADDR), a second endpoint field (ENDP), a second data field (DATA), and a second status field (ACK or NAK, etc.). The second instruction type field records the IN instruction identifier, which can take a value of 0x69 to indicate that the instruction type is an IN token packet. The second address field is used to record the address information of the recipient of the IN token packet, for example, the recorded USB bus address information of the USB flash drive is 0x25. The second endpoint field is used to record the endpoint information of the recipient of the IN token packet, for example, the recorded endpoint information of the USB flash drive is 0x00. The second data field is used to record the data returned by the recipient of the IN token packet (i.e., the USB flash drive), such as the data in the DTAT field is a device descriptor. The second status field is used to record the status of the recipient of the IN token packet. The second status field includes ACK status packets and NAK status packets, where the ACK status packet indicates the successful status of the recipient and the NAK status packet indicates the failed status of the recipient. In one embodiment of the present application, the hardware descriptor data of the target device (slave device, such as a USB flash drive, etc.) includes at least: indicating the descriptor length (such as 0x12); indicating the device descriptor (such as 0x01); indicating the USB protocol version used (such as 0x00 0x02); indicating the class code (such as 0x00); the subclass code (such as 0x00); indicating the protocol used by the device (such as 0x00); indicating the maximum packet length of endpoint 0 (such as 0x40); indicating the manufacturer ID (such as 0xff 0xff); indicating the product ID (such as 0x78 0x56); indicating the device version number (such as 0x00 0x02); indicating the manufacturer string index (such as 0x01); indicating the product string index (such as 0x02); indicating the product serial number string index (such as 0x03); indicating the configuration quantity (such as 0x01).
[0479] It should be noted that after receiving the hardware descriptor data sent by the target device (slave device, such as a USB flash drive, etc.), the networked device needs to send an OUT token packet to the target device according to the rules corresponding to the SETUP token packet (such as the rules for controlling transmission), and attach an empty data packet (see Table 7) to notify the target device (slave device) that the data has been successfully received. This application will not go into details.
[0480] Table 7
[0481] Referring to Table 7, the instruction format of the OUT token packet includes a third instruction type field (OUT), a third address field (ADDR), a third endpoint field (ENDP), a third data field (DATA0 or DATA1), and a third status field (ACK, NAK, or NETY). The third instruction type field records the OUT instruction identifier, which can take the value 0xE1 to indicate that the instruction type is an OUT token packet. The third address field is used to record the address information of the recipient of the OUT token packet, for example, the recorded USB bus address information of the USB flash drive is 0x25. The third endpoint field is used to record the endpoint information of the recipient of the OUT token packet, for example, the recorded endpoint information of the USB flash drive is 0x00. The third data field is used to record the data returned by the recipient of the OUT token packet, for example, the recorded data is empty. The third status field is used to record the status of the recipient of the OUT token packet. The third status field includes ACK status packets and NAK status packets, where the ACK status packet indicates the success status of the recipient and the NAK status packet indicates the failure status of the recipient.
[0482] Referring to Table 8, the networked device sends a device address setting instruction to the USB flash drive to assign an address to the slave device (such as a USB flash drive), and sends an IN token packet to a specific endpoint of the slave device (such as a USB flash drive) to query data return. For example, the networked device sends a device address setting instruction to endpoint 0 of the USB flash drive via a SETUP token packet. The USB flash drive returns the first ACK status packet of the USB flash drive to the networked device based on the device address setting instruction and the IN token packet. For example, the USB flash drive returns the first ACK status packet to the networked device via endpoint 0. For example, the networked device sends a SETUP token packet to endpoint 0 of the USB flash drive, and the data in the SETUP token packet (refer to the data in the DATA field in Table 9) is used to set the address. The networked device receives the first ACK status packet returned by the USB flash drive to indicate that the address of the USB flash drive has been successfully set.
[0483] Table 8
[0484] The connected device sends a Get String Descriptor command to the USB flash drive and sends an IN token packet to a specific endpoint on the USB flash drive to query for returned data. For example, the connected device sends a Get String Descriptor command to endpoint 0 of the USB flash drive using a SETUP token packet. The USB flash drive then returns the string descriptor data packet to the connected device based on the Get String Descriptor command and the IN token packet.
[0485] It should be noted that, for example data of handshake packets and data packets related to descriptor acquisition instructions, setting instructions, descriptors, token packets, status packets, etc., in addition to referring to the above tables, you can also refer to Table 1, Table 2 or other examples, etc., which will not be repeated in this application.
[0486] The connected device sends a Get Configuration Descriptor command to the USB flash drive and sends an IN token packet to a specific endpoint on the USB flash drive to query for data return. For example, the connected device sends a Get Configuration Descriptor command to the USB flash drive's endpoint 0 via a SETUP token packet. Based on the Get Configuration Descriptor command and the IN token packet, the USB flash drive returns a configuration descriptor data packet to the connected device. For example, the USB flash drive returns a configuration descriptor data packet to the connected device via endpoint 0 (generally, the configuration descriptor data packet includes a configuration descriptor, an interface descriptor, and an endpoint descriptor).
[0487] The networked device sends a setup configuration command to the USB flash drive to set its configuration information, and then sends an IN token packet to a specific endpoint on the USB flash drive to query for data return. For example, the networked device sends a setup configuration command to endpoint 0 of the USB flash drive using a SETUP token packet. Based on the setup configuration command and the IN token packet, the USB flash drive returns a second ACK status packet to the networked device.
[0488] The networked device determines whether the connection (or access) between the networked device and the target device is successful based on the descriptor data returned by the above-mentioned USB flash drive. If the networked device determines that the USB flash drive connection has failed based on the first state response rule and the descriptor data returned by the USB flash drive, it requests a new scene configuration or a new instruction set from the server to reconnect; if the connection is successful, it enters a special request and performs a special request and data exchange according to the information of the obtained descriptor. Furthermore, the networked device obtains the descriptor information of the USB flash drive by analyzing (such as the interface descriptor and the endpoint descriptor, etc.), obtains the specific endpoint number and transmission mode of the USB flash drive data transmission, and continues to send instructions to the USB flash drive. For example, according to the analysis of the obtained endpoint descriptor, endpoint 1 is the OUT endpoint, and the transmission mode of endpoint 1 is batch transmission. The endpoint 2 of the networked device is set to the IN endpoint, and the transmission mode is batch transmission. It should be noted that the endpoint number and endpoint function of each device are different, and are generally obtained through the endpoint descriptor. The above-mentioned endpoint 1 and endpoint 2 are examples and do not constitute a limitation on the target device.
[0489] It should be noted that the networked device (as a host) and the target device (as a slave) or the networked device (as a slave) and the target device (as a host) can determine whether the connection (or access, or handshake) is successful. This can be done in the handshake stage (such as obtaining descriptor instructions, setting configurations, etc.) or in the data exchange stage (such as reading and writing sector address instructions in accordance with presets, sending TEST detection instructions, etc.), and this application will not go into details.
[0490] The networked device sends a Get MAXLUN Descriptor command (a special instruction set) to the USB flash drive and sends an IN token packet to a specific endpoint on the USB flash drive to query for return data. For example, the networked device sends a Get MAXLUN Descriptor command to the USB flash drive's endpoint 0 using a SETUP token packet. Based on the Get MAXLUN Descriptor command and the IN token packet, the USB flash drive returns the USB flash drive's MAXLUN data packet to the networked device. Based on the IN token packet, the USB flash drive returns MAXLUN data, such as 0x00, to the networked device. For example, the USB flash drive returns MAXLUN data to the networked device via endpoint 0, where the MAXLUN data includes the maximum number of logical units.
[0491] The connected device sends an INquiry command to the USB flash drive and sends an IN token packet to a specific endpoint of the USB flash drive to query data for return. For example, the connected device sends an INquiry command to endpoint 1 of the USB flash drive using an OUT token packet and sends an IN token packet to endpoint 2. Based on the INquiry command and IN token packet, the USB flash drive returns the device information data packet to the connected device.
[0492] For example, based on a preset scenario configuration, a networked device sends a command (e.g., a SCSI or SATA command, such as a CBW packet) to endpoint 1 of a target device, requesting the target device's device information (INquiry) data. The target device responds to the INquiry request by returning a first data packet (the INquiry packet) and a status packet (e.g., a CSW packet for a SCSI or SATA command) to the networked device.
[0493] Referring to Table 9, a CBW packet includes the following information: CBW packet identifier, CBW packet sequence number, number of bytes transferred, transfer direction, logical unit of operation, command block length, operation instruction code, and operation instruction parameters. When the operation instruction code is 0x12, it indicates that the networked device (host mode) is sending an "INquiry" data request instruction to the target device (slave device).
[0494] Table 9
[0495] Referring to Table 10, the first data packet (INquiry data) includes the following information:
[0496] Table 10
[0497] Referring to Table 11, the CSW status includes: CSW identifier, sequence number of CBW packet, number of remaining bytes, and error code.
[0498] Table 11
[0499] It should be noted that the above description of the data structure of the CBW instruction packet and the CSW status packet is based on the SCSI communication protocol, and other relevant contents of this application will not be repeated here.
[0500] The networked device sends a Get Capacity Information (e.g., maximum number of logical units, total number of formattable logical blocks, last logical block address, block capacity, etc.) or Get Read / Write Status (MODESENCE6) command to the specific OUT endpoint of the USB drive, and sends an IN token packet to the specific IN endpoint of the USB drive to query data return. For example, the networked device sends a Get Capacity Information or Get Read / Write Status command to Endpoint 1 of the USB drive via an OUT token packet, and sends an IN token packet to Endpoint 2. The USB drive then returns the capacity information or read / write status data packet via Endpoint 2.
[0501] In one embodiment of the present application, a networked device sends a request to read the "total number of formattable logical blocks" (READ_FORMAT_CAPACITIES) to a specific OUT endpoint of a target device. For example, the networked device sends a CBW packet to the target device (e.g., a USB flash drive) containing the operation instruction code 0x23, requesting to obtain the "total number of formattable logical blocks" of the target device (e.g., a USB flash drive). In response to the request to read the "total number of formattable logical blocks," the target device (e.g., a USB flash drive) returns a first data packet (as shown in Table 12) and a CSW status packet to the networked device.
[0502] Referring to Table 12, the first data packet (total number of formattable logical blocks) includes the following information:
[0503] Table 12
[0504] In one embodiment of the present application, a networked device sends a request to read the "Last Logical Block Address" (READ_CAPACITY) of a specific OUT endpoint of a target device. For example, the networked device sends a CBW packet to a target device (e.g., a USB flash drive) with the operation instruction code 0x25, requesting to obtain the "Last Logical Block Address" data of the target device (e.g., a USB flash drive). In response to the request to read the "Last Logical Block Address," the target device (e.g., a USB flash drive) returns a first data packet (as shown in Table 13) and a CSW status packet to the networked device.
[0505] Referring to Table 13, the first data packet (last logical block address) includes the following information:
[0506] Table 13
[0507] It should be noted that the networked device (host mode) can calculate the capacity information through the "total number of formattable logical blocks" and the "last logical address block" separately, and does not need to obtain the data of both at the same time.
[0508] In one embodiment of the present application, a networked device sends a request to read the "read / write status" (MODESENCE6) of a specific OUT endpoint of a target device. For example, the networked device sends a CBW packet with the operation instruction code 0x2A to the target device (e.g., a USB flash drive) to request the "MODESENCE6" data of the target device (e.g., a USB flash drive). In response to the request to read "MODESENCE6," the target device (e.g., a USB flash drive) returns a first data packet (as shown in Table 14) and a CSW status packet to the networked device.
[0509] Referring to Table 14, the first data packet (MODESENCE6) includes the following information:
[0510] Table 14
[0511] The networked device determines whether the connection (or access) between the networked device and the target device is successful based on at least one of the MAXLUN data packet, the device information data packet, the capacity information data packet, and the read / write status (MODESENCE6) data packet returned by the USB flash drive. The networked device determines, based on the first status response rule, that the USB flash drive connection has failed, and requests a new instruction set from the server to reconnect; if the connection is successful, the networked device sends a connection success status data packet to the server, and the server sends the connection success status data packet to the client.
[0512] Referring to Figure 7, there is a flow chart of a device access method provided in another embodiment of the present application, wherein the communication between the networked device and the slave device adopts the USB communication protocol, and the networked device (slave mode) takes the USB flash drive scenario as an example to illustrate the device access method in this embodiment.
[0513] It should be noted that this example and related data are non-limiting, and other networked devices (slave devices, slave modes) can be other device types such as USB camera scenarios, etc., which will not be repeated here. In addition, the data content of the token packet, CBW packet, CSW packet, operation instruction, data packet, etc. related to this embodiment is similar to the above-mentioned networked device (host mode) reading USB flash drive embodiment, that is, the host and slave roles, instruction data and response data are exchanged, and the response configuration is performed in the scenario configuration, which will not be repeated in this embodiment.
[0514] The client creates the scene configuration information for the USB flash drive scenario, or selects the scene configuration information for an existing USB flash drive scenario. The networked device sends a configuration acquisition request to the server, where the configuration acquisition request includes the USB flash drive scenario. The server obtains the scene configuration information for the USB flash drive scenario from the client based on the configuration acquisition request and sends the obtained scene configuration information for the USB flash drive scenario to the networked device (i.e., the USB flash drive).
[0515] The networked device is set to slave mode according to the scenario configuration information, starts the default endpoint 0, and is set to control transmission.
[0516] After the interface of the networked device (such as a USB flash drive) is inserted into the target device (host device), an enumeration request (such as an enumerable electrical signal) is sent to the target device.
[0517] The target device sends a Get Hardware Descriptor command to a specific endpoint of the networked device, and also sends an IN token packet to the specific endpoint of the networked device to query for data return. For example, the target device sends a Hardware Descriptor command to Endpoint 0 of the networked device via a SETUP token packet. Based on the Get Hardware Descriptor command and the IN token packet, the networked device returns a hardware descriptor data packet of the USB flash drive to the specific endpoint of the target device. For example, the networked device returns a hardware descriptor data packet of the networked device (such as a USB flash drive) to the target device via Endpoint 0. The hardware descriptor data packet of the networked device (such as a USB flash drive) includes at least the device type and device function of the USB flash drive.
[0518] The target device sends a Set Device Address instruction to a specific endpoint of the networked device to assign an address to the networked device, and also sends an IN Token packet to the specific endpoint of the networked device to query data return. For example, the target device sends a Set Device Address instruction to Endpoint 0 of the networked device via a SETUP Token packet. The networked device performs the address setting operation according to the Set Device Address instruction and returns a third ACK status packet for the USB flash drive to the target device based on the IN Token packet. For example, the networked device returns a first ACK status packet to the target device via Endpoint 0. The first ACK status packet indicates whether the address of the networked device was successfully assigned.
[0519] The target device sends a Get String Descriptor command to a specific endpoint of the networked device, and also sends an IN token packet to a specific endpoint of the networked device to query for data return. For example, the target device sends a Get String Descriptor command to Endpoint 0 of the networked device via a SETUP token packet. The networked device returns the string descriptor data packet from the USB flash drive to the target device based on the Get String Descriptor command and the IN token packet. For example, the networked device returns the string descriptor data packet to the networked device via Endpoint 0.
[0520] The target device sends a Get Configuration Descriptor command to a specific endpoint of the networked device, and also sends an IN token packet to query data return. For example, the target device sends a Get Configuration Descriptor command to Endpoint 0 of the networked device via a SETUP token packet. Based on the Get Configuration Descriptor command and the IN token packet, the networked device returns the configuration descriptor data packet of the USB flash drive to the target device. For example, the networked device returns the configuration descriptor data packet to the target device via Endpoint 0.
[0521] The target device sends a setup configuration instruction to a specific endpoint of the networked device to set the configuration information of the networked device, and sends an IN token packet to a specific endpoint of the networked device to query data return. For example, the target device sends a setup configuration instruction to endpoint 0 of the networked device via a SETUP token packet. The networked device performs a setup operation according to the setup configuration instruction, for example, it starts the corresponding transmission endpoint according to the descriptor data selected by the setup instruction, and returns the second ACK status packet of the USB flash drive to the target device according to the IN token packet. For example, the networked device returns the second ACK status packet to the networked device via endpoint 0. The networked device enables configuration according to the above instructions or scenario configurations. For example, the networked device starts a specific endpoint (such as endpoint 1) as an OUT endpoint, and sets the transmission mode of OUT endpoint 1 to batch transmission; the networked device starts a specific endpoint (such as endpoint 2) as an IN endpoint, and sets the transmission mode of IN endpoint 2 to batch transmission.
[0522] The networked device determines whether the connection (or access) between the networked device and the target device is successful based on the command returned by the target device and the second state response rules. If the command sent by the target device does not meet the preset device requirements specified in the second state response rules, the networked device is determined to have failed to connect and requests a new descriptor set from the server to reconnect. If the command returned by the target device meets the preset device requirements specified in the second state response rules, the connection is determined to be successful and the special request data exchange process is entered.
[0523] During a special request data exchange, the target device sends a Get MAXLUN Descriptor command to a specific endpoint on the networked device, and also sends an IN token packet to query data return information. For example, the target device sends a Get MAXLUN Descriptor command to endpoint 0 of the networked device using a SETUP token packet. Based on the MAXLUN Descriptor command and IN token packet, the networked device returns the MAXLUN data packet of the networked device (such as a USB flash drive) to the target device.
[0524] The target device sends a Get Device Information Descriptor instruction to the networked device, and sends an IN token packet to a specific endpoint of the networked device to query data return. For example, the target device sends a Get Capacity Information Descriptor instruction to Endpoint 1 of the USB flash drive via an OUT token packet. Based on the Get Capacity Information Descriptor instruction and the IN token packet, the networked device returns the capacity information data packet of the USB flash drive via Endpoint 2. The target device sends a Get Capacity Information Descriptor instruction to a specific endpoint of the networked device, and sends an IN token packet to a specific endpoint of the networked device (such as Endpoint 2) to query data return. For example, the target device sends a Get Capacity Information instruction (to obtain the maximum number of logical units, the total number of formattable logical blocks, the last logical block address, the block capacity, etc.) or read / write status, etc. to Endpoint 1 of the USB flash drive via an OUT token packet. Based on the capacity information instruction and the IN token packet, the networked device returns the capacity information or read / write status data packet of the networked USB flash drive via Endpoint 2.
[0525] The target device sends a Get Read / Write Status (MODESENCE6) command to the networked device and sends an IN token packet to a specific endpoint of the networked device to query for data return. For example, the target device sends a Get MODESENCE6 command to endpoint 1 of the networked device using an OUT token packet. Based on the MODESENCE6 command and IN token packet, the networked device returns the MODESENCE6 data packet to the networked device (USB flash drive) through endpoint 2.
[0526] The networked device determines whether the connection (or access) between the networked device and the target device is successful based on the command sent by the target device and the second interface status rule. Based on the first status response rule, the networked device determines that the target device has failed to connect to the networked device (USB flash drive) and requests a new descriptor set from the server to reconnect. If the connection is successful, the networked device sends a connection success status data packet to the server, and the server sends the connection success status data packet to the client.
[0527] It should be noted that the descriptors, capacity information, read and write status and other data returned by the above-mentioned networked device as a slave to the target device (host device) are pre-set through the scene configuration (U disk scene).
[0528] In one embodiment of the present application, if the networked device is in peer-to-peer communication mode, after the networked device starts and selects a scene, the third device access configuration information is read from the scene configuration information.
[0529] After the networked device is started and the scene is selected, the third mode, third interface type, interactive data set, third state judgment rule and third state response rule in the field third device access configuration information are obtained; according to the third mode, the working mode of the networked device is set to the peer communication mode; according to the third interface type, the physical communication interface of the networked device is selected as two interfaces, namely the sending data interface and the data receiving interface, wherein the sending data interface of the networked device is connected to the data receiving interface of the target device, and the receiving data interface of the networked device is connected to the data sending interface of the target device.
[0530] The networked device sends data to the target device through the data transmission interface (TX) based on the rules of the interactive data set, and receives the data returned by the target device through the data receiving interface. The networked device receives data sent by the target device through the data receiving interface (RX) based on the rules of the interactive data set, and returns data to the target device through the data transmission interface.
[0531] When the data sent by the target device meets the preset access success conditions specified in the third access status judgment rule, the networked device determines that the handshake connection is successfully established; and sends a connection success data packet to the server according to the third status response rule; when the data returned by the target device meets the preset access failure conditions specified in the third access status judgment rule, the networked device determines that the handshake connection has failed; sends a connection failure data packet to the server according to the third status response rule, requests a new interactive data set and other data, and reconnects / or waits for the target device to connect.
[0532] 8 , which is a flow chart of a device access method provided in one embodiment of the present application. The method of the embodiment of the present application can be applied to a networked device, wherein the networked device stores scenario configuration information of at least one application scenario, and the networked device includes but is not limited to a single-chip microcomputer or embedded device with a network function, a vehicle-mounted device, a smart phone, a tablet computer or a laptop computer and other terminal devices, a network USB key device (such as a bank U shield digital certificate, a dongle, etc.), a network proxy control device (such as a multi-port forwarder), a remote controller (including but not limited to a network read and write control device, a network controller (such as a router and an intelligent gateway, etc.)), a communication device (Communication Device Class, CDC, such as a network card, a modem, an ISDN (Integrated Services Digital Network) terminal), a human interface device (Human Interface Device, HID, such as a keyboard or a mouse), a mass storage device (Mass Storage Device Class, MSC, such as a USB flash drive, a network USB flash drive, a card reader, a network card reader), a printer device (such as a printer with a USB interface), a still image acquisition device (Still Imaging device), a video device (Video device), an audio and video device (Audio / Video Devices), a smart card device, a USB hub device (Universal SerialBus Hub) and custom devices, etc.
[0533] As shown in FIG8 , the device access method of this embodiment includes:
[0534] Step S301, when communicating with the server, preload target configuration information, the server stores a plurality of preset configuration information, the target configuration information is one of the plurality of preset configuration information, the target configuration information includes the scene configuration information of the networked device in at least one application scenario, the scene configuration information includes at least one of a first descriptor set and a descriptor instruction set, the first descriptor set is used to define the device type of the networked device.
[0535] Step S302: establishing a communication connection with a target device based on target scenario configuration information so that the networked device can access the target device, wherein the target scenario configuration information is one of the scenario configuration information.
[0536] In one embodiment of the present application, the scenario configuration information is generated by the networked device after configuring at least one of the first descriptor set and the descriptor instruction set and the data source configuration information in accordance with a preset generation strategy, and the preset generation strategy includes at least one of a custom creation strategy, a template creation strategy or an external import creation strategy.
[0537] 9 is a flow chart of a device access method according to an embodiment of the present application. As shown in FIG9 , the device access method according to this embodiment includes:
[0538] Step S701: Based on the target scene configuration information, establish a communication connection with the target device so that the networked device can access the target device. The target scene configuration information is one of the scene configuration information, and the scene configuration information includes at least one of a first descriptor set and a descriptor instruction set. The first descriptor set is used to define the device type of the networked device.
[0539] In this embodiment, the device access process is similar to that of the embodiment shown in Figure 1. For explanation of the steps, please refer to the relevant description of the embodiment shown in Figure 1 and will not be repeated here. It should be noted that the target scenario configuration information of this embodiment is stored in the local storage space of the networked device without having to be obtained from the server, in order to further improve the efficiency of device access or limit the functional scope of the networked device.
[0540] Refer to Figure 10, which is a flow chart of a data exchange method provided in an embodiment of the present application. The method of the embodiment of the present application can be applied to a networked device, and the device access method of the networked device establishes a communication connection with the server and the target device. The networked device includes but is not limited to a single-chip microcomputer or embedded device with a network function, a terminal device such as a smart phone or a laptop computer, a network USB key device (such as a bank U shield, a digital certificate, a dongle, etc.), a network proxy control device (such as a multi-port forwarder, etc.), a remote controller (such as but not limited to a network read and write control device, a network controller (such as a router and an intelligent gateway, etc.)), a communication device (Communication Device Class, CDC, such as a network card, a modem, an ISDN (Integrated Services Digital Network) terminal), a human interface device (Human Interface Device, HID, such as a keyboard or a mouse), a mass storage device (Mass Storage Device Class, MSC, such as a USB flash drive, a network USB flash drive, a card reader, a network card reader), a printer device (Printer device, such as a printer with a USB interface), a still image acquisition device (Still Imaging device), a video device (Video device), an audio / video device (Audio / Video Devices), smart card devices, USB hub devices (Universal SerialBus Hub), and custom devices, etc.
[0541] As shown in FIG. 10 , the data exchange method of this embodiment includes steps S801 to S802 , which are described in detail below.
[0542] Step S801: Acquire a data exchange request sent by a first target party.
[0543] Step S802, based on the preset processing strategy, respond to the data exchange request and return the target data to the first target party, where the target data is the data sent by the second target party. If the first target party is the server, the second target party is the target device; if the first target party is the target device, the second target party is the server.
[0544] In one embodiment of the present application, a data exchange request is a request made by a networked device to exchange data with a target device, including a first exchange request initiated by the networked device and a second exchange request initiated by the target device. A preset processing policy is a policy for processing the data exchange request, including but not limited to a first policy based on local processing on the networked device and a second policy based on forwarding the data exchange request to a server.
[0545] In one embodiment of the present application, when the networked device acts as a host device, it supports access to multiple slave devices and supports data exchange with multiple slave devices; when the networked device acts as a slave device, it can also support connection to multiple host devices and support data exchange with multiple host devices. This embodiment connects the networked device, the server, and the target device through the device access method of the embodiment shown in Figures 1, 8, or 9, so that the networked device assumes different interaction roles and interaction processes in different data exchange scenarios, thereby enabling data exchange between the networked device in multiple application scenarios and improving the scenario applicability of the networked device.
[0546] In one embodiment of the present application, the networked device acts as a host mode and obtains the endpoint information of the target device (USB slave device) by obtaining descriptor instructions, such as endpoint 1 is IN and endpoint 2 is OUT. The networked device initiates a command query operation instruction request to the server through the network interface, and waits for the server to issue an interactive instruction. When an interactive instruction is found, the networked device downloads the interactive instruction set for the interactive operation. For example, it is necessary to send data A1 to the target device and receive the return data from the target device. The networked device sends the A1 data to endpoint 2 (OUT) of the target device, and sends an IN token packet to endpoint 1 (IN) to query the data return. When the networked device receives the DATA data packet A2 from endpoint 1, it uploads it to the server.
[0547] In one embodiment of the present application, the networked device acts as a slave mode, and according to the endpoint-related information in the scenario configuration (such as the interface descriptor, endpoint descriptor, etc.), enables the endpoint number, transmission direction, and transmission mode of the corresponding endpoint (such as endpoint 1 is an IN endpoint, batch transmission mode; endpoint 2 is an OUT endpoint, batch transmission mode, etc.), and waits for the computer host to send interactive command data to the above two ports. The networked device receives the A1 data sent by the computer host to endpoint 2 (OUT). The networked device uploads the A1 data to the server through the network interface. The server parses the A1 data and waits for the networked device to download the A2 data. The networked device downloads the A2 data through the network interface. When the computer host sends an IN token packet to endpoint 1 (IN) of the networked device, it returns a DATA data packet A2 to the computer host.
[0548] In one embodiment of the present application, a networked device has both a slave mode and a host mode. The target devices include at least one first target device and at least one second target device, and the networked device serves as a host device that is communicatively connected to the first target device, and as a slave device that is communicatively connected to the second target device. If the first target is the server, the second target is either the first target device or the second target device; if the first target is the second target, the second target is either the server or the first target device.
[0549] Specifically, the networking device, acting as a slave (e.g., interface 1), enables the first endpoint (e.g., endpoint 1) to IN and the second endpoint (e.g., endpoint 2) to OUT based on endpoint-related information in the scenario configuration (e.g., interface descriptors, endpoint descriptors, etc.), and waits for target device 1 (a computer host) to send interaction command data to these two ports via interface 1. Furthermore, acting as a host (e.g., interface 2), it sends a Get Descriptor command via interface 2 to obtain endpoint information for target device 2 (a USB device), e.g., endpoint 1 to IN and endpoint 2 to OUT. Interface 1 of the networking device receives data A1 sent by target device 1 to endpoint 2 (OUT) of the networking device. The networking device then sends data A1 to endpoint 2 (OUT) of target device 2 via interface 2 and sends an IN token packet to endpoint 1 (IN) to query for data return. Upon receiving data packet A2 from endpoint 1 of target device 2, interface 2 returns data packet A2 to target device 1 via endpoint 1 of interface 1 of the networking device. The networked device downloads preset rules from the server through the network interface, detects the data interaction A1 and A2 data, uploads the data to the server, or downloads data from the server to replace or modify A1 or A2 data, or blocks the communication of target device 1 or target device 2.
[0550] It should be noted that the embodiments of the present application can at least solve the following problems.
[0551] Capacity issue: Taking the network USB flash drive scenario as an example (slave device), the current data exchange is to first download all the server files (such as the test.avi file size of 4GB) to the USB flash drive, and then the computer reads the test.avi data from the USB flash drive.
[0552] And the data exchange method of the present application, directly forwards request or corresponding data packet in the download process, only needs to give a small amount of data buffer storage space for data packet.For example, when each sector is 512 bytes, 1 512-byte memory buffer is set, the computer main frame will read the first sector address data of the test.avi file, then the networked device forwards the read instruction to the service end, and downloads the response first sector address data from the service end and stores it in the memory buffer, then the data forwarding of the memory buffer is replied to the computer main frame.Then, when the computer main frame continues to read the second sector address and even the tail sector address of the test.avi file, constantly will be updated to the memory buffer, the service end and the computer main frame exchange, realized completing the transmission of the 4GB file with the storage capacity of 512 bytes, and the size of the transferred file is not subject to the networked device own storage space restriction.On the contrary, if the networked device is taken as an example the test.avi of the network read-write control device reading and writing USB flash drive, test.avi can be uploaded to the service end by the memory buffer of 512 bytes.
[0553] The above examples are merely illustrative. Different file systems may use different read and write methods, or even combine multiple sectors into a single cluster for management. However, the same basic data exchange principle applies to all file systems. In practice, to increase transmission efficiency, multiple sector requests can be combined. For example, if the cache space is 128 x 512 bytes, data can be exchanged using 128 sectors simultaneously. This will not be discussed further.
[0554] Function expansion problem: Taking the network read-write control device as an example (host), the existing technology is that the device acting as the host can only install the program software with interactive instructions (such as driver, parser, etc.) in the device first. Only when there is a local device with a driver can the access device be controlled. Therefore, the driver needs to be installed in advance to control the target device, which makes it difficult to expand the function of the device.
[0555] By using the data exchange technology of the networked device of the present application, interactive instructions can be downloaded in real time on the server side. For example, taking the example of a networked device connecting a standard USB flash drive (with software installed) and a special camera (without software installed), when the USB flash drive is connected, the device itself has installed the USB flash drive reading and writing program (functional instruction set), so the USB flash drive can be read and written directly; when the camera is connected, due to the lack of the functional instruction set of the special camera, the obtained descriptor cannot be recognized and the enumeration cannot be completed, so the obtained descriptor is sent to the server side, and after identification by the server side, the relevant functional instruction set (obtaining descriptors, verification instructions, etc.) is issued, and the device re-enumerates the camera according to the functional instruction set to establish a connection; the server side directly issues a special camera data reading instruction to the networked device, and the networked device forwards the instruction to the special camera. After the camera returns the data, the networked device can directly display the camera image, or forward the image data to the server side, which is stored or shared by the server side.
[0556] Security issues: The data buffer of networked devices and downloaded function instruction data can be stored in memory. The device itself does not need to store data, and the data disappears after power failure. This can protect important data from being stolen.
[0557] In some embodiments, based on the embodiment shown in FIG10 , step S802 includes:
[0558] In response to the data exchange request, forwarding the data exchange request to the second target party;
[0559] receiving target data returned by the second target in response to the data exchange request, and forwarding the target data to the first target.
[0560] In one embodiment of the present application, based on the second strategy of forwarding the data exchange request to the server, the networked device forwards the data exchange request.
[0561] In one embodiment of the present application, when a networked device receives a data exchange request initiated by a target device, the networked device forwards the data exchange request to a server, which parses and processes the data exchange request and returns the target data to the networked device, which then returns the target data to the target device.
[0562] In one embodiment of the present application, the networked device is a network USB key device, the target device is a computer host, and the response to the data exchange request, forwarding the data exchange request to the second target party, includes: responding to the data exchange request sent by the computer host, forwarding the data exchange request to the server, the data exchange request carries the credential information of the USB key device (the credential information can be obtained by user input or sensor acquisition and conversion), so that the server verifies the credential information. The credential information includes but is not limited to a PIN text password and biometric information, and the biometric information includes but is not limited to fingerprint information, iris information, face information and voiceprint information. It can be understood that the description of the relevant implementation principles of the network USB key device can refer to the relevant description of the network USB key device in the above-mentioned device access method, which will not be repeated here.
[0563] In one embodiment of the present application, when a user operates on a networked device and initiates a data exchange request, the data exchange request is first sent to the server for parsing and processing, and the server then returns the target data to the networked device, and the networked device returns the target data to the target device. For example, the networked device acts as a keyboard device, and the keyboard device is connected to the computer host as a slave. When the user clicks a key (such as key A) on the keyboard device at the front end of the computer or the server to enter "A" on the computer host, the data exchange request is triggered by clicking key A and sent to the server. The server identifies the key value "A" corresponding to key A and returns the key value "A" to the keyboard device. When the target device (computer) scans the keyboard input, the keyboard device then sends the key value "A" to the computer host. This can be used as a remote keyboard input scenario. For users to remotely enter sensitive strings (such as passwords, etc.) into the computer host, there is no need to tell the on-site personnel to enter the sensitive strings, thereby improving security. It should be understood that the above key values are only used as examples and not limitations. At the same time, the keyboard device is also applicable to scenarios where processing is performed using preset processing scripts, which will not be repeated here.
[0564] In one embodiment of the present application, the networked device acts as a network proxy control device, connected to the printer in the host role, receives the data to be printed sent by the computer host, and when the data to be printed needs to be optimized (for example, image data is enhanced to improve the print quality of the image), sends the data to be printed to the server for optimization processing, receives the optimized data returned by the server, and sends the optimized data to the printer for printing. It should be understood that the above image data is used for example only and is not limiting, and other data may also be used in other embodiments.
[0565] In one embodiment of the present application, data processing is performed on the server side through request forwarding to reduce the hardware pressure of the networked device, thereby enabling high-computing power data processing for some networked devices with poor computing power, thereby enabling networked devices with low-level functions to achieve high-level functions, improving the advanced application expansion of networked devices, and protecting high-level function programs from being reversed, cracked, and abused locally.
[0566] In an embodiment of the present application, based on the embodiment shown in FIG10 , step S802 includes:
[0567] Based on a preset processing script, data processing is performed on the data exchange request to obtain a data processing result;
[0568] Based on the data processing result, sending a target data acquisition request to the second target party;
[0569] Receive target data corresponding to the data processing result returned by the second target party in response to the target data acquisition request, and return the target data to the first target party.
[0570] In one embodiment of the present application, the preset processing script is a script program that integrates data processing logic, which enables the networked device to process data or run data logic locally without forwarding all data to the server for execution. It only interacts with the server when certain conditions are triggered to improve data processing efficiency.
[0571] In one embodiment of the present application, the networked device acts as a mass storage device (slave role) and processes data exchange requests based on a preset processing script. For example, if it recognizes that the data exchange request sent by the computer host indicates that the file name to be read is test.txt (i.e., the data processing result), it requests the server to read the test.txt file data, downloads the test.txt file data sent by the server (i.e., the target data), and then returns the test.txt file data to the computer host. Similarly, for the data writing process, when the computer host writes the test.txt file, the networked device can upload the test.txt file to the server for storage, and other files are normally stored locally.
[0572] In one embodiment of the present application, the networked device acts as a network read-write control device (host role) with its own storage medium. The processing logic of the general or open source interactive instructions is stored in the local storage medium for execution to increase the data exchange speed. Special instructions are stored on the server side, and then, based on actual needs, the special instructions are remotely loaded from the server side to prevent the interactive logic of the special instructions from being reverse analyzed on the local side, thereby ensuring the security of data exchange. Based on a preset script, data retrieval is performed on connected large-capacity storage devices (such as USB flash drives, etc.), for example, searching for files named test.txt, searching for files whose first byte of the first sector of a file is 0xFF, etc., and the searched file data is automatically uploaded to the server side.
[0573] In one embodiment of the present application, when the networked device acts as a host role, the network proxy control device identifies the vendor ID (Vendor ID), device ID (Product ID) or device type (class, subclass, interface command set, endpoint transmission mode used) of the access device based on a preset script by reading descriptors. Remote mapping is allowed only when the target device that is accessed meets the conditions of the vendor ID, device ID or device type, so as to protect the security of the server or control end.
[0574] In one embodiment of the present application, a networked device, when acting as a host, is a network intermediate control device. Based on preset or downloaded scripts, which are various AI models or algorithms, when the device is connected to an audio device and a computer host, it switches to an audio optimization and enhancement algorithm to optimize the audio data sent from the computer host to the audio device to enhance the audio playback effect of the audio device. When the device is connected to a camera and a computer host, it switches to an AI image recognition model to process image data sent from the camera to the computer host to achieve object tagging, etc.
[0575] In one embodiment of the present application, the aforementioned large-capacity storage device, network read / write control device, network proxy control device, and network intermediate control device are also applicable to request forwarding scenarios, rather than being processed locally using a preset processing script. For data exchange with other device types, please refer to the relevant example descriptions of the device access method described above and will not be repeated here.
[0576] 11 is a flow chart of a data interaction method in another embodiment of the present application, wherein the data interaction method comprises the following steps.
[0577] Step S1101 : configuring scenario configuration information when the networked device communicates with the target device, wherein the scenario configuration information includes automatically running a script.
[0578] Step S1102: Based on the automatic running script, send a first data exchange request to the target device, and receive data sent by the target device in response to the first data exchange request; or based on the automatic running script, receive a second data exchange request sent by the target device, and send data to the target device in response to the second data exchange request.
[0579] In one embodiment of the present application, when receiving the data sent by the target device in response to the first data exchange request, the networked device sends the data sent by the target device to the server.
[0580] In one embodiment of the present application, during the data exchange process with the target device, the networked device can exchange data with the target device based on the local data module of the networked device (such as a storage chip module, a camera module) according to the preset configuration of the data exchange configuration information, or can exchange data with the target device based on the data source provided by the client or the server.
[0581] The data exchange method in this embodiment is introduced below with the networked device as the host mode.
[0582] After the networked device is started and a scene is selected, the networked device is configured according to the data exchange configuration information in the scene configuration information. If the data exchange configuration information includes an automatic execution instruction script (such as an automatic data exchange instruction script), the networked device automatically sends instructions to the target device according to the contents of the automatic execution instruction script. If the data exchange configuration information includes a data source instruction set and a data exchange instruction set, the networked device sends instructions to the target device according to the data source instruction set and the data exchange instruction set. After sending the instructions to the target device, the networked device waits for and receives the data in response from the target device.
[0583] In one embodiment of the present application, the data responded by the target device can be a data packet of a command request or a status packet of a command execution result. After receiving the data responded by the target device, if it is determined that the command has not been executed and the command is a high-level command, for example, the command is a combination of multiple low-level commands or an automatic execution command script (such as an automatic data interaction command script), then according to the rules of the high-level command, the response data is identified and the instructions preset in the high-level command are continued to be issued; if it is determined that the command is executed, according to the rules preset in the command, the response data can be saved in the local storage medium of the networked device (such as a storage chip, hard disk, etc.), or the data responded by the target device can be sent to the server and client.
[0584] In one embodiment of the present application, a networked device returns data to a server or client based on at least one of a data source instruction set, a data exchange instruction set, a bound interactive system, or a data source in the data exchange configuration information. The data returned by the networked device can be the original data (e.g., the original data packet) responded by the target device, or data processed according to the pre-set rules of the instructions in the data exchange configuration information (e.g., converting a status packet into a specific tag).
[0585] In one embodiment of the present application, based on the data exchange permission / prohibition policy in the data exchange configuration information, the networked device can identify the parameter content of the instructions sent by the client and the server, such as identifying the operation type (such as read / write type) and the operation target (such as a specific sector address) in the instructions sent by the client and the server to the networked device, and restricting instructions with specific parameter contents, such as instructions prohibiting write operations, or instructions prohibiting operations with a sector address of 0x00, etc.
[0586] In one embodiment of the present application, based on the policy for allowing / disallowing data exchange, a networked device can identify the content of a received instruction or a data packet in response to an instruction. For example, a write data packet in a write instruction sent by a client or server, or a data packet returned in response to a read instruction, can be judged and identified based on the hash value or byte value at a specific position in the data packet.
[0587] In another embodiment of the present application, identification and judgment can be performed based on the data of the peripheral module in combination with the instruction parameters or the content of the data packet. For example, the data of the peripheral module can be a specific location area of the GPS positioning module or the IP address of the networking module. When the data of the instruction or response meets the preset rules, the networked device operates on the instruction or response data according to the allowed / prohibited exchange policy, such as forwarding or not forwarding the instruction sent by the client or server, or forwarding or not forwarding the data packet of the target device to the client or server.
[0588] In one embodiment of the present application, judgment and identification can also be performed in combination with the data and instruction parameters or data packet content of the peripheral module. For example, only when the GPS position of the GPS positioning module is at a specific location is it allowed to execute an instruction to read a sector at a specific location to the target device.
[0589] The data exchange method in this embodiment is described below using the scenario where a networked device (host mode) reads and writes to a USB flash drive as an example.
[0590] Step S1101 also includes: configuring the data exchange configuration information for reading the USB flash drive scenario. Specifically, when configuring the data exchange configuration information, configure one or more instructions in the following data source instruction set: the maximum number of logical units, obtaining the number of formattable blocks; obtaining the last logical block address; obtaining the block capacity; reading and writing status, etc. Configure one or more instructions in the following data exchange instruction set: USB communication protocol instructions; SCSI transparent command set instructions; file operation instructions. Configure one or more instructions in the binding interactive system or data source strategy: the binding relationship between the server-side and client-side operation instructions and the preset instructions of the networked device. Configure one or more instructions in the binding interactive system or data source strategy: for example, when the location data in the positioning module is not located in a specific location area, prohibit the client and server from sending the instruction in the "file operation instruction" to delete the "test.txt" file in the root directory to the target device.
[0591] In one embodiment of the present application, after the networked device and the target device are successfully enumerated, step S1102 includes: the networked device executes a "read file directory script" to automatically read the boot sector data of the target device (generally sector address 0x00) and analyze the file system boot sector address; read the data of the file system boot sector address and analyze the root folder (or first directory) sector address and cluster (block) size and other related parameters; read the root folder sector address data and analyze the file information. The networked device processes the file information data according to the rules of "binding interactive system / or data source" and sends the processing results to the client or server, so that the client or server displays the corresponding file information on the interactive interface (similar to the root directory display when a USB flash drive is connected to a computer).
[0592] In one embodiment of the present application, a networked device reads the addresses of multiple sectors in accordance with file system protocol rules based on an automatically executed instruction script in an interactive instruction set, analyzes file directories and file data based on the read data, and saves the file directories and file data locally on the networked device, on a server, or on a client. For example, referring to Figures 12 and 13 , the networked device sends a read sector address instruction data and a get endpoint data instruction to a specific endpoint of a target device. For example, the networked device sends a read sector address instruction data (such as a SCSI or SATA CBW packet) to endpoint 1 of the target device via an OUT token packet, and sends a get endpoint data instruction to endpoint 2 of the target device via an IN token packet. Based on the read sector address instruction data and the get endpoint data instruction, the target device returns a data packet corresponding to the sector address to the networked device. Based on the read sector address instruction data and the get endpoint data instruction, the networked device analyzes the file directory and file data based on the read data, where the file directory includes at least one of a file name, file attributes, and a file revelation address. The networked device sends the file directory and file data to the server. The server sends the file directory and file data to the client, so that the client displays the file directory and file data on an interactive interface.
[0593] In one embodiment of the present application, the networked device is set to host mode based on the scene (access) configuration information, and performs data interaction with the target device according to the automatic execution instruction script in the data exchange configuration information. The data interaction endpoint information of the target device (USB device) is obtained by obtaining the descriptor instruction of the scene (access) configuration information. The networked device initiates an instruction query operation instruction request to the server through the interface, and waits for the server to issue an interaction instruction. When an interaction instruction is found, the networked device downloads the interaction instruction set for the interaction operation. After the networked device receives the interaction instruction set, based on the automatic execution instruction script in the interaction instruction set, in accordance with the USB communication protocol and the rules of the mass storage device, it sends the instruction data to the target device (within the timeout determination), and continuously sends token packets to request data from the IN endpoint, and until the IN endpoint returns data or returns an ACK status packet.
[0594] For example, as shown in FIG12 , the networked device sends command data and a Get Endpoint Data command to the target device. For example, the networked device sends command data to Endpoint 1 of the target device via an OUT token packet and sends a Get Endpoint Data command to Endpoint 2 of the target device via an IN token packet. Based on the command data and the Get Endpoint Data command, if no data is returned or preparation for returning data is incomplete, the target device returns a NAK status packet to the networked device, where the NAK status packet indicates the absence of data. Based on the NAK status packet, the networked device repeatedly sends the Get Endpoint Data command to the target device until it receives sector data and an ACK status packet from the target device.
[0595] In one embodiment of the present application, the networked device and the target device may interact with each other in sector read and write operations.
[0596] Specifically, a client or server sends a sector read / write instruction (e.g., a read or write instruction for a specific sector address, such as a SCSI, SATA, or similar device, such as a CBW packet) to a networked device. The networked device then parses the sector read / write instruction issued by the client or server according to the instruction rules for "binding the interactive system or data source" and sends the sector read / write instruction to the target device according to the pre-set instructions in the "data exchange instruction set" (e.g., SCSI transparent command set instructions). Sector read / write instructions include: if a read instruction (e.g., read data from a specific sector) is sent to the target device, the target device returns a data packet and a status packet for the specific sector address in the data storage space; if a write instruction (a write-specific-sector instruction and data packet) is sent to the target device, the data packet is written to the specific sector address in the data storage space of the target device, and the target device returns a status packet. After receiving the data packet or status packet, the networked device responds to the client or server based on the instruction rules for "binding the interactive system or data source."
[0597] Specifically, as shown in FIG14A , a networked device (host device) sends a command (including a token packet and a CBW packet) to a target device (slave device, such as a USB flash drive). Taking the SCSI protocol as an example, 0x28 represents a READ (10) command requesting to read sector address data. The command also includes the operation sector address 0x00000000 and the number of operation sectors 0x0001. After receiving the command, the target device (slave device) responds to the host with a data packet (DATA packet) and a status packet (CSW packet). As shown in FIG14B , this is a multi-sector continuous read command, and the number of operation sectors of the networked device (host device) is 0x0002. After receiving the command, the target device (slave device) responds to the host with two data packets (DATA packet) and a status packet (CSW packet).
[0598] Specifically, as shown in FIG14C , the networked device (host device) sends a command (including a token packet and a CBW packet) to the target device (slave device, such as a USB flash drive). Taking the SCSI protocol as an example, 0x2A represents the WRITE (10) command, which requests that data be written to a sector address. The command also includes a data packet (DATA packet). After receiving the command and data packet, the target device (slave device) performs an operation and responds with a status packet (CSW packet) to the host. As shown in FIG14D , this is a multi-sector continuous write command. The number of sectors operated by the networked device (host device) is 0x0002. The command also includes two data packets (DATA packets). After receiving the command and two data packets, the target device (slave device) performs an operation and responds with a status packet (CSW packet) to the host.
[0599] It should be noted that in order to avoid redundancy, the relevant parameters of the read and write instructions are simplified in other parts of this application.
[0600] As shown in FIG15 , in one embodiment of the present application, the client sends a read sector address instruction data to the server. The server sends the received read sector address instruction data to the networked device. The networked device sends the read sector address instruction data (such as the CBW packet in SCSI) to the specific OUT endpoint (such as endpoint 1) of the target device via the OUT token packet, and sends the get endpoint data instruction to the specific IN endpoint (such as endpoint 2) of the target device via the IN token packet. Based on the read sector address instruction data and the IN token packet, the target device returns a data packet corresponding to the sector address and a status packet (such as the CSW packet in SCSI) for executing the instruction to the networked device. The networked device sends the data packet and status packet (or status data) to the server, and forwards the sector data packet and status packet (or status data) to the client through the server.
[0601] As shown in reference figure 15, in one embodiment of the present application, the client (or control end) sends write sector address instruction data and data packet to the server. The server sends the received write sector address instruction and data packet to the networked device. The networked device sends a write sector address instruction (such as a CBW packet in SCSI) and a data packet to a specific OUT endpoint (such as endpoint 1) of the target device via an OUT token packet, and sends an obtain IN token packet to a specific IN endpoint (such as endpoint 2) of the target device via an IN token packet. The target device performs operations according to the write sector address instruction and data packet, and returns a status packet (such as a CSW packet in SCSI or an ACK, NAK packet in USB, etc.) to the networked device. The networked device sends the status packet (or status data) to the server, and forwards the status packet (or status data) to the client through the server.
[0602] In one embodiment of the present application, a networked device and a target device can interact to perform file read and write operations. Specifically, a file operation instruction (such as a create file instruction, a delete file instruction, a modify file attribute instruction, a read file content instruction, a modify file content instruction, etc.) is sent to the networked device by the client or server. The networked device parses the file operation instruction issued by the client or server according to the instruction rules of the "bound interactive system or data source" and sends the file operation instruction to the target device according to the instructions preset in the data exchange instruction set. If the file operation instruction is an instruction to write data to the target device, such as a create file instruction, a delete file instruction, a modify file attribute instruction, a modify file content instruction, etc., the file operation instruction is a write instruction to write a data packet, and the target device returns status packet data according to the file operation instruction. If the file operation instruction is an instruction to read data from the target device, such as a read file content instruction, the file operation instruction is a read instruction, and the target device returns data in the data packet and status packet according to the file operation instruction. After receiving the data in the data packet or status packet, the networked device responds to the client or server based on the instruction rules of the "bound interactive system or data source."
[0603] As shown in reference figure 16, in another embodiment of the present application, the client sends a file creation instruction to the server. The server sends the file creation instruction to the networked device, and the networked device writes the file creation data to a specific sector address according to the file system protocol rules and the pre-stored file directory. For example, the networked device sends the write sector address instruction data and the file creation data to the endpoint 1 of the target device through the OUT token packet according to the file creation instruction. The target device writes the file creation data to a specific sector address according to the write sector address instruction data and the file creation data, and returns a sector data packet to the networked device. For example, the target device returns a sector data packet to the networked device through endpoint 2. The networked device determines the creation result data from the sector data packet and returns the creation result data to the server. The server returns the creation result data to the client.
[0604] In one embodiment of the present application, when a client or server issues a command or executes an automatically executed command script, the networked device executes the data exchange command according to the "allow / disallow exchange policy" when sending the data exchange command to the target device. For example, according to the above-mentioned CBW packet command, the reading / writing of specific sector data is allowed / disallowed. If the command is prohibited, the CBW command is not sent to the target device.
[0605] As shown in FIG17 , in one embodiment of the present application, a client sends a file search instruction to a server. The server sends the file search instruction to a networked device, which automatically reads multiple storage space addresses (such as sector addresses) according to the file system protocol rules, determines the file data to be searched, and analyzes the file directory. For example, the networked device sends a read sector address instruction data to endpoint 1 of the target device via an OUT token packet, and sends a get endpoint data instruction to endpoint 2 of the target device via an IN token packet, based on the file search instruction. The target device returns a sector data packet (such as file content) or a search result data packet (such as file information) to the networked device based on the read sector address instruction data and the get endpoint data instruction. For example, the target device returns a sector data packet to the networked device via endpoint 2. The networked device determines the file data to be searched and analyzes the file directory from the sector data packet or search result data packet, and returns the search results or file data to the server. The server returns the searched file data to the client.
[0606] It should be noted that the methods of creating and searching files vary depending on the file system protocol. In addition, file operations also include deleting files, modifying file attributes, and modifying file contents. According to different file system rules, these can be configured in the scene through scripts or advanced instructions, which will not be repeated here.
[0607] The data exchange method in this embodiment is described below with the networked device as a slave mode.
[0608] After the networked device is started (or before access) and the scene is selected, the networked device is configured according to the data exchange configuration information in the scene configuration information, such as the instruction response operation, the automatic execution of the instruction response operation script, the second binding interaction system or data source policy, and the second allow / prohibit exchange policy in the data exchange configuration information. The networked device receives, processes and responds to the instructions under the target device according to the configured instruction response operation, the automatic execution of the instruction response operation script, the second binding interaction system or data source policy, and the second allow / prohibit exchange policy. The objects that the networked device operates on according to the received instructions include at least one of the following: 1. A specific database or folder or file (such as an image file) or storage space (such as a sector interval) in the local storage chip, client, or server of the networked device; 2. Local peripheral modules, such as a positioning module, a sensor module, an audio and video source module, and a human-computer interaction module.
[0609] In one embodiment of the present application, the networked device responds to instructions or data sent by the target device according to instructions such as a command response operation, a second binding interaction system, or a data source policy. For example, the networked device responds to the data packet received from the OUT endpoint of the USB token packet sent by the target device, writes the data packet to the storage space, and uploads the data from the storage space to the IN endpoint. It should be noted that the above-mentioned networked device responds to the instructions or data sent by the target device in an automatic response manner, such as automatically reading and writing the bound data source according to the instructions of the target device, without manual intervention during the reading and writing process.
[0610] In another embodiment of the present application, the networked device executes a command response operation on the interactive interface of the client and the server according to the command response oper...
Claims
1. A device access method, characterized in that: Applied to a networked device, the method includes: Configuring configuration information of the networked device based on a preset generation strategy, the configuration information including scenario configuration information of the networked device in at least one application scenario, the scenario configuration information including at least one of a first descriptor set and a function instruction set, and data source configuration information, the first descriptor set being used to define a device type of the networked device, and the function instruction set including a descriptor instruction set; Preloading the scene configuration information; Based on the loaded scenario configuration information, a communication connection is established between the networked device and the target device, so that the networked device is connected to the target device.
2. The device access method according to claim 1, wherein: The preloading of the scene configuration information includes: The networked device preloads the scene configuration information before accessing the target device. The scene configuration information is stored in a server or the networked device, where the server is represented by all electronic devices that are communicatively connected to the networked device and can load the scene configuration information.
3. The device access method according to claim 2, wherein: The preloading of the scene configuration information includes: The networked device sends a scene information acquisition request to the server when starting up, wherein the scene information acquisition request includes an identity identifier of the networked device; The server responds to the scene information acquisition request and filters the scene configuration information to obtain the scene configuration information that matches the identity identifier of the networked device as the scene configuration information; The scenario configuration information is sent to the networked device.
4. The device access method according to claim 1, wherein: The scenario configuration information for configuring the networked device includes: The scene configuration information is generated after configuring at least one of the first descriptor set and the descriptor instruction set and the data source configuration information through a server connected to the networked device, or a client connected to the server, or the networked device in accordance with a preset generation strategy. The preset generation strategy includes at least one of a custom creation strategy, a template creation strategy, and an external import creation strategy.
5. The device access method according to claim 1, wherein: The establishing a communication connection with the target device based on the loaded scene configuration information includes: According to the mode selection information in the scenario configuration information, the networked device is set to at least one of a host mode, a slave mode, and a peer-to-peer communication mode.
6. The device access method according to claim 1, wherein: If the networked device is set to host mode, establishing a communication connection with the target device based on the descriptor instruction set includes: Sending a handshake connection request to the target device; receiving a second descriptor set sent by the target device in response to the handshake connection request; enumerating a plurality of descriptors in the second descriptor set based on a descriptor instruction set of the functional instruction set; If the multiple descriptors of the second descriptor meet the preset device requirements, determining that the handshake connection is successful; If multiple descriptors do not meet the preset device requirements, it is determined that the handshake connection has failed, and the obtained second descriptor set is sent to the server, the corresponding third descriptor set is downloaded from the server, and re-enumeration is performed based on the descriptors in the third descriptor set.
7. The device access method according to claim 6, wherein: The descriptor instruction set includes an instruction to obtain a device descriptor, an instruction to obtain a configuration descriptor, an instruction to obtain an interface descriptor, an instruction to obtain an endpoint descriptor, an instruction to obtain a string descriptor, and an instruction to obtain a BOS descriptor.
8. The device access method according to claim 6, wherein: The method further comprises: If the handshake connection based on the descriptor in the third descriptor set is successful, a target data source is configured when the networked device communicates with the target device, and the target data source is located in the target device, or the server, or a client connected to the server, or any electronic device that is communicatively connected to the networked device.
9. The device access method according to claim 8, wherein: The functional instruction set includes a data source instruction set, and the target data source when configuring the networked device to communicate with the target device includes: Based on the data source instruction set and according to the data source configuration information, a target data source is determined when the networked device communicates with the target device.
10. The device access method according to claim 8, wherein: The target data source includes at least one of a storage medium, a storage space address interval, a mirror storage file, a specific folder, a database, and a data stream.
11. The device access method according to claim 9, wherein: The data source configuration information includes at least one of the data source's capacity information storage medium, storage space address range, read / write status, mirror storage file, specific folder, database, and data stream; the capacity information includes at least one of the data source's last logical block address, the total number of formattable logical blocks, and block capacity.
12. The device access method according to claim 1, wherein: The descriptor instruction set includes at least one of a first standard instruction set, a first special instruction set, and a setting instruction set, wherein: The first standard instruction set is used to send an instruction to the target device to request descriptor data of the target device; The special instruction set is used to obtain data of the device type to which the target device belongs; The setting instruction set is used to send setting instructions, wherein the setting instructions at least include at least one of instructions such as setting address, enabling configuration, enabling endpoint or starting peripheral module.
13. The device access method according to claim 12, wherein: If the networked device is set to host mode, establishing a communication connection with the target device based on the descriptor instruction set includes: Sending a handshake connection request to the target device; acquiring descriptor data of the target device according to the first standard instruction set; Acquiring data of the target device according to the special instruction set; According to the setting instruction set, obtaining at least one of a setting address status, an enabling configuration status, an enabling endpoint status, and a starting peripheral module status of the target device; If it is determined that at least one of the descriptor data of the target device, the data of the target device, the state of the set address, the state of the enabled configuration, the state of the enabled endpoint, or the state of the started peripheral module of the target device does not meet the conditions specified by the first access state judgment rule, it is determined that the handshake connection has failed, and the descriptor data of the target device is sent to the server; receiving new scene configuration information or a new descriptor instruction set sent by the server, wherein the server determines the new scene configuration information or the new descriptor instruction set according to the descriptor data of the target device; A communication connection is established between the networked device and the target device according to the new scene configuration information or the new descriptor instruction set.
14. The device access method according to claim 1, wherein: If the networked device is set to slave mode, establishing a communication connection with a target device based on the first descriptor set includes: Receiving a handshake connection request sent by the target device; In response to the handshake connection request, returning the first descriptor set to the target device, so that the target device enumerates the first descriptor set; If the handshake connection request meets the preset device requirements, determining that the handshake connection is successful; If the handshake connection request does not meet the preset device requirements, it is determined that the handshake connection has failed, and the handshake connection request data is sent to the server, the corresponding fourth descriptor set is downloaded from the server, and re-enumeration is performed based on the descriptors in the fourth descriptor set.
15. The device access method according to claim 1, wherein: The first descriptor set includes at least one of a standard data set, a special data set, and an execution setting instruction, wherein: The standard data set is used to return descriptor data according to the type and parameters of the standard instruction when the target device sends the standard instruction; The special data set is used to return data according to the type and parameters of the special instruction and the type of the networked device when the target device sends a special instruction; The execution setting instruction is used to set at least one of the network device address, enable configuration, enable endpoint, and start peripheral module when the target device sends the setting instruction.
16. The device access method according to claim 15, wherein: If the networked device is set to slave mode, establishing a communication connection with a target device based on the first descriptor set includes: Receiving a handshake connection request sent by the target device; receiving at least one of a standard instruction, a special instruction, or a setting instruction sent by the target device; if at least one of the standard instruction, the special instruction, or the setting instruction does not meet the conditions specified by the second access status determination rule, determining that the handshake connection has failed, and sending a descriptor instruction of the target device to the server; receiving new scene configuration information or a new first descriptor set sent by the server, wherein the server determines the new scene configuration information or the new first descriptor set according to a descriptor instruction of the target device; A communication connection is established between the networked device and the target device according to the new scene configuration information or the new first descriptor set.
17. The device access method according to claim 1 or 16, wherein: The first descriptor set includes at least one of a device descriptor, a configuration descriptor, an interface descriptor, an endpoint descriptor, a string descriptor, a BOS descriptor, and a preset custom descriptor.
18. The device access method according to claim 1, wherein: If the networked device is set to a peer-to-peer communication mode, establishing a communication connection with the target device based on the configuration information includes: Configuring the first interface of the networked device as a sending end, and sending data to the target device through the first interface; The second interface of the networked device is configured as a receiving end, and data sent by the target device is received through the second interface.
19. The device access method according to claim 18, wherein: The configuration information includes at least one of a third mode, a third interface type, an interaction data set, a third state judgment rule, and a third state response rule, wherein: The third mode is used to set the working mode of the networked device to peer mode; The third interface type is used to set the first interface as the sending end and the second interface as the receiving end; The interaction data set is used to set the data sent by the networked device to the target device; The third status judgment rule is used to judge the access success status or access failure status of the networked device based on the data sent by the target device; The third status response rule is a rule for responding according to the access status of the networked device.
20. The device access method according to claim 1, wherein: The target devices include at least one first target device and at least one second target device, the networked device serves as a host device communicatively connected to the at least one first target device, and serves as a slave device communicatively connected to the at least one second target device, and establishing a communication connection with the target devices based on the target scene descriptor information includes: enumerate, based on a descriptor instruction set of the functional instruction set, a plurality of descriptors in a second descriptor set of the at least one first target device; If the handshake connection of the multiple descriptors in the second descriptor set is successful, configuring a first target data source when the networked device communicates with the at least one first target device to complete the communication connection between the networked device and the at least one first target device; receiving a handshake connection request sent by the at least one second target device; In response to the handshake connection request, the first descriptor set is returned to the at least one second target device so that the at least one second target device enumerates the first descriptor set, and after the handshake connection of the first descriptor set is successfully completed, the second target data source when the networked device communicates with the at least one second target device is configured according to the data source configuration information.
21. A data exchange method, characterized in that: Applied to a networked device, the networked device establishes a communication connection with a server and a target device based on the device access method according to any one of claims 1 to 18, the method comprising: Obtaining a data exchange request sent by a first target party; Based on a preset processing strategy, respond to the data exchange request and return the target data to the first target party, where the target data is the data sent by the second target party. If the first target party is the server, the second target party is the target device; if the first target party is the target device, the second target party is the server.
22. The data exchange method according to claim 21, wherein: The target device includes at least one first target device and at least one second target device, and the networking device serves as a host device that is communicatively connected to the first target device, and as a slave device that is communicatively connected to the second target device. If the first target party is the server, the second target party is the first target device or the second target device; if the first target party is the second target device, the second target party is the server or the first target device.
23. The data exchange method according to claim 21 or 22, characterized in that: The responding to the data exchange request based on a preset processing strategy and returning the target data to the first target party includes: In response to the data exchange request, forwarding the data exchange request to the second target party; receiving target data returned by the second target in response to the data exchange request, and forwarding the target data to the first target.
24. A data exchange method, characterized in that: Applied to a networked device, the networked device establishes a communication connection with a target device based on the device access method according to any one of claims 1 to 18, the method comprising: Determine the target data source according to the data source configuration information in the scenario configuration information; Based on the target data source, data interaction is achieved between the networked device and the target device.
25. The data exchange method according to claim 24, wherein: The data source configuration information includes data source capacity information, storage medium, and read / write status. The capacity information includes at least one of the last logical block address of the data source, the total number of formattable logical blocks, or block capacity.
26. The data exchange method according to claim 24, wherein: The target data source is provided in the target device, or the networked device, or the server, or the client connected to the server, or any electronic device in communication connection with the networked device.
27. The data exchange method according to claim 26, wherein: The implementing data interaction between the networked device and the target device based on the target data source includes: Configuring an automatic running script when the networked device communicates with the target device, the scenario configuration information including the automatic running script; Based on the automatic execution script, sending a first data exchange request to the target device, and receiving first data sent by the target device in response to the first data exchange request; or Based on the automatic running script, a second data exchange request sent by the target device is received, and second data is sent to the target device in response to the second data exchange request, wherein the first data or the second data is data in the target data source.
28. The data exchange method according to claim 27, wherein: The receiving of data sent by the target device in response to the first data exchange request further includes: The data sent by the target device is sent to the server, wherein the server is characterized by all electronic devices that are communicatively connected with the networked device and can configure the configuration information.
29. The data exchange method according to any one of claims 24 to 28, characterized in that: The method further comprises: receiving a first low-level instruction sent by the server, where the first low-level instruction is sent by the client to the server, and the first low-level instruction includes an operation type, an operation storage space, an operation length, and a data packet; sending the first low-level instruction to the target device; If the operation type of the first low-level instruction is a read operation, receiving data of a first sector address returned by the target device in response to the first low-level instruction, wherein the target device determines the first sector address according to the operation storage space and the operation length; If the operation type of the first low-level instruction is a write operation, the data in the data packet is written to the first sector address of the target device.
30. The data exchange method according to claim 27, wherein: The method further comprises: receiving a search instruction sent by the server, wherein the search instruction is sent by the client to the server, and the search instruction includes file information; According to the search instruction, traverse and read the relevant storage space addresses of the target device or the networked device to search for corresponding storage data; The stored data is sent to the server, so that the server sends the file data to the client.
31. The data exchange method according to claim 27, wherein: The automatic execution script is a high-level instruction, which includes a create file instruction, a delete file instruction, a modify file attribute instruction, a read file content instruction, and a modify file content instruction.
32. A device access method, characterized in that: Applied to the server, the method includes: When communicating with a networked device, target configuration information is issued to the networked device, the target configuration information being used by the networked device to establish a communication connection with the target device, the target configuration information including scenario configuration information of the networked device in at least one application scenario, the scenario configuration information including at least one of a first descriptor set and a descriptor instruction set, the first descriptor set being used to define a device type of the networked device; the scenario configuration information stored by the server is generated by configuring at least one of the first descriptor set and the descriptor instruction set of the networked device and data source configuration information based on a preset generation strategy before preloading the target configuration information; Based on the target scenario configuration information, a communication connection is established with the target device so that the networked device is connected to the target device, wherein the target scenario configuration information is one type of the scenario configuration information.
33. The device access method according to claim 32, wherein: The sending of target configuration information to the networked device includes: receiving a scene information acquisition request sent by the networked device, responding to the scene information acquisition request, and filtering the scene configuration information to obtain scene configuration information that matches the identity identifier of the networked device in the scene information acquisition request; The scenario configuration information is sent to the networked device.
34. The device access method according to claim 32, wherein: The method further comprises: receiving a descriptor set of a target device sent by the networked device, wherein the descriptor set is received by the networked device from the target device; The server determines new scene configuration information based on the descriptor set of the target device, and sends the new scene configuration information to the networked device, so that the networked device establishes a communication connection between the networked device and the target device based on the new scene configuration information.
35. A data exchange method, characterized in that: Applied to a server, the server establishing a communication connection with a networked device based on the device access method according to any one of claims 30 to 32, the method comprising: Sending a data exchange request to the networked device, and receiving target data returned by the networked device, wherein the data exchange request is used by the networked device to respond to the data exchange request based on a preset processing strategy, and the target data is data sent by the target device; And / or, according to the data exchange request responded by the networked device based on the preset processing strategy, the target data is sent to the networked device, the target data is returned by the networked device to the target device, and the data exchange request is initiated by the target device.
36. The data exchange method according to claim 35, wherein: The method further comprises: receiving a read operation instruction sent by the networked device, determining data from a data source on the server side according to the read operation instruction, and sending the determined data to the networked device; or Receive a write operation instruction and a write data packet sent by the networked device, and write the write data packet into the data source of the server according to the write operation instruction.
37. A server, characterized in that: The server includes a processor and a memory, and the server can implement the device access method described in any one of claims 32 to 34, or the data exchange method described in any one of claims 35 to 36.
38. A data exchange device, characterized in that: Applied to a networked device, the networked device establishes a communication connection with a server and a target device based on the device access method according to any one of claims 1 to 20, the device comprising: An acquisition module, configured to acquire a data exchange request sent by a first target party; A response module is used to respond to the data exchange request based on a preset processing strategy and return the target data to the first target party, where the target data is the data sent by the second target party. If the first target party is the server, the second target party is the target device; if the first target party is the target device, the second target party is the server.
39. A networked device, characterized in that It includes a processor and a memory, the memory is used to store a computer program, and when the computer program is executed by the processor, it implements the device access method according to any one of claims 1 to 20, or the data exchange method according to any one of claims 21 to 31.
40. A computer-readable storage medium, characterized in that It stores a computer program, which, when executed by a processor, implements the device access method according to any one of claims 1 to 20, 32 to 34, or the data exchange method according to any one of claims 21 to 31, 35 to 36.
41. A device access method, characterized in that: Applied to a networked device, the method includes: When communicating with a server, preloading target configuration information, the server storing at least one preset configuration information, the target configuration information being one of the preset configuration information, the target configuration information including scenario configuration information of the networked device in at least one application scenario, the scenario configuration information including at least one of a first descriptor set and a descriptor instruction set, the first descriptor set being used to define a device type of the networked device; the scenario configuration information stored in the server is generated, before preloading the target configuration information, by configuring at least one of the first descriptor set and the descriptor instruction set of the networked device and the data source configuration information based on a preset generation strategy; Based on the target scenario configuration information, a communication connection is established with the target device so that the networked device is connected to the target device, wherein the target scenario configuration information is one type of the scenario configuration information.
42. The device access method according to claim 41, wherein: When communicating with the server, preloading target configuration information includes: When communicating with the server, sending a configuration acquisition request to the server, the configuration acquisition request carrying the identification information of the networked device; Receive target configuration information corresponding to the identification information returned by the server.
43. The device access method according to claim 41, wherein: The networking device serves as a host device that is communicatively connected to a target device. The descriptor instruction set includes a plurality of functional instruction sets, and the functional instruction sets are used to control data exchange between the networking device and the target device.
44. The device access method according to claim 43, wherein: The establishing of a communication connection with a target device based on the target scene descriptor information includes: enumerate multiple descriptors in a second descriptor set of the target device based on a function instruction set in the descriptor instruction set; If the enumeration is successful, a target data source is configured when the networked device communicates with the target device, and the target data source is set on the target device.
45. The device access method according to claim 44, wherein: The functional instruction set includes an acquisition instruction set and a verification instruction set, and the enumeration of multiple descriptors in the second descriptor set of the target device based on the functional instruction set in the descriptor instruction set includes: Based on the acquisition instruction set, read a second descriptor set of the target device; Verifying the plurality of descriptors in the second descriptor set based on the verification instruction set; If the plurality of descriptors meet the preset device requirements, the enumeration is determined to be successful.
46. The device access method according to claim 44, wherein: The functional instruction set further includes a data source instruction set, and the target scenario configuration information further includes data source configuration information. The configuration of the target data source when the networked device communicates with the target device includes: Based on the data source instruction set and according to the data source configuration information, a target data source is determined when the networked device communicates with the target device.
47. The device access method according to claim 43, wherein: The networked device is a network read / write control device, and establishing a communication connection with a target device based on target scene descriptor information includes: enumerate multiple descriptors in a second descriptor set of the target device based on a functional instruction set in the descriptor instruction set; If the enumeration is successful, a request is made to the server to issue a driver instruction set corresponding to the target device to complete the communication connection. The driver instruction set is used to exchange data with the target device.
48. The device access method according to claim 43, wherein: The networked device is a network proxy control device, and establishing a communication connection with a target device based on target scene descriptor information includes: enumerate multiple descriptors in a second descriptor set of the target device based on a function instruction set in the descriptor instruction set; If the enumeration is successful, the second descriptor set is sent to the server, so that the server virtualizes the target device and generates a virtual device corresponding to the target device, thereby establishing a communication connection with the target device.
49. The device access method according to claim 41, wherein: The networked device serves as a slave device in communication with the target device, and establishing a communication connection with the target device based on the target scene descriptor information includes: receiving an enumeration request sent by the target device; In response to the enumeration request, the first descriptor set is returned to the target device so that the target device enumerates the first descriptor set, and after the enumeration is successful, the target data source when the networked device communicates with the target device is configured according to the data source configuration information, and the target data source is set on the server.
50. The device access method according to claim 46 or 49, wherein: The data source configuration information includes capacity information of the data source, and the capacity information includes the last logical block address and block capacity of the data source.
51. The device access method according to claim 44 or 49, wherein: The descriptor set includes at least one of a device descriptor, a configuration descriptor, an interface descriptor, an endpoint descriptor, a string descriptor, and a preset custom descriptor.
52. The device access method according to claim 41, wherein: The target devices include at least one first target device and at least one second target device, the networked device serves as a host device in communication connection with the first target device, and as a slave device in communication connection with the second target device, and establishing a communication connection with the target device based on the target scene descriptor information includes: enumerate multiple descriptors in a second descriptor set of the first target device based on a function instruction set in the descriptor instruction set; If the enumeration is successful, configuring a first target data source when the networked device communicates with the first target device to complete a communication connection with the first target device, wherein the first target data source is located at the first target device; receiving an enumeration request sent by the second target device; In response to the enumeration request, the first descriptor set is returned to the second target device so that the second target device enumerates the first descriptor set, and after the enumeration is successful, the second target data source is configured when the networked device communicates with the second target device according to the data source configuration information, and the second target data source is set at the server or the first target device.
53. A data exchange method, characterized in that: Applied to a networked device, the networked device establishes a communication connection with a server and a target device based on the device access method according to any one of claims 41 to 52, the method comprising: Obtaining a data exchange request sent by a first target party; Based on a preset processing strategy, respond to the data exchange request and return the target data to the first target party, where the target data is the data sent by the second target party. If the first target party is the server, the second target party is the target device; if the first target party is the target device, the second target party is the server.
54. The data exchange method according to claim 53, wherein: The target device includes at least one first target device and at least one second target device, and the networking device serves as a host device that is communicatively connected to the first target device, and as a slave device that is communicatively connected to the second target device. If the first target party is the server, the second target party is the first target device or the second target device; if the first target party is the second target device, the second target party is the server or the first target device.
55. The data exchange method according to claim 53 or 54, characterized in that: The responding to the data exchange request based on a preset processing strategy and returning the target data to the first target party includes: In response to the data exchange request, forwarding the data exchange request to the second target party; receiving target data returned by the second target in response to the data exchange request, and forwarding the target data to the first target.
56. The data exchange method according to claim 55, wherein: The networked device is a network USB key device, the target device is a computer host, and the responding to the data exchange request, forwarding the data exchange request to the second target party, comprises: In response to the data exchange request sent by the computer host, the data exchange request is forwarded to the server, wherein the data exchange request carries the credential information of the network USB key device, so that the server verifies the credential information.
57. The data exchange method according to claim 53 or 54, characterized in that: The responding to the data exchange request based on a preset processing strategy and returning the target data to the first target party includes: Based on a preset processing script, data processing is performed on the data exchange request to obtain a data processing result; Based on the data processing result, sending a target data acquisition request to the second target party; Receive target data corresponding to the data processing result returned by the second target party in response to the target data acquisition request, and return the target data to the first target party.
58. A device access method, characterized in that: Applied to the server, the method includes: When communicating with a networked device, target configuration information is issued to the networked device, the target configuration information being used by the networked device to establish a communication connection with the target device, the server storing at least one preset configuration information, the target configuration information being one of the preset configuration information, the target configuration information including scenario configuration information of the networked device in at least one application scenario, the scenario configuration information including at least one of a first descriptor set and a descriptor instruction set, the first descriptor set being used to define a device type of the networked device; the scenario configuration information stored by the server being generated, before preloading the target configuration information, by configuring at least one of the first descriptor set and the descriptor instruction set of the networked device and the data source configuration information based on a preset generation strategy; Based on the target scenario configuration information, a communication connection is established with the target device so that the networked device is connected to the target device, wherein the target scenario configuration information is one type of the scenario configuration information.
59. A data exchange method, characterized in that: Applied to a server, the server establishes a communication connection with a networked device based on the device access method according to claim 58, the method comprising: Sending a data exchange request to the networked device, and receiving target data returned by the networked device, wherein the data exchange request is used by the networked device to respond to the data exchange request based on a preset processing strategy, and the target data is data sent by the target device; And / or, according to the data exchange request responded by the networked device based on the preset processing strategy, the target data is sent to the networked device, the target data is returned by the networked device to the target device, and the data exchange request is initiated by the target device.
60. A device access device, characterized in that: Applied to a networked device, the device comprises: A preloading module, configured to preload target configuration information when communicating with a server, the server storing at least one type of preset configuration information, the target configuration information being one type of the preset configuration information, the target configuration information including scenario configuration information of the networked device in at least one application scenario, the scenario configuration information including at least one of a first descriptor set and a descriptor instruction set, the descriptor set being used to define a device type of the networked device; the scenario configuration information stored on the server being generated, before preloading the target configuration information, by configuring at least one of the first descriptor set and the descriptor instruction set of the networked device, and data source configuration information, based on a preset generation strategy; The first establishing module is used to establish a communication connection with a target device based on target scene configuration information so that the networked device can access the target device. The target scene configuration information is one type of the scene configuration information.
61. A data exchange device, characterized in that: Applied to a networked device, the networked device establishes a communication connection with a server and a target device based on the device access method according to any one of claims 41 to 52, the apparatus comprising: An acquisition module, configured to acquire a data exchange request sent by a first target party; A response module is used to respond to the data exchange request based on a preset processing strategy and return the target data to the first target party, where the target data is the data sent by the second target party. If the first target party is the server, the second target party is the target device; if the first target party is the target device, the second target party is the server.
62. A networked device, characterized in that It includes a processor and a memory, the memory is used to store a computer program, and when the computer program is executed by the processor, it implements the device access method as described in any one of claims 41 to 52, or the data exchange method as described in any one of claims 53 to 57.
63. A server, characterized in that: The server includes a processor and a memory, and the server can implement the device access method as described in claim 58 or the data exchange method as described in claim 59.
64. A computer-readable storage medium, characterized in that It stores a computer program, which, when executed by a processor, implements the device access method as described in any one of claims 41 to 52, or the data exchange method as described in any one of claims 53 to 57.