Host computer with USB to do virtual serial port, finally caught a pure code summary, no pit of the perfect solution.

Source: Internet
Author: User

using LIBUSB to achieve their own drive + lower machine theory speed. =1m bytes per second. reach the Limit speedWindows has its own virtual serial port driver, but also requires an INF file Method 1: Directly download a serial INF to modify the file.

Method 2: use LIBUSB to achieve your own drive ... and applications. Using that tool to install its own defined device name, the application is based on Pid,vid to find our device for a series of reads and writes.


Lower machine: 1, the configuration descriptor is written, see the project code comments. Main is the CDC class interface with endpoint 2, the data interface with endpoint 1 and endpoint 3 2,get_line_coding request, get the serial port properties. Baud rate, stop bit, checksum type, number of data bits. Avoid problems such as port size, alignment, fill patterns, and so on. Use arrays instead of structs. this is to set the real serial port baud rate, and the virtual serial port how fast you want to be fastUsb_prop.cLine_coding linecoding =
{
115200,/* baud rate*/
0x00,/* Stop bits-1*/
0x00,/* parity-none*/
0x08/* No. of Bits 8*/
};3,set_line_coding, set the serial port attribute 4, processing serial port data usb_endp.cthe Ep1_in_callback () device enters data to the host,Ep3_out_callback () host outputs data to device

Host computer with USB to do virtual serial port, finally caught a pure code summary, no pit of the perfect solution.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.