Web应用程序需要与串口通信

发布于 2025-01-07 23:36:08 字数 343 浏览 0 评论 0原文

我正在编写一个需要访问串行端口(它是信用卡读卡器)的应用程序。我希望能够读取和写入端口。以下内容似乎可以让我做到这一点: http://www. activexperts.com/serial-port-component/howto/html/。然而,这涉及 ActiveX/COM,这意味着我与 Windows 绑定在一起。

对我来说还有更好的解决方案吗?如果该解决方案能够在多个平台上运行,而不仅仅是 Windows,那就太好了。

我正在使用 PHP。

I'm writing an application that needs access to a serial port (it's a credit card reader). I'd like to be able to read and write to the port. The following seems like it would let me do exactly that: http://www.activexperts.com/serial-port-component/howto/html/. However, this deals with ActiveX/COM which means I'm tied to Windows.

Any better solutions for me? Would be nice if the solution would work on multiple platforms, not just Windows.

I'm using PHP.

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

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

发布评论

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

评论(1

瞎闹 2025-01-14 23:36:08

该设备是否模拟键盘?如果是这种情况,最好让用户将光标定位在文本框中(或以编程方式将光标放在那里)并刷卡。

我花了很多时间用 C 语言为 Magtek Mini-Mag 编写用户空间驱动程序读卡器几年后才意识到它的学术意义比什么都重要。我的意思是,我们使用了代码,只有当我们使用键盘解决方案时,才会有大量的时间专注于其他事情。

对于 Mini-Mag,内核中的 USB/HID 支持 会识别该设备,希望您获得的设备有类似的东西。

此外,Windows 有自己的 USB/HID 变体,因此“将其视为键盘”解决方案对于以这种方式运行的设备来说几乎是开箱即用的。

Does the device emulate a keyboard? You'd be much better off getting the user to position the cursor inside a textbox (or putting the cursor there programmatically) and swiping the card if that's the case.

I spent a lot of time writing a userspace driver in C for a Magtek Mini-Mag card reader only to realize years later that it was academic more than anything. I mean we used the code, only if we'd have gone with the keyboard solution there would have been tons of time to focus on other things.

For the Mini-Mag the USB/HID support in the kernel would recognize the device, hopefully there's something similar for the device you're getting.

Also, Windows has it's own variant of USB/HID so the 'treat it as a keyboard' solution works pretty much out of the box for devices that act that way.

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