I picked up a wii drumset that was about to get thrown away. It has a USB port and I want to connect it to my macbook for a project. My goal is basically to be able to detect when a certain drum has been tapped on the device. Based on what I've gathered so far, I need to do the following steps:
I think I understand how to do 2 and 3, but am getting hung up on step 1.
If I run "ioreg -Src IOUSBDevice" in terminal, I can identify that the device is connected, but I don't know which tty port it is on. (see below for output)
Additionally, in general, is it possible to print out data as a stream of bytes from any usb peripheral connected to a usb port?
EDIT: I should add that if I run "ls /dev/tty.* ", I don't see any tty.usb items, only tty.bluetooth stuff.
+-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$
So far,
I do not have the exact answer that you are looking for, but I ran with a similar problem trying to read data from a GPS device connected to my MacBook Pro. In my case, after issuing the command:
ioreg -w0 -l -p IOUSB
I've got (clipping not relevant parts):
+-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
| }
|
This does not tell much on which tty.*
the device is allocated so what I did is an ls /dev/tty.*
before and after unplugging the device. By doing so, I realized that the terminal /dev/tty.usbmodem14111
disappeared. Maybe you will not have tty.usbmodem*
in your case, but note the 14111
part, which partially coincides with the first part of the ioreg line for my device (u-blox 7 - GPS/GNSS Receiver@14110000
). Maybe you can use this hint in your case to see if you discover the tty device.
If you find a more "generic" way to discover the tty
, please share it! Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With