我还需要 libusb 吗?

发布于 2024-12-09 14:16:24 字数 348 浏览 3 评论 0原文

我对我从事的一个项目有一个功能请求,它是与 Paylife CC 手持设备集成,该手持设备具有 USB 连接器可与计算机连接。我有文档,正在阅读它。

当我在谷歌上搜索如何在Linux上读取/写入USB设备时,它说,使用libusb。

我想知道,是否还有另一种可能?我不能像打开文件一样打开它并向其中写入流,然后从中读取流吗?

我其实不需要做任何花哨的事情。我只需要向设备写入一串控制代码,并且读回 ACK 和错误代码会稍微好一些。但由于这些已经显示在设备屏幕上,我不必做太多事情,只需提供付款所需的总额即可。

所以我的问题是,我有什么选择?

连接的计算机是普通的 ol ubuntu linux 盒子。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

古镇旧梦 2024-12-16 14:16:24

当设备符合 USB 设备类之一(以下驱动程序)时,这绝对是可能的它们是普遍的。

如果情况并非如此,那么您可以坚持使用制造商提供的驱动程序或第三方驱动程序,因为有这样的驱动程序并且您拥有足够的文档。

如果情况并非如此,libusb-1.0 就是你的选择,除非你想写自己一个内核驱动程序:)

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文