Mac Snow Leopard 上的 USBPrivateDataSample

发布于 2024-11-27 14:23:14 字数 702 浏览 3 评论 0 原文

我需要创建每次插入或拔出 USB 时都会收到通知的应用程序,并且还可以访问它。首先,我尝试使用 USBPrivateDataSample 应用程序作为示例:

http://developer.apple.com/library/mac/#samplecode/USBPrivateDataSample/Listings/USBPrivateDataSample_c.html#//apple_ref/doc/uid/DTS10000456-USBPrivateDataSample_c-DontLinkElementID_4

按顺序为了编译它,我将 SDK 更改为 10.6,因为 Snow 不支持 10.4 豹。 该程序已编译并成功运行,但是,插入 USB 时我没有收到调用/事件。换句话说,函数 DeviceAdded 从未被调用。

这个程序应该可以在 Snow 中运行吗?它看起来很旧,也许有些调用已被弃用?

有人可以建议其他方式来接收 USB 设备通知吗?

谢谢!

I need to create application that get notified each time I plug or unplug USB, and also can get access to it. For start, I tried to use USBPrivateDataSample application as example:

http://developer.apple.com/library/mac/#samplecode/USBPrivateDataSample/Listings/USBPrivateDataSample_c.html#//apple_ref/doc/uid/DTS10000456-USBPrivateDataSample_c-DontLinkElementID_4

In order to compile it I changed SDK to 10.6 since 10.4 is not supported on Snow Leopard.
The program is compiled and runs successfully, however, I do not receive calls/events when the USB is plugged in. In other words, function DeviceAdded is never called.

Does this program supposed to work in Snow anyway? It looks old, maybe some calls are deprecated?

Can someone suggest other way to receive USB devices notifications?

Thanks!

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

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

发布评论

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

评论(1

澉约 2024-12-04 14:23:14

该示例应在 10.6 上运行,您可能需要通过删除 kUSBProductIDkUSBVendorID 匹配字典条目来修改匹配字典以匹配所有设备,或者将它们设置为匹配您的设备,您还可以使用不同的匹配标准(请参阅 qa1076 对于那些)。

The sample should work on 10.6, You may need to modify the matching dictionary to either match all devices by removing the kUSBProductID and kUSBVendorID matching dictionary entries, or set these to match your device, you can also use different matching criteria (see qa1076 for those).

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