|
From: Xiaofan C. <xia...@gm...> - 2014-02-11 12:37:33
|
On Tue, Feb 11, 2014 at 8:26 PM, Xiaofan Chen <xia...@gm...> wrote: > On Tue, Feb 11, 2014 at 2:24 PM, Balázs Grill <bal...@gm...> wrote: >> Hello! >> >> I'm trying to access a microchip MCP2200 device using libusb (1.0.18). It is >> a composite device with a HID, and a CDC interface. On linux (x86, x86_64, >> armhf) it works without any problem. However, on windows (x86_64), claiming >> the CDC interface (after a successful claim on the HID interface) with >> libusb_claim_interface fails with -12 (LIBUSB_ERROR_NOT_SUPPORTED). >> According to the API documentation this API should not return with this >> error. >> >> What can cause this error? >> >> You can see the usb descriptor here: >> https://gist.github.com/balazsgrill/3468976 >> Here, you can see the code I use to access the device: >> https://github.com/balazsgrill/mcp2200/blob/master/src/mcp2200.c >> The program fails in mcp2200_connect at line 384. > > Have you installed the supported driver for the > CDC interface? You need to do that in order to > use libusb under Windows. > > Ref: https://github.com/libusb/libusb/wiki/Windows#wiki-driver-installation > > The issue is that you can not use the CDC-ACM interface > under Windows as a serial port once you use WinUSB driver > to replace it. > > It seems to me a better approach is only to concentrate on > the HID interface and leave the CDC-ACM interface to > the OS to handle (be it Linux or Windows). Then you can > write a Linux only or cross-platform utility to control the > HID interface. In that case, you may not want to use libusb > but rather HIDAPI which may be more suitable. For others who are not that familiar with MCP2200: Product page from Microchip http://www.microchip.com/wwwproducts/devices.aspx?dDocName=en546923 Microchip's Linux CDC-ACM driver readme http://ww1.microchip.com/downloads/en/DeviceDoc/mcp2200_linux_driver_readme.txt Microchip has a Windows only utility to access the HID interface for the following function. Class 03h - HID: I/O control, EEPROM access, and initial configuration The HID interface command is documented here. http://ww1.microchip.com/downloads/en/DeviceDoc/93066A.pdf One simple example is here using HIDAPI. https://github.com/Miceuz/USBtoUART/blob/master/mcp2200.c I am not so sure if there are any Linux utility now to access the HID interface to the full extent. -- Xiaofan |