我拿起一个即将被扔掉的wii鼓组。它有一个USB端口,我想将它连接到我的macbook上进行项目。我的目标基本上是能够检测到某个鼓在设备上被敲击的时间。根据我目前收集的内容,我需要执行以下步骤:
我想我明白了如何做2和3,但我在第1步被挂了。
如果我在终端中运行“ioreg -Src IOUSBDevice”,我可以识别设备已连接,但我不知道它在哪个tty端口。 (见下面的输出)
此外,通常,是否可以从连接到USB端口的任何USB外设打印出数据流?
编辑:我应该补充一点,如果我运行“ls /dev/tty.*”,我看不到任何tty.usb项目,只有tty.bluetooth的东西。
+-o Harmonix Drum Controller for Nintendo Wii@14200000 <class IOUSBDevice, id $
| {
| "sessionID" = 2111009401078
| "iManufacturer" = 1
| "bNumConfigurations" = 1
| "idProduct" = 5
| "bcdDevice" = 4096
| "Bus Power Available" = 250
| "bMaxPacketSize0" = 64
| "USB Product Name" = "Harmonix Drum Controller for Nintendo Wii"
| "iProduct" = 2
| "iSerialNumber" = 0
| "USB Address" = 4
| "bDeviceClass" = 0
| "locationID" = 337641472
| "bDeviceSubClass" = 0
| "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| "PortNum" = 2
| "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.$
| "bDeviceProtocol" = 0
| "USB Vendor Name" = "Licensed by Nintendo of America "
| "Device Speed" = 1
| "idVendor" = 7085
| "Requested Power" = 50
| "IOGeneralInterest" = "IOCommand is not serializable"
| "Low Power Displayed" = No
| }
|
+-o IOUSBCompositeDriver <class IOUSBCompositeDriver, id 0x100000ebe, !regis$
+-o IOUSBInterface@0 <class IOUSBInterface, id 0x100000ebf, registered, matc$
+-o IOUSBHIDDriver <class IOUSBHIDDriver, id 0x100000ec2, registered, matc$
+-o IOHIDInterface <class IOHIDInterface, id 0x100000ec4, registered, ma$
+-o IOHIDLibUserClient <class IOHIDLibUserClient, id 0x100000ec5, !regis$
+-o IOHIDLibUserClient <class IOHIDLibUserClient, id 0x100000ec7, !regis$
到目前为止,
答案 0 :(得分:2)
It looks like your drum kit identifies as a HID device, not a serial port/TTY. OSX has user space HID event APIs which will let you inspect the report descriptor and capture HID reports, i.e. events. Check out IOHIDDeviceGetReportWithCallback. Alternatively, the HID transaction API might be easier to work with, as it deals with the messy business of parsing reports and descriptors for you.
答案 1 :(得分:1)
我没有您正在寻找的确切答案,但我遇到类似的问题,试图从连接到我的MacBook Pro的GPS设备读取数据。就我而言,在发出命令之后:
ioreg -w0 -l -p IOUSB
我有(剪裁不相关的部分):
+-o u-blox 7 - GPS/GNSS Receiver@14110000 <class IOUSBDevice, id 0x1000026b0, registered, matched, active, busy 0 (60 ms), retain 12>
| {
| "sessionID" = 17488341785377
| "idProduct" = 423
| "bNumConfigurations" = 1
| "iManufacturer" = 1
| "bcdDevice" = 256
| "Bus Power Available" = 250
| "bMaxPacketSize0" = 64
| "USB Product Name" = "u-blox 7 - GPS/GNSS Receiver"
| "iProduct" = 2
| "iSerialNumber" = 0
| "USB Address" = 12
| "IOUserClientClass" = "IOUSBDeviceUserClientV2"
| "bDeviceSubClass" = 0
| "bDeviceClass" = 2
| "bcdUSB" = 272
| "locationID" = 336658432
| "PortNum" = 1
| "IOCFPlugInTypes" = {"9dc7b780-9ec0-11d4-a54f-000a27052861"="IOUSBFamily.kext/Contents/PlugIns/IOUSBLib.bundle"}
| "bDeviceProtocol" = 0
| "USB Vendor Name" = "u-blox AG - www.u-blox.com"
| "Device Speed" = 1
| "idVendor" = 5446
| "Requested Power" = 50
| "IOGeneralInterest" = "IOCommand is not serializable"
| "Low Power Displayed" = No
| }
|
这并没有说明设备被分配到哪个tty.*
,因此在拔出设备之前和之后我所做的是ls /dev/tty.*
。通过这样做,我意识到终端/dev/tty.usbmodem14111
消失了。也许你的情况不会tty.usbmodem*
,但请注意14111
部分,它与我的设备的ioreg行的第一部分(u-blox 7 - GPS/GNSS Receiver@14110000
)部分重合。也许您可以在您的情况下使用此提示来查看您是否发现了tty设备。
如果您发现更“通用”的方式来发现tty
,请分享!祝你好运!