From: Xiaofan C. <xia...@gm...> - 2020-07-23 01:54:47
|
On Wed, Jul 22, 2020 at 11:13 PM anshu panwar <pan...@gm...> wrote: > > Hi Team, > Thanks for the reply. > I have followed this link https://docs.microsoft.com/en-us/windows-hardware/drivers/usbcon/winusb-installation to make my device as winusb without installing a custom driver. > After doing the above step my device(scanner device) is working as a winusb device and also i have downloaded libusbK-3.0.7.0-setup to work with this device. > > I have followed the steps below: > 1-LstK_Init > 2-LstK_Count > 3-LstK_FindByVidPid > 4-!LibK_LoadDriverAPI(Usb, deviceInfo->DriverID) > KUSB_DRVID_WINUSB: > printf("WinUSB driver api loaded!\n"); > 5-!Usb.Init(usbHandle, deviceInfo) > 6-!Usb.QueryInterfaceSettings(usbHandle, 0x0, &interfaceInfo) > 7-Usb.QueryPipe(usbHandle, (UCHAR)ALT_SETTING_NUMBER, (UCHAR)iEndpoint, &pipeInfo); > ALT_SETTING_NUMBER =0x01(i want to work with bulk pipe) > 8-Usb.WritePipe(usbHandle, 0x01, cmdBuffer, sizeof(cmdBuffer), (PUINT)&lengthTransferred, NULL); > BYTE cmdBuffer[8+1] = {0x00,0x00,0x00, 0x01}; > > till the 7 steps everything is successfully done but writepipe is not working . > > Is these steps are enough to understand or i should forward all the code which I am using currently. > Please update me about this. Step 8 is the most important, you can not just anyhow send to the device and expect the device to understand the command. You need to know the communication protocol in order to be able to communicate with the device. Is this a real project or you want to learn to use libusbk? If you just want to learn to use libusb or libusbk, then a scanner is not a good device to use. It is better to use a MCU development kit, like those Arm Cortex M0/M3/M4/etc development kit, from STM or other vendors. -- Xiaofan |