Open TwistedBlizzard opened 7 years ago
I think your main issue is that you're installing the module through pip. The version on pip is old and has not been updated for 2 years. If you want to install this, you'll need to git clone
the repo to your computer, then run the installation script by running python setup.py install
from terminal.
I've just tried that and I'm having the same issue. I think I had done it before as well, which would explain why pip had a fit when I asked it to uninstall the module.
Hmm...in that case, try doing the following:
I have followed these steps and I'm still having the issue.
ioreg
into terminal. You'll see a list, and near the bottom of the list, you should see "it_unbit_foohid_userclient". If this is repeated a bunch of times (like 50+ times), reinstall the kext.If this doesn't work, let me know and I'll try to send a modified version of foohid.c to try to debug this.
I have tried with both 2.7.13 and 3.6.0.
Yeah, it's listed a whole bunch of times.
In the process of unloading the kext, I get:
(kernel) Can't unload kext it.unbit.foohid; classes have instances: (kernel) Kext it.unbit.foohid class it_unbit_foohid_device has 5 instances. Failed to unload it.unbit.foohid - (libkern/kext) kext is in use or retained (cannot unload).
Should I just force remove it?
If you're getting that error, you can just delete the file manually, but I think you'll need to restart your computer for it to work. Then, you can reinstall the kext again.
I have now reinstalled the kext and I am still getting the same error. It worked fine until I tried to read the output from foohid at which point it crashed immediately.
I'm sort of confused. What do you mean by reading the output? Is it the same error as before?
Yes, sorry. What I'm saying is as soon as I open this to check that the script is working, the crash occurs. The script also crashes if it is left alone for a while.
Try running the keyboard test first and see if that works. I'm not sure if the joypad test actually works, so I'll try it on my end and see.
I got the same error about 5 seconds after launching the keyboard test. Interestingly, there was no keys pressed during those 5 seconds.
Open up foohid.c in a text editor, and replace the foohid_connect method with the following:
#include <mach/error.h>
static int foohid_connect(io_connect_t *conn) {
io_iterator_t iterator;
io_service_t service;
kern_return_t ret = IOServiceGetMatchingServices(kIOMasterPortDefault, IOServiceMatching(FOOHID_SERVICE), &iterator);
printf("Get service ret: %X %X %X\n", err_get_system(ret), err_get_sub(ret), err_get_code(ret));
if (ret != KERN_SUCCESS) return -1;
while ((service = IOIteratorNext(iterator)) != IO_OBJECT_NULL) {
ret = IOServiceOpen(service, mach_task_self(), 0, conn);
printf("Iterate: %X %X %X\n", err_get_system(ret), err_get_sub(ret), err_get_code(ret));
IOObjectRelease(service);
if (ret == KERN_SUCCESS) {
IOObjectRelease(iterator);
return 0;
}
}
IOObjectRelease(iterator);
return -1;
}
Run the installation script again, and run the keyboard test again. Let me know what the output is (there should be 3 numbers per line outputted)
Here's my full output from that:
Get service ret: 0 0 0 Iterate: 38 0 2C7 Get service ret: 0 0 0 Iterate: 38 0 2C7 Traceback (most recent call last): File "test_keyboard.py", line 51, in <module> foohid.create("FooHID simple keyboard", struct.pack('{0}B'.format(len(keyboard)), *keyboard), "SN 123", 2, 3) SystemError: unable to open it_unbit_foohid service
For some reason, you're getting an "unsupported function" error, which is really confusing. I've never encountered this error while working on this, and Google isn't particularly useful for this. The only thing I can say is just unload and remove kext, restart computer, and try to reinstall kext again. I'm not sure what the cause is, but I'll try my best to figure out the reason.
Thank you for all your help! I'm more than happy to help you out with any possible solutions/further diagnostics. I ran the joystick test again and it worked for about 10 seconds after a fresh install of the kext before dying again. Would the full output from that be of any help to you now that I have the modified foohid.c?
Yeah, that would be really useful. I only need the lines that are not "0 0 0", but full output is completely fine.
Here's what happened:
Iterate: 38 0 2C7 Traceback (most recent call last): File "test_joypad.py", line 44, in <module> foohid.send("FooHID simple joypad", struct.pack('H4B', 0, x, y, z, rx)) SystemError: unable to open it_unbit_foohid service
What's really strange though, is that I force removed the kext, rebooted and then ran the test, forgetting to reinstall the kext but the test worked anyway. Well, until it crashed.
Yeah, that's really strange. I wasn't able to replicate it on my computer. Does it work if you reinstall the kext?
I have reinstalled the kext one last time and things seem to be going more smoothly now. I haven't had a crash yet but I'm only a couple of minutes into testing.
I think you should be good then, so it's your choice if you want to keep the modified version or not. If you happen to run into a "38 0 2e9" error, you should be good if you follow the troubleshooting section (I'm pretty sure you don't need to restart your computer in that case, but if you keep running into that error, restart just to be safe).
I just got a crash again. After the crash, if I run the script again, it will loop once or twice before crashing with some serious lag between loops.
I assume that it still gives a 2C7 error?
That is correct.
Yeah, sorry, I'm really not sure what's causing this. I haven't been able to replicate it at all on my computer :(
I've found it happens much quicker if I reduce the sleep() value - putting it at 0.05 caused the crash within 2 seconds. Other than that, is there anything I can try to maybe get some more valuable information?
I think those error codes are as specific as you can go. The full list is here if you're interested in it: errors. The only possible solution I can think of right now is to remove the IOObjectRelease(service);
line in foohid_connect (that line was added very recently, maybe that's the problem?). This sounds like some weird memory leak caused when it's called a certain amount of times.
I've removed that line and reinstalled but I'm still getting the 2C7 crash. I'm doing some digging in the console and I've found that taskgated crashes at the same time with MacOS error: -67062.
Just wondering, do you happen to have an anti-virus? If you do, try disabling it and see if that works.
I don't have one installed. I'm just going through all my applications and seeing if there's anything that could interfere. I've just got rid of Virtualbox. I'm wondering if Steam is the culprit as it has it's own means for making the PS4 controller work with games that don't support it natively.
Hi, same issue here :( I am running macOS 10.12.5 and Python 2.7.13.
The examples work for ~1 minute and then crash with the same error Iterate: 38 0 2C7
. When running ioreg
I each time get exactly 1019 lines with it_unbit_foohid_userclient
. I tried reinstalling the kext and rebooting multiple times but it didn't help.
Is there anything I can do to help or try to fix the problem ?
hey, same issue as well!
Tried to reinstall kext
kernell multiple times, used both versions of it: 0.1, and 0.2.1, no luck. Keeps terminating. it_unbit_foohid_userclient
piling up when checking ioreg
Are you going to do anything about it?
There is a waiting PR for foohid
driver, which might solve the issue
I am receiving the same error that seemed to be a problem in 2015. I am running macOS Sierra 10.12.5 on a mid 2015 macbook pro.
Foohid will run for a short amount of time before displaying:
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), "SN 123", 2, 3) SystemError: unable to open it_unbit_foohid service
I have followed the troubleshooting steps multiple times and also tried uninstalling/reinstalling the module with pip.