我正在编写一个需要访问串行端口的应用程序(这是一个信用卡读取器)。我希望能够读写该端口。以下内容似乎可以让我确切地做到这一点: 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应用程序需要与串行端口通信
发布评论