Dectecting SpaceMouse Wireless Receiver via PyUSB

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

Moderator: Moderators

Post Reply
dcrb
Posts: 5
Joined: Mon Apr 12, 2021 6:56 am

Dectecting SpaceMouse Wireless Receiver via PyUSB

Post by dcrb »

Hello there,

I'm currently working on an application that relies on a SpaceMouse Wireless.
I've developped a code in python to read and send the SpacMouse info to another device. I've managed to have it work with a SpaceNavigator. Now I would like to make it work with the SpaceMouse Wireless but I'm unable to as when I try to "choose" the receiver, there are 7 of them and the program will simply choose the first, while the one (and only) who receives data is the 3rd our 4th one. Any suggestions?

Image

Thanks in advance,
ngomes
Moderator
Moderator
Posts: 3318
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Dectecting SpaceMouse Wireless Receiver via PyUSB

Post by ngomes »

Hi dcrb,
dcrb wrote: Mon Apr 12, 2021 7:01 am Any suggestions?
The Universal Receiver (UR) can pair up to five wireless devices, each on a separate USB interface.

Within each interface, you will find a set of top-level collections (as per the HID specification; these are also known as "application collections"). There's one top-level collection if the interface has no pairing, two if the pairing is for a SpaceMouse and three for a CadMouse type. You're interested in the second case.

The two top-level collections (all in the "generic" desktop usage page) consist of a "multi-axis controller" usage collection (ID 0x08) and a "vendor-defined" collection. You want to use the former.
dcrb
Posts: 5
Joined: Mon Apr 12, 2021 6:56 am

Re: Dectecting SpaceMouse Wireless Receiver via PyUSB

Post by dcrb »

Hello ngomes,

Thanks for your reply. I'm quite new to this and I don't understand much of USB HIDs.

For the SpaceMouse wireless cabled, I use the following line to select it, which works perfectly since there's only one HID:
dev = usb.core.find(idVendor=0x256f, idProduct=0xc62e) #SpaceMouse Wireless (Cabled)

I've read your answer and thought about it but I'm still stuck. How can I do the equivalent to that line of code for the SpaceMouse while using the wireless receiver? (as if I just replace the idProduct by the UR one, it won't work since it will select the first that doesn't get data)
ngomes
Moderator
Moderator
Posts: 3318
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Dectecting SpaceMouse Wireless Receiver via PyUSB

Post by ngomes »

dcrb wrote: Tue Apr 13, 2021 7:40 am How can I do the equivalent to that line of code for the SpaceMouse while using the wireless receiver? (as if I just replace the idProduct by the UR one, it won't work since it will select the first that doesn't get data)
What Python library are you using? Have you look into examples of accessing devices with multiple USB interfaces?
dcrb
Posts: 5
Joined: Mon Apr 12, 2021 6:56 am

Re: Dectecting SpaceMouse Wireless Receiver via PyUSB

Post by dcrb »

I'm using pyUSB. I've tried to check such examples but haven't found anything that helped solve my issue so far
ngomes
Moderator
Moderator
Posts: 3318
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Dectecting SpaceMouse Wireless Receiver via PyUSB

Post by ngomes »

dcrb wrote: Tue Apr 13, 2021 8:45 am I'm using pyUSB.
I'm not familiar with Python libraries used to access USB devices. Have you tried reaching out to the PyUSB developers or other users of the library?
dcrb
Posts: 5
Joined: Mon Apr 12, 2021 6:56 am

Re: Dectecting SpaceMouse Wireless Receiver via PyUSB

Post by dcrb »

I haven't. Since I could deal with the SpaceMouse wired but not with the wireless receive, I figured I'd rather ask here.
I will try to figure it out and consult with PyUSB developpers with the information you've gave me about the interfaces and collections a few days ago.

Thank you for your time and cooperation. I'll gladly share here if I find a workaround.
ngomes
Moderator
Moderator
Posts: 3318
Joined: Mon Nov 27, 2006 7:22 am
Contact:

Re: Dectecting SpaceMouse Wireless Receiver via PyUSB

Post by ngomes »

dcrb wrote: Thu Apr 15, 2021 7:21 am I'll gladly share here if I find a workaround.
Yes, please. I think others will certainly benefit if you demonstrate how to access a SpaceMouse connected over a Universal Receiver in a Python program.
jwick
Moderator
Moderator
Posts: 3328
Joined: Wed Dec 20, 2006 2:25 pm
Location: USA
Contact:

Re: Dectecting SpaceMouse Wireless Receiver via PyUSB

Post by jwick »

I'd like to see that code too.
Then I wouldn't have to chase my remote control tank connected via the USB cable!
(The SpaceMouse makes a great tank controller - and if you connect the tank camera to the device LCD you can see where it is going...)
Post Reply