Discussion:
Programming for Serial vs. USB
(too old to reply)
Justin Robbs
2004-02-04 17:20:59 UTC
Permalink
We have a point of sale system that communicates to a number of
serial devices (upc scanner, cash drawer, customer display,
credit card/check reader, etc.). Currently, we are using a
digiboard 8 port serial board to communicate to those devices.
We access them as /dev/tty2a...h. Assuming we could get the
devices with usb interfaces, how difficult would it be to start
using a usb interface? Would it be a simple as changing to
/dev/usb0001 (I haven't worked with usb so I don't know how those
devices are defined)? I am currently running OpenServer 5.0.6,
but could go to 5.0.7 if absolutely necessary.

Obviously, this question will be difficult to answer without
looking at the code or the devices, but I am mostly interested in
knowing if there are any differences in programming for usb as
opposed to a standard serial port. Also, if certain devices
weren't available with a usb interface, would it be possible
(acceptable) to use a usb to serial adapter in the situation?

For the purposes of this discussion, I am assuming that the usb
devices send/recv the data in the same format as the standard
serial versions.

Sorry to cross post, but I'm not sure where I am most likely to
get the best info.
--
Thanks,
Justin Robbs
MIS Department
Allsup's Convenience Stores, Inc.
***@allsups.com
Hans-Bernhard Broeker
2004-02-04 18:04:12 UTC
Permalink
[Note: Missing cut-down of F'up2 done...]
Post by Justin Robbs
We have a point of sale system that communicates to a number of
serial devices (upc scanner, cash drawer, customer display, credit
card/check reader, etc.). Currently, we are using a digiboard 8
port serial board to communicate to those devices. We access them
as /dev/tty2a...h. Assuming we could get the devices with usb
interfaces, how difficult would it be to start using a usb
interface?
Not exceedingly difficult, but you will have to make substantial
modifications to the code. USB is quite a bit more than just a RS232
serial line on steroids. There's a whole stack of protocols that
comes with the raw hardware.

For starters, USB devices may not even necessarily have a device node
assigned to each of them. For that, there has to be a specialized
host-side driver to speak to interpret the data going over the USB
link. For USB-to-whatever port adapters, those will be part of your
Unix kernel with minimal luck, but not for more generic devices.
Post by Justin Robbs
weren't available with a usb interface, would it be possible
(acceptable) to use a usb to serial adapter in the situation?
If you want to keep it simple, that may actually be the best bet you
have. Beware, though: not all USB-to-serial adapters support all the
little details of serial ports. Any requirement that goes beyond Rxd,
Txd, and the basic hardware handshake lines depends on sheer luck, it
seems.
Post by Justin Robbs
For the purposes of this discussion, I am assuming that the usb
devices send/recv the data in the same format as the standard
serial versions.
I wouldn't bet on that. Not without having accessed at least some
applicable devices' datasheets.
--
Hans-Bernhard Broeker (***@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Justin Robbs
2004-02-04 18:43:39 UTC
Permalink
Post by Hans-Bernhard Broeker
[Note: Missing cut-down of F'up2 done...]
In comp.unix.programmer Justin Robbs
Post by Justin Robbs
We have a point of sale system that communicates to a number
of
Post by Hans-Bernhard Broeker
Post by Justin Robbs
serial devices (upc scanner, cash drawer, customer display,
credit
Post by Hans-Bernhard Broeker
Post by Justin Robbs
card/check reader, etc.). Currently, we are using a
digiboard 8
Post by Hans-Bernhard Broeker
Post by Justin Robbs
port serial board to communicate to those devices. We access them
as /dev/tty2a...h. Assuming we could get the devices with
usb
Post by Hans-Bernhard Broeker
Post by Justin Robbs
interfaces, how difficult would it be to start using a usb
interface?
Not exceedingly difficult, but you will have to make
substantial
Post by Hans-Bernhard Broeker
modifications to the code. USB is quite a bit more than just a RS232
serial line on steroids. There's a whole stack of protocols
that
Post by Hans-Bernhard Broeker
comes with the raw hardware.
For starters, USB devices may not even necessarily have a
device node
Post by Hans-Bernhard Broeker
assigned to each of them. For that, there has to be a
specialized
Post by Hans-Bernhard Broeker
host-side driver to speak to interpret the data going over the
USB
Post by Hans-Bernhard Broeker
link. For USB-to-whatever port adapters, those will be part of your
Unix kernel with minimal luck, but not for more generic
devices.
That is what I was afraid of. I was hoping for a simple solution
without a lot of code changes.
Post by Hans-Bernhard Broeker
Post by Justin Robbs
weren't available with a usb interface, would it be possible
(acceptable) to use a usb to serial adapter in the situation?
If you want to keep it simple, that may actually be the best
bet you
Post by Hans-Bernhard Broeker
have. Beware, though: not all USB-to-serial adapters support
all the
Post by Hans-Bernhard Broeker
little details of serial ports. Any requirement that goes
beyond Rxd,
Post by Hans-Bernhard Broeker
Txd, and the basic hardware handshake lines depends on sheer
luck, it
Post by Hans-Bernhard Broeker
seems.
Most of the devices are just send and recv data. The cash drawer
is the only exception. It looks for a signal on a specific pin
to pop the drawer. I forget the exact spec's right now.
Post by Hans-Bernhard Broeker
Post by Justin Robbs
For the purposes of this discussion, I am assuming that the
usb
Post by Hans-Bernhard Broeker
Post by Justin Robbs
devices send/recv the data in the same format as the standard
serial versions.
I wouldn't bet on that. Not without having accessed at least
some
Post by Hans-Bernhard Broeker
applicable devices' datasheets.
I just wanted to make that discussion to simplify this
discussion. I realized that I would probably need to make
changes to how the data is interpreted, but that is relatively
minor in comparison to the rest of the issues.

Thanks,
Justin

Loading...