Device ID explanation

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

Moderator: Moderators

Post Reply
Posts: 2
Joined: Tue Jan 05, 2016 2:59 am

Device ID explanation

Post by tpg » Wed Aug 03, 2016 2:09 am

Please help me understand the value of DevID in SiOpen()
I can't find any specific documentation of its value in the SDK docs.
My motivation is to enumerate all devices connected to the system, and I assume that I must call SiOpen for device IDs 1..SiGetNumDevices. Is that correct?
At least that works for DevID = 1 when I have 1 device inserted.
I know I can use SI_ANY_DEVICE in SiOpen, but I specifically need to discover all devices in the system and initialize them.

As a sub question, I am wondering what happens to DevID when a device is removed and then reinserted. Both during my app runtime, and when my app is not running.
What's the algorithm that decides which physical device gets a specific DevID?

I could of course do my own testing, but I'd like to have an 'official' statement about this.


Posts: 2804
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA

Re: Device ID explanation

Post by jwick » Fri Aug 05, 2016 7:26 am

Those are just indexes into the devices as enumerated by the system. A convenient way to refer to them.
If the same device comes and goes on the same port while the driver is running it will stay at the same index. If another device arrives in the meantime the order will change.

It is best though to respond to a DeviceChange event (which you always also get on devID 0) by closing and reopening everything.

If you want to find out the details of where the device is attached, there is a SiGetPortName or something like that. You need that name to call SiOpenPort.

If you use SI_ANY_DEVICE then the driver folds all the data from every device into that one connection.

You want to be very careful about programming for specific devices. A customer can buy any device he wants. And new devices are introduced regularly. Specifically, you want to program for the generic button events, V3DCMDs. Any device can generate those and users can move them around. E.g., you don't want to be responding to the 5th button on a device.

Since users can plug and unplug devices at any time, you want to just respond to the DeviceChange events. If there is nothing attached when you start, no problem. If it comes along later, no problem. If they all disappear, no problem.

Post Reply