简体   繁体   中英

Can libusb be build using GNU GCC compiler?

I am trying to start using libusb for communication via COM port ( EDIT : for my Rs232 device), on windows 10 x64 only. My IDE is Code:blocks. I have a couple of questions:

I downloaded libusb from their website (latest windows binaries)

libusb 下载

But I noticed there is a libusb-win32 ''version'' of it in sourceforge. It says

"libusb-win32 is a port of libusb-0.1 under Windows"

  1. What does this mean, and should I use the "latest windows binaries" version or the "libusb-win32" version?

Also, the Readme file from their website (the 'libusb windows binaries' one) has instructions for compiling in Visual Studio and Mingw and there are files for Visual studio and Mingw only.

  1. Does this means I cannot compile the libusb it in GNU GCC compiler?

EDIT: the question 2) is already answered here: https://stackoverflow.com/a/38252750/13294095

"I am trying to start using libusb for communication via COM port ( EDIT: for my Rs232 device), on windows 10 x64 only"

If you have a device that when you plug it into your PC via a USB port, it instantiates a COM port, then that device does have a UART. The device must also have driver that upon connecting to the PC is installed, and results in establishing the serial port you can see in device manager (under ports) Read about USB serial driver for some background.

"I have a physical uart device after the Rs232, I my MCU. I use the Rs-232 to translate from UART to USB protocol. -Even though I do not know what "Virtual com port" is."

Your device may have a UART, but when you plug it into a PC via a USB port, a virtual serial port is created via a driver on the PC... "When the USB to serial adapter is connected to the computer via the USB port the driver on the computer creates a virtual COM port which shows up in Device Manager on Windows" ... Read more here . (under Architecture)

In short, if when you plug your device into the PC, you can see a port that has been created in Device Manager, then all the work is done. Your application code can incorporate a C serial port library to open a port and send/receive serial messages, etc. However, if you are developing the device with the UART to work on a Windows PC via a USB port, then yes, you need to create a driver. Maybe then libUSB is for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM