通过 USB 端口从打印机读取信息

发布于 2024-09-04 10:46:29 字数 99 浏览 7 评论 0原文

在并行打印机时代,人们曾经能够在 LPT1 上发送命令并接收返回的标准信息,例如寿命计数等。

现在,使用 USB 设备,我们是否失去了这种功能?或者还有办法读取信息吗?

In the days of parallel printers one used to be able to send a command on LPT1 and receive back standard info such as life count etc.

Now, with USB devices, have we lost that capability? Or is there still a way to read the info?

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

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

发布评论

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

评论(1

忱杏 2024-09-11 10:46:29

我假设你的问题是以 Windows 为中心的。在某些设备上,制造商(例如 Epson 和 Star)提供实用程序,使您可以将设备作为“传统串行”接口进行访问。它仍然是 USB,但该软件为您提供了一个可以与之通信的虚拟串行端口。我一直在进行一些挖掘,试图找出低级驱动程序公开了哪些功能,但运气不佳,因为 Windows 驱动程序确实不是我的强项。

在 Windows 打印机中,您可以从各种端口中进行选择。对于并行和串行,您可以将它们打开为 \.\LPT1 或 \.\COM1 等,并以这种方式获得双向行为。但对于 USB,端口通常是 USB001,并且尝试打开 \.\USB001 似乎不起作用。如果您能准确地弄清楚要打开什么名称,这种方法可能会起作用。但是,如果您在 winobj 中看到的信息可以作为依据,那么该名称中可能会包含一个又大又难看的 GUID...

如果您想出任何更好的答案,请告诉我!

I assume your question is Windows centric. On some devices the manufacturer (like Epson and Star for example) provide utilities that let you access the device as a 'legacy serial' interface. It's still USB but the software gives you a virtual serial port you can talk to it with. I've been doing some digging trying to figure out what features are exposed by the low level drivers, but haven't had much luck there as Windows drivers really aren't my forte.

In the windows printers you get to select from a variety of ports. For parallel and serial you can open them as \.\LPT1 or \.\COM1 etc and get bi-directional behaviour that way. But for USB the ports are often USB001, and trying to open \.\USB001 for example doesn't seem to work. Such an approach might work, if you can figure out exactly what name to open. But that name will probably have a big ugly GUID in it if the information you see in winobj is anything to go by...

If you come up with any better answers please let me know!

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