1

Device/OS: Jetson Nano / Ubuntu 18.04

Python 3

There is a Bluetooth dongle attached.

Joy-Con is connected as seen in UI: enter image description here

As well as when I do this:

$ hcitool con
Connections:
    > ACL B8:78:26:19:C1:8C handle 11 state 1 lm MASTER AUTH ENCRYPT

and

$ bt-device -l
Added devices:
Joy-Con (R) (B8:78:26:19:C1:8C)

I've installed https://github.com/trezor/cython-hidapi from source using instructions (I tried both hidraw and libusb APIs during build.

In both cases this simple code:

import hid

devices = hid.enumerate(0, 0)
print(devices)

Prints out just my wired USB mouse and USB keyboard attached to the device:

[
{'path': b'0001:0006:00', 'vendor_id': 1118, 'product_id': 203, 'serial_number': '', 'release_number': 256, 'manufacturer_string': '', 'product_string': '', 'usage_page': 0, 'usage': 0, 'interface_number': 0},
{'path': b'0001:0004:00', 'vendor_id': 1008, 'product_id': 36, 'serial_number': '', 'release_number': 304, 'manufacturer_string': '', 'product_string': '', 'usage_page': 0, 'usage': 0, 'interface_number': 0}
]
Aleksandr Motsjonov
  • 1,230
  • 3
  • 14
  • 25

2 Answers2

0

The solution was to use udev rules. These rules worked in my case.

I also end up using a different Python library https://github.com/apmorton/pyhidapi. But I am sure the original cython-hidapi would be as fine.

Aleksandr Motsjonov
  • 1,230
  • 3
  • 14
  • 25
0

Contrary to the answer above, I wasn't able to find the joycons with cython-hidapi, even with the correct rules. For anyone having trouble with this, I recommend trying the pyhidapi library instead. Worked really well then. Also, I noticed that the rule given above wasn't picking up the joycons. That might be the case because of some system differences, or maybe because I'm using european joycons? Anyway, I modified it as given here (It still shouldn't be too broad, since it is based on the joycon device name):
KERNEL=="js0", SUBSYSTEM=="input", MODE="0666"

I found this rule also helpful in debugging, since udev rules are sometimes really finicky. It essentially creates a udev-env.txt document on the desktop if the rest of the rule picks up the device (Also, replace user with your own name, of course):
KERNEL=="js0", SUBSYSTEM=="input", RUN+="/bin/sh -c 'echo == >> /home/user/Desktop/udev-env.txt; env >> /home/user/Desktop/udev-env.txt'"

I really hope this answer can help others who were stuck like me. It took 3 full days to find the correct approach to make it work, and I wouldn't want anyone else to go through the same process.

Nicolai
  • 21
  • 5