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

编程入门 行业动态 更新时间:2024-10-25 13:17:38
本文介绍了Web应用程序需要与串行端口通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在编写一个需要访问串行端口的应用程序(这是一个信用卡读取器)。我希望能够读写该端口。以下内容似乎可以让我确切地做到这一点: http:// www。 activexperts/serial-port-component/howto/html/ 。但是,这与ActiveX / COM结合使用,这意味着我与Windows紧密联系。

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: www.activexperts/serial-port-component/howto/html/. However, this deals with ActiveX/COM which means I'm tied to Windows.

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

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

我正在使用PHP。

推荐答案

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

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花了很多时间在C中为 Magtek Mini-Mag 卡编写用户空间驱动程序读者几年后才意识到,它比学术更重要。我的意思是我们使用了代码,只有在使用键盘解决方案的情况下,才会有大量的时间专注于其他事情。

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.

对于Mini- Mag内核中的 USB / HID支持可以识别设备,希望

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.

此外,Windows拥有自己的USB / HID变体,因此将其当作键盘使用解决方案非常有效开箱即用的设备可以实现这种功能。

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.

更多推荐

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

本文发布于:2023-11-16 02:38:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1600248.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:端口   应用程序   通信   Web

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!