tocoteron / joycon-python

driver for Joy-Con (Nintendo Switch)
Other
116 stars 27 forks source link

unable to get joycon status #23

Open bldintheplacetobe opened 3 years ago

bldintheplacetobe commented 3 years ago

Hi,

This is probably a basic question, but I'm struggling to get status from my joycon. I have a joycon (purple) connected to a pi with bluetooth. It shows connected in the pi gui, however the joycon's flashing lights continue to flash from left to right continuously

When I run the basic commands listed to get status, I'm getting an invalid vendor error as follows:

from pyjoycon import JoyCon, get_R_id joycon_id = get_R_id() joycon = JoyCon(*joycon_id) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.7/dist-packages/pyjoycon/joycon.py", line 25, in init raise ValueError(f'vendor_id is invalid: {vendor_id!r}') ValueError: vendor_id is invalid: None

What have I missed?

Thanks!

pbsds commented 3 years ago

The lights won't change until you instruct them to change.

What is the output of get_R_id() ? Have you tried get_L_id? If none of them return any devices, ensure you can see the joycon with a separate tool such as lshid. you may need to run as root to access hid devices.

gdcgunther4 commented 3 years ago

I have the same problem on the same setup (just knockoff joycons). I ran the status program with sudo, but I got the same message. I tried using lshid, and it showed up, but I get the same error message. I made the udev rules like the readme said. Do I need to change the rules?

Thanks

krzysztofkrzeslak commented 2 years ago

In case someone will experience the same problem I have some tips as I also struggled a long time to make it work.

  1. use hid instead of hidapi: pip3 install hid
  2. use udev rules from here
  3. not sure if this if required but I also added such line to udev rules KERNEL=="js0", SUBSYSTEM=="input", MODE="0666"
  4. (!) Most important I think, hid library is using system libhidapi-hidraw0 and you can encounter message like no such symbol get_hid_report() or something like that, so you're probably using ubuntu 18.04 where default version of this lib is actually not containing this function, so to fix that: sudo apt remove libhidapi-hidraw0 wget http://archive.ubuntu.com/ubuntu/pool/universe/h/hidapi/libhidapi-hidraw0_0.10.1+dfsg-1_amd64.deb sudo dpkg -i libhidapi-hidraw0_0.10.1+dfsg-1_amd64.deb