|
|
This post has NOT been accepted by the mailing list yet.
First Problem:When I want to read/write a libusb32 device on windows. I write following code:
char fileName[] = "\\\\.\\libusb0-001";
HANDLE fileHandle = CreateFile(fileName, 0, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
/* retrieve device descriptor */
libusb_request req;
struct usb_device_descriptor descriptor;
req.descriptor.type = USB_DT_DEVICE;
req.descriptor.recipient = USB_RECIP_DEVICE;
req.descriptor.index = 0;
req.descriptor.language_id = 0;
req.timeout = IBUSB_DEFAULT_TIMEOUT;
ResetEvent(overLapped.hEvent);
DeviceIoControl( fileHandle, LIBUSB_IOCTL_GET_DESCRIPTOR, &req, sizeof(libusb_request),
&descriptor, USB_DT_DEVICE_SIZE, NULL, &overLapped))
It is ok, CreateFile, DeviceIoControl work well. But I got to know fileName can also be usb device symbolic file name. like:
"\\\\?\\USB#VID_DE24&PID_E910#6&282d7f15&0&3#{a5dcbf10-6530-11d2-901f-00c124fb951234}"
I use it as fileName.
CreateFile is ok, file handle is valid, but DeviceIoControl can't work, GetLastError is 1: ERROR_INVALID_FUNCTION, I'm sure the symbolic name is the device: when I remove the device
CreateFile will failed.
Who can help me to explain it?
2. Second Problem, Why I can't use SetupDiEnumDeviceInterfaces, microsoft recommand code to get
libusb32 device file path. Libusb32 has not device interface GUID?
Thanks
|