4

I have a feature request on a project I work on, it is to integrate with a Paylife CC handheld, which has a USB connector to connect with the computer. I have the docs, and am reading up on it.

When I searched on google how to read/write to a usb device on linux, it said, use libusb.

I was wondering, is there another possibility? Can't I just open it like a file and write a stream to it, and read a stream from it?

I don't actually need to do anything fancy. I just need to write a string of control codes to the device, and it would be mildly nice to read back the ACK and Error codes. But since those are already displayed on the device screen, I don't have to do much with it, just deliver the total required for payment.

So my question is, what are my options?

The connected computer is a regular ol ubuntu linux box.

J. Martin
  • 1,683
  • 2
  • 17
  • 33
  • Does it comes with a driver? If so, you may search the documentation of the system. – crazyjul Oct 12 '11 at 14:33
  • No, it doesn't come with anything but a few .pdfs that cover every possible scenario that could be imagined, so it's a bit overwhelming. Doesn't help that they are exclusively in german, which I don't speak :) God I love being a software engineer. – J. Martin Oct 12 '11 at 15:40

1 Answers1

2

It is definitely possible when the device complies with one of the USB device classes -- drivers for them are universal.

If that's not the case, then you may stick with a manufacturer-provided or a third-party driver, given there is one and you possess enough of it's documentation.

If that's also not the case, libusb-1.0 is your resort, unless you want to write a kernel driver youself :)

vines
  • 5,160
  • 1
  • 27
  • 49
  • I wasn't provided with any drivers, and it seems that the documentation doesn't even indicate that it has USB, It claims RS232, but it only has a USB port...I will get the device physically in 2 hours, and pray that it works like a USB printer and I can just write to it. Otherwise, I'll have to call the company and find out... – J. Martin Oct 12 '11 at 15:39
  • 3
    It may create a com interface through usb. Search your kernel logs when you connect the device. It may log the created com port files – crazyjul Oct 12 '11 at 15:47
  • 2
    Point of Sales terminals are almost universally RS232, so you can expect that this will be serial-over-USB. – MSalters Oct 12 '11 at 22:44
  • 1
    Yeah, serial-over-USB is a frequent case, it's handled by kernel as [communications class](http://en.wikipedia.org/wiki/USB_communications_device_class). If so, you'll end up having just a TTY. – vines Oct 13 '11 at 00:43
  • That's essentially what ended up happening, of course, now the issue is dealing with Serial->USB converters. For some reason, the one that I have tends to stop working after a bit, and I have to unplug and replug it. – J. Martin Jan 20 '12 at 06:27