From: anshu p. <pan...@gm...> - 2020-07-23 04:51:53
|
Hi Team, This is my current project so I need to work with a sensor(scanner) device.Now I have changed a little bit but writepipe has gone into blocking state neither application responding nor device . Changes are: 1-if (!Usb.SetAltInterface(usbHandle, (UCHAR)0, (UCHAR)0, ALT_SETTING_NUMBER)) now set the interface to 0x01 to use bulk pipe 2-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); After changing the ALT_SETTING_NUMBER 0x0 to 0x01 writepipe has gone into blocking state. Please find attached screenshot of wireshark of setting interface and writepipe. Here I have a query regarding the destination address that has changed 2.1.0 to 2.1.1 when writepipe is called. Is this correct? I am confused at this point why the destination address changed when the writepipe is called. Thanks, Anshul On Thu, Jul 23, 2020 at 7:25 AM Xiaofan Chen <xia...@gm...> wrote: > 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 > > > _______________________________________________ > Libusb-win32-devel mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel > |