Question Communication with USB Device

Lachy

Member
Joined
Dec 19, 2008
Messages
5
Programming Experience
5-10
So I've just bought a USB barcode scanner. The interface is USB. It has two modes, USB-KBD and USB-COM mode. USB-KBD mode is easy enough to figure out, input comes as keyboard input. However that's a little nasty and I'd prefer the cleaner way of communicating with the device.

I have all the .sys and .inf files I require, but I have absolutely no idea where to start in terms of getting it working in VB .NET. I have never once done peripheral device communication before.

Can anybody point me in the right direction?
 
I can only assume that the COM mode emulates a serial port, so you'd use the SerialPort class to communicate with it. You should read the class documentation and then search for some examples of its use online. If you're still not sure then you can come back and ask specific questions.
 
You're exactly right, and I was quite easily able to get communication with the device working through the SerialPort class.

However, how did you know this? Is this how communication with USB devices normally works?

On another note, what is the best way, do you suggest, to poll the device? I'm currently using a Timer, although I suspect I should be using a Thread. Advice?
 
A serial port is also known as a COM port, so "USB-COM" is very suggestive of COM port emulation. I haven't really had to work with specific hardware much but this is not unusual.

How often are you polling? If it's infrequent then a Windows.Forms.Timer is fine. A Timers.Timer can raise its events in background threads anyway, so if it's more frequent that may be the best option. If it's very frequent then a dedicated thread is probably the way to go.
 
Back
Top