Host USB port

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
LaylaW
 
Posts: 5
Joined: Tue Feb 04, 2014 8:32 pm

Host USB port

Post by LaylaW »

I'd like to connect a barcode scanner to the USB host port. Where can I find code examples for configuring and reading data from that port?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Host USB port

Post by adafruit_support_mike »

If you mean the MCR12 unit we have in the store, the documents for it are linked under the 'Downloads' tab: http://www.adafruit.com/products/1203#Downloads

I don't know of any code examples for the BBB though.

LaylaW
 
Posts: 5
Joined: Tue Feb 04, 2014 8:32 pm

Re: Host USB port

Post by LaylaW »

Thank you for the response, Mike. It's a Motorola scanner to be connected to the BBB. I have a lot to learn and I'm looking for reference material on the BBB USB host port to learn how to read data from that port.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Host USB port

Post by adafruit_support_mike »

I see. In that case, what OS are you using?

The default OS for the BBB is Angstrom: a very lightweight Linux distro originally developed for cell phones. It's really good as a base OS for embedded systems with graphical interfaces, but doesn't have most of the developer-friendly stuff that other distros do.

The version of Ubuntu for the BBB is pretty well developed by now, and while it doesn't have the BoneScript IDE, it does have all the usual manpages and developer tools.

LaylaW
 
Posts: 5
Joined: Tue Feb 04, 2014 8:32 pm

Re: Host USB port

Post by LaylaW »

I'm new to Linux, so your OS comments are welcome. There will be no LCD or graphical interface for this project. The simplicity of Bonescript is attractive, but the project may be easier to implement in C++, so out with Angstrom and in with Ubuntu.

Where is host USB port support information to be found if Ubuntu is the OS?

LaylaW
 
Posts: 5
Joined: Tue Feb 04, 2014 8:32 pm

Re: Host USB port

Post by LaylaW »

Mike, the question about the OS implies that support for particular USB devices is dependent on device drivers available, no? Maybe it's really USB in general I need to study because I'm not certain how the data appears on the USB port. My assumption was that the scanner put ASCII characters on the USB port in much the same way it would put ASCII characters on an RS232 serial port so how can those characters be read from the USB port as they would be read from a serial port? Is there a reference that would tell how to interact at a low level with the USB host port as if I was writing my own device driver?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Host USB port

Post by adafruit_support_mike »

The first thing I'd suggest is to plug the device in and see if it acts like a 'keyboard shim'.. a device that sits between the keyboard and computer and injects keypress information into the input stream when it reads a barcode. If so, the effort curve will be significantly lower.

If you aren't so lucky, you'll have to look at program that can talk to the device. The cleanest description of low-level USB for Linux that I've seen lives here: http://www.lrr.in.tum.de/Par/arch/usb/u ... ode14.html

You don't have to do all the low-level work yourself though.. there's a C library called 'libusb' which handles most of the low-level protocol stuff, and leaves you the job of creating messages to send to the device, sending them, receiving replies, and deciding what the replies mean. The official reference for that lives here: http://libusb.sourceforge.net/api-1.0/

You may also need to look at the Human Interface Device (HID) protocol for USB devices. There's a good description of what's involved there at this page: http://lxr.free-electrons.com/source/Do ... t?v=2.6.34 The HID standard itself lives here: http://www.usb.org/developers/hidpage/

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”