A method, device and medium for implementing MTP protocol data transmission in a single-guide device

By dividing the HOST and SLAVE ends in a single-channel device, implementing the MTP protocol stack and optimizing the data transmission method, the compatibility issue between single-channel devices and MTP devices is solved, the file transfer efficiency is improved, and support for the transmission of specific file types is supported, expanding the application scenarios.

CN119854275BActive Publication Date: 2025-09-26SHANDONG SINOCHIP SEMICON CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411906818.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-09-26
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

Existing single-port devices cannot support data transmission with mobile devices such as smartphones and digital cameras that use the MTP protocol. This leads to compatibility issues and low file transfer efficiency.

Method used

In a single-port device, the host and slave ends are divided, the MTP protocol stack is implemented, and a USB 3.0 chip is used as the initiator to establish a session with the MTP device. A 64KB buffer is used to optimize data transmission, and specific files are filtered and sent based on file type.

Benefits of technology

It solves the compatibility issue between single-channel devices and MTP devices, improves file transfer efficiency, supports the screening and transmission of specific file types, and meets the needs of different application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854275B_ABST
    Figure CN119854275B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of communications, and specifically to a method, device, and medium for implementing MTP protocol data transmission in a single-channel device. The present invention implements the MTP protocol at the HOST end of the single-channel device, optimizes the data BLOCK blocks transmitted each time based on the data transmission characteristics of the MTP protocol, and improves the overall data transmission efficiency; supports traversing the file system of the MTP device, and increases support for a single MTP device with multiple STORAGEs; supports filtering and sending specific types of files based on file type, and by adding a configuration module, supports filtering of different file types by modifying the configuration. The present invention solves the problem of compatibility between single-channel devices and MTP devices, optimizes and improves file transmission performance, and supports filtering and sending specific types of files based on file type to meet the needs of different application scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communications, and in particular to a method, a device and a medium for implementing MTP protocol data transmission in a single-guide device. Background Art

[0002] MTP is a new multimedia transfer protocol developed by Microsoft for transferring files between mobile devices and host computers. Due to its widespread use in mobile devices, MTP has become an essential component in a wide range of connected devices. Android versions 3.0 and later have added support for the MTP transfer protocol, allowing Android mobile products to interact with computers via the MTP protocol. This means users can quickly and easily transfer files between mobile devices and computers using the MTP protocol.

[0003] Currently, single-channel transmission equipment manufacturers' solutions only support data transfer and import from large-capacity mobile storage devices such as USB flash drives. In other words, they only support the USB mass storage protocol and do not yet support mobile devices that support the MTP protocol, such as smartphones, voice recorders, and digital cameras. This leads to practical limitations for single-channel equipment. Summary of the Invention

[0004] In response to the shortcomings of the existing technology, the present invention provides a method, device and medium for implementing MTP protocol data transmission in a single-channel device, which solves the problem of compatibility between single-channel devices and MTP devices, while optimizing and improving file transfer performance, and supports the function of filtering and sending specific types of files according to file types to meet the needs of different application scenarios.

[0005] In order to solve the technical problem, the technical solution adopted by the present invention is: a method for implementing MTP protocol data transmission in a single-guide device, comprising the following steps:

[0006] S01. A single-channel device is divided into a host and a slave. The host is a USB 3.0 chip. The host acts as an initiator to initiate a session with an MTP device. The MTP device acts as a responder, processing the initiator's request and providing feedback on the result. Files obtained from the MTP device are sent from the host to the slave via a single-channel path. The slave then transfers the received files to the target PC host.

[0007] S02. Implement the MTP protocol stack in layers on the HOST side. The MTP protocol stack includes a physical layer, a transport layer, and a command layer. The physical layer is used to implement the underlying communication of the USB, the transport layer is used to implement data and instruction format encapsulation, and the command layer is used to implement MTP instructions and protocols.

[0008] S03. On the host side, N buffer blocks are opened up, each of which can hold 64KB of data. These N buffer blocks form a circular linked list of data blocks. The command layer stores the data packets received from the physical layer in the buffer blocks in sequence until they are full or all file data is received. The host side then sends the buffer block data to the slave side until all file transfers are completed.

[0009] S04. After the host detects that a device with a USB interface is connected, it first initializes the USB configuration information and interface information, then determines whether the connected device supports the MTP protocol and the supported protocol type. If the connected device supports the MTP protocol, it initiates a session creation request to establish a communication channel with the connected device. After the communication channel is established, the host queries the total number of storages of the currently connected device and records the ID of each storage. It then selects the specified storage for file transfer, or traverses each storage and performs file transfer.

[0010] S05. The HOST reads the file configuration information. The file configuration information is used to start the file transfer, determine and filter the file type to be transferred; then, based on the ID list of the storage obtained, each storage is traversed to filter the file type specified in the file configuration information for transfer.

[0011] Furthermore, the file configuration information is written when the single-lead device is mass-produced with firmware, and supports real-time updates after mass production.

[0012] Furthermore, the file configuration information is updated by reading the configuration file from the USB disk.

[0013] Furthermore, when traversing each STORAGE, each STORAGE has a root directory. Starting from the root directory, folders and files are traversed and the file types specified in the file configuration information are filtered for transmission. For any file read, the file type is first parsed and it is determined whether the file type is in the file configuration information list. If it meets the requirements, the file is sent, and the file information and file content are sent from the HOST end to the SLAVE end, and then from the SLAVE end to the target PC.

[0014] Furthermore, the first data packet of the file data transmitted by MTP is a fixed file header of 500 bytes in length, followed by multiple 16KB data blocks, and the end is a data tail packet of less than 16KB. After the HOST end receives the data packet obtained by the physical layer, it reorganizes the data packet, and each 64KB is a transmission BLOCK. Files less than 64KB are placed in a circular linked list of data blocks according to the actual file size. The data packet transmitted by the HOST end to the SLAVE end is 64KB or the actual file size at a time.

[0015] Furthermore, the physical layer implements the underlying USB communication through the xHCI protocol, including control transmission and BULK transmission.

[0016] Furthermore, the MTP device is a smart phone, a voice recorder or a digital camera that supports the MTP protocol.

[0017] The present invention also discloses a device for implementing MTP protocol data transmission in a single-guide device, comprising a processor and a memory storing program instructions, wherein the processor is configured to execute the method for implementing MTP protocol data transmission in a single-guide device as described above when running the program instructions.

[0018] The present invention also discloses a storage medium storing program instructions. When the program instructions are run, the method for realizing MTP protocol data transmission in a single-guide device as described above is executed.

[0019] Beneficial Effects of the Invention: This invention proposes a single-channel device and implementation method supporting the MTP protocol, resolving the compatibility issues between single-channel devices and MTP devices. It also optimizes and improves file transfer methods and performance, supports filtering files to be sent based on file type, and meets the needs of various application scenarios, improving the file transfer efficiency of single-channel transmission devices. The invention supports single-channel transmission of data from multiple MTP devices and is applicable to security applications such as government offices and confidentiality. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is the principle architecture diagram of this method;

[0021] Figure 2 This is a schematic diagram of the MTP protocol layering;

[0022] Figure 3 This is a schematic diagram of the file transfer BLOCK;

[0023] Figure 4 To identify and traverse the MTP device STORAGE flow chart;

[0024] Figure 5 Traverse the flowchart for the file. DETAILED DESCRIPTION

[0025] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. First, the English words appearing in the embodiments are explained:

[0026] MTP: Media Transfer Protocol.

[0027] Initiator: Initiator, which refers to the USB HOST end in this solution.

[0028] Responder: The responder, which in this solution refers to the MTP device.

[0029] Example 1

[0030] This embodiment discloses a method for implementing MTP protocol data transmission in a single-channel device, such as Figure 1 As shown, this method involves three participants: an MTP device, a single-port device, and a target PC. The MTP device communicates with the single-port device via USB, and vice versa. The single-port device is divided into a host and a slave side. The host side is a USB 3.0 host chip, which enables single-port transmission devices to support the MTP transmission protocol. This method implements the MTP initiator function in the host chip. As the initiator, the host actively initiates a session with the MTP device. The MTP device, as the responder, processes the initiator's request and provides feedback on the results. This conforms to the MTP protocol specifications and characteristics. Therefore, as long as a single-port device implements the standard MTP protocol stack on the host side, it can support one-way data import and export to the MTP device.

[0031] like Figure 1 As shown in the figure, the HOST end of the single-channel device implements the MTP protocol and filters and parses files uploaded by the MTP device, while optimizing the performance of small file transfers. Files obtained from the MTP device are sent from the HOST end to the SLAVE end through a single-channel path. The SLAVE end transfers the received files to the target PC host through the host USB port.

[0032] This method primarily encompasses the following aspects: a layered implementation of the MTP protocol on the host side; improved data block optimization during file transfer; methods and procedures for identifying and traversing MTP devices, as well as supporting multiple storage devices for a single MTP device; and file type filtering and transfer methods, along with configuration modifications to support filtering of different file types. A detailed description follows.

[0033] Support of MTP transmission protocol: The HOST side of the single-channel device uses the host (USB HOST) mode, and implements the MTP protocol stack in layers on the HOST side, such as Figure 2 As shown in the figure, the MTP protocol stack implemented on the host side is divided into the physical layer, transport layer, and command layer. The physical layer mainly implements the underlying USB communication (including control transfer and bulk transfer) through the xHCI protocol. The transport layer implements data and command format encapsulation, and the command layer implements various commands of the standard MTP protocol.

[0034] Optimization and improvement of data blocks during file transfer: Due to the characteristics of the MTP protocol, for small files, the size of the data packet obtained by the USB underlying layer in a single time is not fixed (it can be any length less than or equal to 16KB). This will result in low reading performance for small files. To optimize data transmission performance, this solution optimizes and improves the single data BLOCK block during file transfer.

[0035] The specific method is to open N buffer blocks with a data capacity of 64KB on the HOST side. The N buffer blocks are connected end to end to form a circular linked list of data blocks. The data packets obtained by the MTP command layer from the USB physical layer are stored in the blocks in sequence. The size of each block is 64KB. The HOST side will not send the block to the SLAVE side until it is full or the file data is received until all file transfers are completed.

[0036] like Figure 3 As shown in the figure, the first packet of a file data packet transmitted by MTP is a fixed 500-byte header (header data), followed by multiple 16KB data blocks (body data), and finally a tail packet (tail data) of less than 16KB. After the host receives the data packets from the USB physical layer, it reassembles them and stores them in a buffer block, with each 64KB block being a transmission block. Files less than 64KB are transferred according to the actual file size. In this way, the data packets transmitted from the host to the slave are 64KB at a time, achieving optimal USB data transmission performance and improving data transmission efficiency.

[0037] Identify and traverse MTP devices: Figure 4As shown, after the HOST detects that a device with a USB interface (a mobile storage device that supports MTP, such as a voice recorder, etc.) is connected, it first initializes the USB configuration information, interface information, etc., and then sends a "get device information" command to determine whether the current device supports the MTP protocol, as well as the supported protocol type and other information based on the acquired device information. If the current device supports the MTP protocol, a session creation request is initiated, and at this time, the communication channel with the device has been established. In the case where a device has multiple storage modules (STORAGE), first query how many STORAGEs the current device has in total, and record the ID of each STORAGE, and then filter the specified STORAGE for file transfer according to the policy, or traverse each STORAGE and perform file transfer. The policy is stored in the file configuration information of the single-guide device, and the file configuration information specifies which STORAGEs are to be transferred.

[0038] File Type Filtering and Data Processing: During initialization, the USB host of a single-channel device reads the file configuration information from the offset where it is stored, completing the initialization process. This file configuration information is used to determine and filter the file type to be transferred after the file transfer is initiated. This file configuration information can be written during firmware mass production for the single-channel chip or updated by reading a configuration file from a USB flash drive, ensuring that the file type filtering rules can be modified as needed.

[0039] The specific process and rules for file transfer are as follows:

[0040] According to the ID list of the storage obtained, each storage is traversed, such as Figure 5 As shown, each STORAGE has a root directory. Starting from the root directory, folders and files are traversed and the file types specified in the "file configuration information" are filtered for transmission. For any file read, the file type is first parsed and it is determined whether the file type is in the file configuration information list. If it meets the requirements, the file is sent, and the file information and file content are sent from the HOST end to the SLAVE end via the optical module. If it does not meet the rules, the current file is skipped. For example, if there is only wav / JPEG information in the currently read file configuration information, only files with file types of .wav and .JPEG are filtered for transmission. In this way, for a specific voice recorder or digital camera device, it can be ensured that only valid audio files or picture files required by the user are transmitted, avoiding the transmission of other invalid system files, greatly improving the data transmission efficiency.

[0041] This method uses the data transmission characteristics of the MTP protocol to optimize the data BLOCK blocks of each transmission, thereby improving the overall data transmission efficiency; supports traversing the file system of the MTP device, and adds support for a single MTP device with multiple STORAGEs (storage media); supports filtering and sending specific types of files based on file type, and by adding a configuration module, supports filtering of different file types by modifying the configuration.

[0042] This method supports the one-way import and transfer of specific data to devices such as smartphones and voice recorders that support the MTP transmission protocol. Furthermore, it optimizes and improves file transfer performance to meet user needs, and supports filtering and sending files of specified types and formats based on file type. This not only meets customer needs, but also enriches the application scenarios of single-port devices, facilitating product promotion and application.

[0043] Example 2

[0044] The present disclosure provides an apparatus for implementing MTP protocol data transmission in a single-port device, comprising a processor and memory. Optionally, the apparatus may also include a communication interface and a bus. The processor, communication interface, and memory may communicate with each other via the bus. The communication interface may be used for information transmission. The processor may invoke logic instructions in the memory to execute the method for implementing MTP protocol data transmission in a single-port device according to the above embodiment.

[0045] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product.

[0046] Memory, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as the program instructions / modules corresponding to the methods in the embodiments of the present disclosure. The processor executes the program instructions / modules stored in the memory to perform functional applications and data processing, thereby implementing the method for implementing MTP protocol data transmission in a single-port device in the above-mentioned embodiments.

[0047] The memory may include a program storage area and a data storage area. The program storage area may store an operating system and at least one application required for a function; the data storage area may store data generated based on the use of the terminal device. Furthermore, the memory may include high-speed random access memory and non-volatile memory.

[0048] Example 3

[0049] The present disclosure provides a computer-readable storage medium storing computer-executable instructions configured to execute the method for implementing MTP protocol data transmission in a single-port device. The computer-readable storage medium may be either a transient or non-transitory computer-readable storage medium.

[0050] The technical solutions of the embodiments of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in the embodiments of the present disclosure. The aforementioned storage medium may be a non-transitory storage medium, including: a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, an optical disk, and other media that can store program code, or a transient storage medium.

[0051] The above description and the accompanying drawings sufficiently illustrate the embodiments of the present disclosure to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, process and other changes. The embodiments represent only possible variations. Unless expressly required, individual components and functions are optional, and the order of operations may vary. Portions and features of some embodiments may be included in or replace portions and features of other embodiments. Moreover, the terms used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and claims, the singular forms "a", "an" and "the" are intended to also include the plural forms unless the context clearly indicates otherwise. Similarly, the term "and / or" as used in this application means any and all possible combinations of one or more of the associated listings. In addition, when used in this application, the term "comprise" and its variations "comprises" and / or comprising refer to the presence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof. In the absence of further restrictions, an element defined by the sentence "comprising a..." does not exclude the presence of other identical elements in the process, method or device that includes the element. In this article, each embodiment may focus on the differences from other embodiments, and the same and similar parts between the various embodiments can be referenced to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method part disclosed in the embodiments, then the relevant parts can be referred to the description of the method part.

[0052] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software may depend on the specific application and design constraints of the technical solution. The technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. The technicians will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

Claims

1. A method for implementing MTP protocol data transmission in a single-conductor device, characterized in that: The following steps are involved: S01. A single-channel device is divided into a host and a slave. The host is a USB 3.0 chip. The host acts as an initiator to initiate a session with an MTP device. The MTP device acts as a responder, processing the initiator's request and providing feedback on the result. Files obtained from the MTP device are sent from the host to the slave via a single-channel path. The slave then transfers the received files to the target PC host. S02. Implement the MTP protocol stack in layers on the HOST side. The MTP protocol stack includes a physical layer, a transport layer, and a command layer. The physical layer is used to implement the underlying communication of the USB, the transport layer is used to implement data and instruction format encapsulation, and the command layer is used to implement MTP instructions and protocols. S03. On the host side, N buffer blocks are opened up, each of which can hold 64KB of data. These N buffer blocks form a circular linked list of data blocks. The command layer stores the data packets received from the physical layer in the buffer blocks in sequence until the buffer blocks are full or all file data is received. The host side then sends the buffer block data to the slave side until all file transfers are completed. S04. After the host detects that a device with a USB interface is connected, it first initializes the USB configuration information and interface information, then determines whether the connected device supports the MTP protocol and the supported protocol type. If the connected device supports the MTP protocol, it initiates a session creation request to establish a communication channel with the connected device. After the communication channel is established, the host queries the total number of storages of the currently connected device and records the ID of each storage. It then selects the specified storage for file transfer or traverses each storage and performs file transfer. S05. The HOST reads the file configuration information. The file configuration information is used to start the file transfer, determine and filter the file type to be transferred; then, based on the ID list of the storage obtained, each storage is traversed to filter the file type specified in the file configuration information for transfer.

2. the method for realizing MTP protocol data transmission in single-guide device according to claim 1, is characterized in that: The file configuration information is written when the single-lead device is mass-produced with firmware, and supports real-time updates after mass production.

3. the method for realizing MTP protocol data transmission in single-guide device according to claim 2, is characterized in that: Update the file configuration information by reading the configuration file from a USB flash drive.

4. The method for transmitting MTP data in a single-channel device according to claim 1, wherein: When traversing each STORAGE, each STORAGE has a root directory. Starting from the root directory, folders and files are traversed and the file types specified in the file configuration information are filtered for transmission. For any file read, the file type is first parsed and it is determined whether the file type is in the file configuration information list. If it meets the requirements, the file is sent, and the file information and file content are sent from the HOST end to the SLAVE end, and then from the SLAVE end to the target PC.

5. The method for realizing MTP protocol data transmission in a single-guide device according to claim 1, wherein: The first data packet of the file transmitted by MTP is a fixed 500-byte file header, followed by multiple 16KB data blocks, and the end is a data tail packet less than 16KB. After the host receives the data packet obtained by the physical layer, it reassembles the data packet, and each 64KB is a transmission BLOCK. Files less than 64KB are placed in a circular linked list of data blocks according to the actual file size. The data packet transmitted by the host to the slave is 64KB or the actual file size at a time.

6. The method for realizing MTP protocol data transmission in a single-guide device according to claim 1, wherein: The physical layer implements the underlying USB communication through the xHCI protocol, including control transmission and BULK transmission.

7. The method for realizing MTP protocol data transmission in a single-guide device according to claim 1, wherein: The MTP device is a smart phone, a voice recorder or a digital camera that supports the MTP protocol.

8. A device for implementing MTP protocol data transmission in a single-channel device, comprising a processor and a memory storing program instructions, characterized in that: The processor is configured to execute the method for implementing MTP protocol data transmission in a single-lead device according to any one of claims 1 to 7 when running the program instructions.

9. A storage medium storing program instructions, characterized in that: When the program instructions are executed, the method for implementing MTP protocol data transmission in a single-guide device according to any one of claims 1 to 7 is executed.

Citation Information

Patent Citations

  • File transfer method and device and terminal device

    CN109271266A

  • File transfer method, device and terminal device

    CN109298956A