Poohl / joycontrol

Emulate Nintendo Switch Controllers over Bluetooth
GNU General Public License v3.0
302 stars 66 forks source link

libhidapi-hidraw0 disturbing connection.... #17

Open okushogg opened 2 years ago

okushogg commented 2 years ago

Traceback (most recent call last): File "/usr/local/bin/joycontrol-pluginloader", line 5, in from JoycontrolPlugin.loader import main File "/usr/local/lib/python3.8/dist-packages/JoycontrolPlugin/init.py", line 1, in from JoycontrolPlugin.commands import JoycontrolCommands File "/usr/local/lib/python3.8/dist-packages/JoycontrolPlugin/commands.py", line 5, in from joycontrol.controller_state import button_push, button_press, button_release File "/usr/local/lib/python3.8/dist-packages/joycontrol/controller_state.py", line 3, in from joycontrol import utils File "/usr/local/lib/python3.8/dist-packages/joycontrol/utils.py", line 5, in import hid File "/usr/local/lib/python3.8/dist-packages/hid/init.py", line 83, in hidapi.hid_get_input_report.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t] File "/usr/lib/python3.8/ctypes/init.py", line 386, in getattr func = self.getitem(name) File "/usr/lib/python3.8/ctypes/init.py", line 391, in getitem func = self._FuncPtr((name_or_ordinal, self)) AttributeError: /lib/x86_64-linux-gnu/libhidapi-hidraw.so.0: undefined symbol: hid_get_input_report

Can anyone solve this problem plz??

EggEngineer commented 2 years ago

Having the same, if not, very similar issue with libhidapi-hidraw.so.0; reinstalling the shared library did not help nor rebooting the PC. Seems it's something either in the setup that went funky or somewhere along the lines there's a corrupt file. Maybe try the no-pair (changes are different in the ExecStart) mode. It is experimental however, so do be warned.

Here's my crash log:

File "run_controller_cli.py", line 11, in <module> from joycontrol import logging_default as log, utils File "/home/b567/jctrl/joycontrol/utils.py", line 5, in <module> import hid File "/usr/local/lib/python3.8/dist-packages/hid/__init__.py", line 83, in <module> hidapi.hid_get_input_report.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t] File "/usr/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__ func = self.__getitem__(name) File "/usr/lib/python3.8/ctypes/__init__.py", line 391, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: /lib/x86_64-linux-gnu/libhidapi-hidraw.so.0: undefined symbol: hid_get_input_report

Wonder what could be the issue with this specific shared library file that we're both having...

allenz92 commented 2 years ago

Traceback (most recent call last): File "/usr/local/bin/joycontrol-pluginloader", line 5, in from JoycontrolPlugin.loader import main File "/usr/local/lib/python3.8/dist-packages/JoycontrolPlugin/init.py", line 1, in from JoycontrolPlugin.commands import JoycontrolCommands File "/usr/local/lib/python3.8/dist-packages/JoycontrolPlugin/commands.py", line 5, in from joycontrol.controller_state import button_push, button_press, button_release File "/usr/local/lib/python3.8/dist-packages/joycontrol/controller_state.py", line 3, in from joycontrol import utils File "/usr/local/lib/python3.8/dist-packages/joycontrol/utils.py", line 5, in import hid File "/usr/local/lib/python3.8/dist-packages/hid/init.py", line 83, in hidapi.hid_get_input_report.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t] File "/usr/lib/python3.8/ctypes/init.py", line 386, in getattr func = self.getitem(name) File "/usr/lib/python3.8/ctypes/init.py", line 391, in getitem func = self._FuncPtr((name_or_ordinal, self)) AttributeError: /lib/x86_64-linux-gnu/libhidapi-hidraw.so.0: undefined symbol: hid_get_input_report

Can anyone solve this problem plz??

Have you find out how to solve this? I have the same issue with Raspbian 4B.

okushogg commented 2 years ago

Just for First Aid. I did change the version of hid into "1.0.4" .

pip install hid==1.0.4

But it is not a fundamental solution...

Larkas commented 2 years ago

It seems that this is a problem with libhidapi-hidraw0 specifically. When I try to import it in python, it throws this error: >>> import hid Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.8/dist-packages/hid/__init__.py", line 83, in <module> hidapi.hid_get_input_report.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t] File "/usr/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__ func = self.__getitem__(name) File "/usr/lib/python3.8/ctypes/__init__.py", line 391, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: /lib/x86_64-linux-gnu/libhidapi-hidraw.so.0: undefined symbol: hid_get_input_report @okushogg has a working workaround, it seems, but, as they said, it's not a real fix.

darrenchang commented 2 years ago

Hi, it's possible that you have an old libhidapi-hidraw version installed. I think Ubuntu 20.04 has versoin 0.8.0..., while 22.04 has a newer libhidapi version that doesn't cause this issue with hid_get_input_report.

My solution to this problem is to compile my own libhidapi-hidraw.so.0 file from the source.

Here is how I did it:

  1. Install build tools if you don't already have them

    apt-get update; \
    apt-get install -y \
    build-essential \
    libudev-dev \
    libusb-1.0-0-dev;
  2. Compile the file libhidapi-hidraw.so.0 and install it (put it where it needs to be). If you are on a different architecture than ARMv6, make sure to change the part of the dir path arm-linux-gnueabihf to match your architecture.

    git clone --branch hidapi-0.11.2 https://github.com/libusb/hidapi.git; \
    (cd hidapi/linux/; \
    make -f Makefile-manual; \
    cp libhidapi-hidraw.so /usr/lib/arm-linux-gnueabihf/libhidapi-hidraw.so.0;); \
    rm -r hidapi;)
mjlhcf commented 2 years ago

Having the same, if not, very similar issue with libhidapi-hidraw.so.0; reinstalling the shared library did not help nor rebooting the PC. Seems it's something either in the setup that went funky or somewhere along the lines there's a corrupt file. Maybe try the no-pair (changes are different in the ExecStart) mode. It is experimental however, so do be warned.

Here's my crash log:

File "run_controller_cli.py", line 11, in <module> from joycontrol import logging_default as log, utils File "/home/b567/jctrl/joycontrol/utils.py", line 5, in <module> import hid File "/usr/local/lib/python3.8/dist-packages/hid/__init__.py", line 83, in <module> hidapi.hid_get_input_report.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t] File "/usr/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__ func = self.__getitem__(name) File "/usr/lib/python3.8/ctypes/__init__.py", line 391, in __getitem__ func = self._FuncPtr((name_or_ordinal, self)) AttributeError: /lib/x86_64-linux-gnu/libhidapi-hidraw.so.0: undefined symbol: hid_get_input_report

Wonder what could be the issue with this specific shared library file that we're both having...

I have the same problem, the error code is exactly the same, how did you solve it, please?

Cryspia commented 2 years ago

hid 1.0.5 introduced the new symbol that is not yet supported by the old dynamic library. Try:

pip uninstall hid
pip install hid==1.0.4
HunterBoy344 commented 2 years ago

@Cryspia This did not solve the problem and I am getting the same error

yoyotam3 commented 2 years ago

None of these solutions seem to work for me EDIT: nevermind it worked after rebooting

themarpe commented 2 years ago

Might make sense relying on hidapi package from trezor instead - it packages the hidapi library in the wheels, so there won't be any discrepancy between system and python libs.

(Just went through the whole hurdle with this as well, for another library. One issue is that both hid & hidapi packages have the same import hid)