将数据写入USB设备

发布于 2025-01-06 11:12:52 字数 147 浏览 5 评论 0 原文

我需要向连接到 USB 端口的设备(现金抽屉)发送一些命令以打开抽屉。该设备可能来自不同的供应商和制造商,因此我需要一种通用的机制来写入设备,就像写入串行端口一样。我可以使用 LibUsb win32 来实现它,如果可以的话,有两个东西过滤驱动程序和设备驱动程序我应该使用哪一个?

I have a requirement to send some commands to a device(Cash drawer) connected to the USB port to open the drawer. The device may be from different vendors and manufacturers, so i need a common mechanism to write to the devices just like writing to serial port. Can i use LibUsb win32 to achieve it, if so there are two things Filter driver and device driver which one should i use?

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

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

发布评论

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

评论(1

柠檬心 2025-01-13 11:12:52

我已经使用 WPD 成功完成了此操作(不适合新手)。也许并不适合所有场景,但这无疑是一个好的开始。我猜想有一个“打开设备”的标准命令。一些 WPD 命令此处

否则,我将使用 busdog 对打开抽屉所需的设备命令进行逆向工程,并尝试编写使用 CreateFileWriteFile API。

I've successfully done this using WPD (not for newbies). Perhaps not suitable for all scenarios, but it certainly is a good start. I would guess that there is a standard command to 'open device'. Some WPD commands here.

Otherwise I would reverse-engineer the device command needed to open the drawer using busdog and try to write this command to the USB device using the CreateFile and WriteFile APIs.

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