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

Support for Android Builds #21

Open
PancreasMonster opened this issue Mar 13, 2019 · 4 comments
Open

Support for Android Builds #21

PancreasMonster opened this issue Mar 13, 2019 · 4 comments

Comments

@PancreasMonster
Copy link

Hey, first I have to say; great project, felt good to use the Joycons immediately.

However, I'm wondering if there's way I could use this on a mobile device. I have built for android and it doesn't seem to work. I don't know much about Plugins but I'm assuming this is because androids don't support the Hidapi DLL. Sorry if this is an obvious solution, but is there anyway I can use an android compatible plugin instead, and if yes, how would I go about it? Thanks.

@TheBricktop
Copy link

well there is a way to build an android part of the plugin using libusb/hidapi from their repo

@Ghostbird
Copy link

Ghostbird commented Nov 23, 2021

well there is a way to build an android part of the plugin using libusb/hidapi from their repo

Could you elaborate? I assume I must build some sort of file structure in JoyconLib_plugins?

@Ghostbird
Copy link

Ghostbird commented Nov 24, 2021

I figured it out, here's the script.

Building on Android works fine this way, however, it doesn't find any joy cons:

2021/11/24 21:18:20.117 11664 11686 Info Unity No Joy-Cons found!
2021/11/24 21:18:20.117 11664 11686 Info Unity JoyconManager:Awake()

There's no crash, and it seems HIDapi.hid_enumerate(vendor_id, 0x0) is correctly called, but no joycons are found.

@Ghostbird
Copy link

Ghostbird commented Nov 24, 2021

I'm pretty sure it's a permissions problem, I found these two messages:

2021/11/24 22:27:18.831 17242 17242 Warn UnityMain type=1400 audit(0.0:34568): avc: denied { read } for name="/" dev="tmpfs" ino=15575 scontext=u:r:untrusted_app:s0:c190,c257,c512,c768 tcontext=u:object_r:device:s0 tclass=dir permissive=0
2021/11/24 22:27:18.831 17242 17242 Warn UnityMain type=1400 audit(0.0:34569): avc: denied { read } for name="devices" dev="sysfs" ino=22806 scontext=u:r:untrusted_app:s0:c190,c257,c512,c768 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=0

UPDATE:
I've found that HIDapi.hid_init() returns -1 indicating failure when called. I've verified that the libhidapi.so and libusb1.0.so are correctly packaged in the APK by Unity.

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

3 participants