Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Linux Support? #43

Open
ghost opened this issue Oct 15, 2020 · 4 comments
Open

Linux Support? #43

ghost opened this issue Oct 15, 2020 · 4 comments

Comments

@ghost
Copy link

ghost commented Oct 15, 2020

Hi! I'm looking to add linux support to this library. I've downloaded and built HIDAPI from this GitHub repo but I was left with multiple files, none of which were simply named "hidapi" like the windows and mac versions in this repo's plugins folder.

The files created are:
libhidapi-hidraw.a
libhidapi-hidraw.la
libhidapi-hidraw.so
libhidapi-hidraw.so.0
libhidapi-hidraw.so.0.0.0
libhidapi-libusb.a
libhidapi-libusb.la
libhidapi-libusb.so
libhidapi-libusb.so.0
libhidapi-libusb.so.0.0.0

Also, I'd like some help knowing what to do once I've selected the right file.

Thank you! :)

@Ghostbird
Copy link

Ghostbird commented Nov 24, 2021

What I did, is:
sudo apt-get install libhidapi-libusb0
Then in the JoyconLib_plugins folder I did:
ln -s /usr/lib/x86_64-linux-gnu/libhidapi-libusb.so libhidapi.so
That made it build, however, my Joycons are still not enumerated.

The reason why you have the differently named files is that many linux distros supply two variants of libhidapi. One that does low-level access through libusb (the method used in this repository) and one that does low-level access through libhidraw.

In my case adding libhidapi-hidraw.so doesn't work at all and Unity complains that it cannot find the library.

@Ghostbird
Copy link

Ghostbird commented Dec 13, 2021

I reread some related stuff, and I found an interesting mention:

Linux/FreeBSD/libusb (libusb/hid.c):

This back-end uses libusb-1.0 to communicate directly to a USB device. This back-end will of course not work with Bluetooth devices.

So it seems that we must use libhidraw as back-end on Linux/Android to get it to work, however, when I tried that, it doesn't see to work at all with the JoyconLib unity code.

@ZhQriks
Copy link

ZhQriks commented Feb 11, 2023

libhidraw as back-

Did you tackled it?

@Ghostbird
Copy link

Ghostbird commented Feb 14, 2023

I delved some more into this, and managed to get a successful Android build but I ran into issues where Android provides no way to give permissions to the low-level device data. I could do it on my rooted device, but it's not useful when building a game. So this isn't really useful for Android. I didn't look further into supporting desktop Linux as my use-case was Android only.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants