unbit / foohid-py

Python wrapper for the foohid OSX driver
MIT License
18 stars 6 forks source link

SystemError: unable to open it_unbit_foohid service #2

Closed alanjds closed 8 years ago

alanjds commented 8 years ago

I just installed foohid by the readme. Tried to run the example and it did not worked. Had I missed something? Any tips?

Installation of foohid:

airpill:git alanjds$ sudo pip install foohid
Password:
Downloading/unpacking foohid
  Downloading foohid-0.1.tar.gz
  Running setup.py (path:/private/tmp/pip_build_root/foohid/setup.py) egg_info for package foohid

Installing collected packages: foohid
  Running setup.py install for foohid
    building 'foohid' extension
    cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c foohid.c -o build/temp.macosx-10.9-intel-2.7/foohid.o
    foohid.c:179:32: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'Py_ssize_t' (aka 'long') [-Wshorten-64-to-32]
                            PyObject *ret = PyTuple_New(output[1]);
                                            ~~~~~~~~~~~ ^~~~~~~~~
    foohid.c:183:26: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'Py_ssize_t' (aka 'long') [-Wshorten-64-to-32]
                                    PyTuple_SetItem(ret, i, PyString_FromString(ptr));
                                    ~~~~~~~~~~~~~~~      ^
    2 warnings generated.
    cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.9-intel-2.7/foohid.o -o build/lib.macosx-10.9-intel-2.7/foohid.so -framework IOKit

Successfully installed foohid
Cleaning up...

Clone and installation of foohid-py:

airpill:git alanjds$ git clone https://github.com/unbit/foohid-py
Cloning into 'foohid-py'...
remote: Counting objects: 21, done.
remote: Total 21 (delta 0), reused 0 (delta 0), pack-reused 21
Unpacking objects: 100% (21/21), done.
Checking connectivity... done.
airpill:git alanjds$ cd foohid-py/
airpill:foohid-py (master) alanjds$ sudo python setup.py install
running install
running build
running build_ext
building 'foohid' extension
creating build
creating build/temp.macosx-10.9-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c foohid.c -o build/temp.macosx-10.9-intel-2.7/foohid.o
foohid.c:179:32: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to
      'Py_ssize_t' (aka 'long') [-Wshorten-64-to-32]
                        PyObject *ret = PyTuple_New(output[1]);
                                        ~~~~~~~~~~~ ^~~~~~~~~
foohid.c:183:26: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to
      'Py_ssize_t' (aka 'long') [-Wshorten-64-to-32]
                                PyTuple_SetItem(ret, i, PyString_FromString(ptr));
                                ~~~~~~~~~~~~~~~      ^
2 warnings generated.
creating build/lib.macosx-10.9-intel-2.7
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.9-intel-2.7/foohid.o -o build/lib.macosx-10.9-intel-2.7/foohid.so -framework IOKit
running install_lib
copying build/lib.macosx-10.9-intel-2.7/foohid.so -> /Library/Python/2.7/site-packages
running install_egg_info
Removing /Library/Python/2.7/site-packages/foohid-0.1-py2.7.egg-info
Writing /Library/Python/2.7/site-packages/foohid-0.1-py2.7.egg-info
airpill:foohid-py (master) alanjds$

Running the tests:

airpill:foohid-py (master) alanjds$ python test_list.py
Traceback (most recent call last):
  File "test_list.py", line 4, in <module>
    foohid.create("FooHID {0}".format(i), "xxx")
SystemError: unable to open it_unbit_foohid service
airpill:foohid-py (master) alanjds$ python test_mouse.py
Traceback (most recent call last):
  File "test_mouse.py", line 38, in <module>
    foohid.create("FooHID simple mouse", struct.pack('{0}B'.format(len(mouse)), *mouse))
SystemError: unable to open it_unbit_foohid service
airpill:foohid-py (master) alanjds$ python test_joypad.py
Traceback (most recent call last):
  File "test_joypad.py", line 36, in <module>
    foohid.create("FooHID simple joypad", struct.pack('{0}B'.format(len(joypad)), *joypad))
SystemError: unable to open it_unbit_foohid service
airpill:foohid-py (master) alanjds$
unbit commented 8 years ago

foohid is a kernel module, you need to get the kext from here https://github.com/unbit/foohid/releases and install it on your system

alanjds commented 8 years ago

Thanks. Now it works. Anyway, is there a way to build one of it myself?

unbit commented 8 years ago

@alanjds yes just open it in xcode, you will get an error if you are not a kext-authorized developer but you can force osx to load the kext without checking for signature:

sudo nvram boot-args=kext-dev-mode=1