tags:

views:

513

answers:

3

Hello,

First of all a statement: I'm a newbie when it comes to programming for the Mac. However I have an assignment which requires USB communication with a device so I thought I'll start with something basic.

I took the code from here, built it and ran it from the Terminal. It starts up and writes:

Looking for devices matching vendor ID=1351 and product ID=8193.
Starting run loop.

However after this, if I plug in and out USB devices (I tried: iPod, GPS, mouse) nothing gets written on the screen, although as much as I understand there should be whenever I connect and disconnect a device.

What am I doing wrong?

Thanks in advance.

+2  A: 

This sample code watches only devices matching the hard coded values vendor ID=1351 and product ID=8193.

If you want to watch for another device in particular, you have to pass the vendor and product ID as arguments to the command line.

Thomas
Thanks. I've commented out the two CFDictionarySetValue-s and now the program show all devices as they are connected / disconnected.
kitsched
+1  A: 

You can also use system_profiler SPUSBDataType on a terminal

Niko
+1  A: 

I found /Developer/Applications/Utilities/USB Prober to be of great use.

petergassner