0
votes

I have a requirement to send some commands to a device(Cash drawer) connected to the USB port to open the drawer. The device may be from different vendors and manufacturers, so i need a common mechanism to write to the devices just like writing to serial port. Can i use LibUsb win32 to achieve it, if so there are two things Filter driver and device driver which one should i use?

1
AFAIK, you can only use libusb as "device driver", if real driver for device is not installed, otherwise you use filter driver.dbrank0

1 Answers

1
votes

I've successfully done this using WPD (not for newbies). Perhaps not suitable for all scenarios, but it certainly is a good start. I would guess that there is a standard command to 'open device'. Some WPD commands here.

Otherwise I would reverse-engineer the device command needed to open the drawer using busdog and try to write this command to the USB device using the CreateFile and WriteFile APIs.