Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to use hid in kivy python mobile application #449

Open
lakshyacis opened this issue Dec 9, 2019 · 7 comments
Open

unable to use hid in kivy python mobile application #449

lakshyacis opened this issue Dec 9, 2019 · 7 comments

Comments

@lakshyacis
Copy link

As I am creating an app in kivy python using buildozer a wrapper for python-for-android where a buildozer.spec file needs to be maintained and I simply wrote hidapi as requirement but it seems not working when says import hid

@Youw
Copy link

Youw commented Dec 9, 2019

Please see #373.


You didn't provide you build log/error message/build environment/etc.
Not enough info to know what exactly help do you need.

@lakshyacis
Copy link
Author

ImportError: Unable to load any of the following libraries:libhidapi-hidraw.so libhidapi-hidraw.so.0 libhidapi-libusb.so libhidapi-libusb.so.0 libhidapi-iohidmanager.so libhidapi-iohidmanager.so.0 libhidapi.dylib hidapi.dll libhidapi-0.dll

As I got to know these cant be installed using pip as they are not in pypi as I tried the installation of these in linux system where they got installed using

sudo apt-get install libudev-dev libusb-1.0-0-dev libfox-1.6-dev

sudo apt-get install libhidapi-hidraw0

so How can I manage it in spec file do guide me

@Youw
Copy link

Youw commented Dec 9, 2019

kivy python mobile application

are you trying to build/run you application on some mobile platform?

sudo apt-get install libhidapi-hidraw0

this should be more than enough to run hidapi/python application on your host Linux system

@lakshyacis
Copy link
Author

lakshyacis commented Dec 9, 2019

kivy python mobile application

are you trying to build/run you application on some mobile platform?

sudo apt-get install libhidapi-hidraw0

this should be more than enough to run hidapi/python application on your host Linux system

yes its working on linux fine but the thing is for mobile phone application I am using kivy and buildozer and buildozer uses its spec file for making apk and build libraries and as these requirements are not available on pypi so it cant be installed using pip so how can I manage I am little bit confuse

Check this

https://pastebin.com/zPMfz3su

@Youw
Copy link

Youw commented Dec 9, 2019

You have to use Android NDK to build hidapi to get libhidapi-hidraw.so/libhidapi-libusb.so and package it into your APK.
To build libhidapi-libusb you'd also need to build libusb with same Android NDK first.


This one is entirely on you.

@lukaslehnert
Copy link

ImportError: Unable to load any of the following libraries:libhidapi-hidraw.so libhidapi-hidraw.so.0 libhidapi-libusb.so libhidapi-libusb.so.0 libhidapi-iohidmanager.so libhidapi-iohidmanager.so.0 libhidapi.dylib hidapi.dll libhidapi-0.dll

As I got to know these cant be installed using pip as they are not in pypi as I tried the installation of these in linux system where they got installed using

sudo apt-get install libudev-dev libusb-1.0-0-dev libfox-1.6-dev

sudo apt-get install libhidapi-hidraw0

so How can I manage it in spec file do guide me

Hey! i got exactly the same error on windows. What solved your problem? Its not clear to me at all.. spend a lot time with the hidapi lib now but no success. Would be amazing to get some help.

@lukaslehnert
Copy link

it seems like "hidraw" is the problem but i cannot find a workaround..

Collecting hidraw
Using cached hidraw-0.1.tar.gz (1.4 kB)
Using legacy setup.py install for hidraw, since package 'wheel' is not installed.
Installing collected packages: hidraw
Running setup.py install for hidraw: started
Running setup.py install for hidraw: finished with status 'error'

ERROR: Command errored out with exit status 1:
 command: 'C:\Users\Lukas Lehnert\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\LUKASL~1\\AppData\\Local\\Temp\\pycharm-packaging\\hidraw\\setup.py'"'"'; __file__='"'"'C:\\Users\\LUKASL~1\\AppData\\Local\\Temp\\pycharm-packaging\\hidraw\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Lukas Lehnert\AppData\Local\Temp\pip-record-6tpwu_i_\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Lukas Lehnert\AppData\Local\Programs\Python\Python38-32\Include\hidraw'
     cwd: C:\Users\LUKASL~1\AppData\Local\Temp\pycharm-packaging\hidraw\
Complete output (19 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.8
creating build\lib.win32-3.8\hidraw
copying hidraw\hidraw.py -> build\lib.win32-3.8\hidraw
copying hidraw\__init__.py -> build\lib.win32-3.8\hidraw
warning: build_py: byte-compiling is disabled, skipping.

running build_ext
building 'hidraw._hidraw' extension
creating build\temp.win32-3.8
creating build\temp.win32-3.8\Release
creating build\temp.win32-3.8\Release\hidraw
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD "-IC:\Users\Lukas Lehnert\AppData\Local\Programs\Python\Python38-32\include" "-IC:\Users\Lukas Lehnert\AppData\Local\Programs\Python\Python38-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" /Tchidraw/hidrawmodule.c /Fobuild\temp.win32-3.8\Release\hidraw/hidrawmodule.obj
hidrawmodule.c
hidraw/hidrawmodule.c(2): fatal error C1083: Cannot open include file: 'sys/ioctl.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------

ERROR: Command errored out with exit status 1: 'C:\Users\Lukas Lehnert\AppData\Local\Programs\Python\Python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\LUKASL1\AppData\Local\Temp\pycharm-packaging\hidraw\setup.py'"'"'; file='"'"'C:\Users\LUKASL1\AppData\Local\Temp\pycharm-packaging\hidraw\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\Lukas Lehnert\AppData\Local\Temp\pip-record-6tpwu_i_\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Lukas Lehnert\AppData\Local\Programs\Python\Python38-32\Include\hidraw' Check the logs for full command output.

Megamouse pushed a commit to RPCS3/hidapi that referenced this issue Jan 6, 2023
NOTES, as described in signal11#31:
- it is still hard to use HIDAPI on OpenBSD since it is hard to use LIBUSB with HID devices;
- there is a name colision with `hid_init` from `usbhid` OpenBSD library;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants