3

I am having big trouble to communicate through USB, from a Mac to an external HID device. The hardware has been proven fine when running under the Windows XP platform, but I can't find a GOOD exemple of programming the HID with Cocoa / objective-C. Several exemples are available in the Apple center, but they are either poorly documented, or too much complex ( in term of software with mixed objective-C and C, making the file difficult to understand), or not up to date. Well, I must say that I am more an hardware electronic engineer than a software specialist ! So far, I can enumerate the USB port, identify my device using the HID Apple's tools ( I read PID and VID ), but I miserably fail to send a report and/or to read a report back from the external device. I would certainelly appreciate if one of you has used the new Apple's HID API and can share some know how. On the other hand, is there any "USB spy" tool operating with the Apple's OSX ? Thank you so much for your help

Michael

4

2 回答 2

1

您不会为 HID 找到 Objective-c 接口。至少,只不过是一个包装。由于动态绑定和延迟消息传递,Objective-c 很不适合编写时间相关的任务,如设备驱动程序或与之通信。你将不得不在 C 中工作。

Apple 资源:从应用程序访问硬件HID 类设备接口指南将是您最好的资源。该技术说明也提供了很好的概述。

Apple 系统分析器将扫描您的 USB 链,以查看硬件本身可以看到哪些设备。

编辑01:

不敢相信我忘记了/Developer/Applications/Utilities/IORegistryExplorer.它为您提供了整个硬件树的详细细分。

于 2009-12-03T21:00:41.783 回答
1

所以是的,你将不得不潜入并编写 C 而不是 Objective-C 来做你的事情。

幸运的是,还有一个额外的 Apple 资源可以让 USB/HID 管理器变得更加容易。

请参阅Apple 的 HID Utilities 示例/库

于 2009-12-03T22:37:16.577 回答