How to fetch the USB address in the add/remove callbacks

Post questions, comments and feedback to our 3Dconnexion Mac Development Team.

Moderator: Moderators

Post Reply
superbigio
Posts: 18
Joined: Thu Jan 25, 2007 1:11 pm
Location: Los Angeles

How to fetch the USB address in the add/remove callbacks

Post by superbigio » Mon May 16, 2011 7:51 am

Hi there,

I am writing a driver for the Space Navigator for Notebooks that supports multiple devices.
I am programming on Mac OS X 10.6.7, Xcode 4.

I need a way to get the device USB address as soon as a 3Dconnexion device is plugged in the USB port.
I registered a "device added" and a "device removed" notification callback as follows:

err = InstallConnexionHandlers(tdx_message_handler,
tdx_add_device_handler,
tdx_remove_device_handler);

Now, my tdx_add_device_handler() callback is prototyped as follows:
void tdx_add_device_handler(io_connect_t connection);

So my question is:
I need to know the USB address as soon as a device is plugged in, so that then I can match its USB address when I get the whole device state struct in the tdx_message_handler() callback.
Is it possible to get the USB device address from the io_connect_t argument that I get passed in the "device added" callback ?

I made several attempts using the facilities provided by the IOKit framework, but they were all unsuccessful.

Any ideas ?

Thank a lot.

- Luigi Castelli

Post Reply