J. Martin
J. Martin

Reputation: 1737

Do I even need libusb?

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.

Upvotes: 4

Views: 1317

Answers (1)

vines
vines

Reputation: 5225

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 :)

Upvotes: 2

Related Questions