• XDA Forums have been migrated to XenForo. We are aware of several issues including missing threads, logins not working, and more. To discuss, use this thread.

[ CM 10.1 ][ PATCH ] UHID driver for BT keyboards, e.g. the iGo Stowaway

kerberizer

New member
Feb 13, 2013
41
59
0
If you have tried to use a Bluetooth keyboard like the iGo Stowaway with CyanogenMod 10.1, you have likely been disappointed that it didn't work. The exact manifestation of the problem is that the keyboard pairs fine with the phone, but fails to connect to it afterwards. On inspection, the logs show error messages related to the userspace HID driver obviously missing.

Code:
E/bt-btif ( 3151): bta_hh_co_open: Error: failed to open uhid, err:No such file or directory
W/bt-btif ( 3151): BTA_HH_OPEN_EVT: Error, failed to find the uhid driver...
E/bt-btif ( 3151): uhid_write: Cannot write to uhid:Bad file number
Someone more knowledgeable might explain exactly why the UHID driver is missing from the current kernel(s), but I noticed that the driver has been backported for the ZTE's MSM7x27 kernel on GitHub by plaguedbypenguins for use in KonstaT's CM 10.1 port for the ZTE Blade. So, I decided to give it a try and, with a couple of cosmetic adaptations, the patch applied cleanly to the Sony MSM8x60 source code. It also builds without error and, most importantly, does what's it supposed to do: at least the iGo Stowaway keyboard that I have now works flawlessly with CyanogenMod 10.1.

To make it simpler for anyone interested, I've forked and patched the kernel source code here. And this in particular is the commited patch in question. Let me emphasize once more that my own input into the patch is effectively null, so all credit and thanks should go to the original developers!

Since I'm more a wannabe developer, I'd be very grateful if people who have good experience, especially with the kernel, take a look and see if there isn't something wrong under the surface, despite the fact that the patch applies and builds cleanly and seems to do the job. I guess @tilal6991 might be especially interested. I suppose that if all is OK, the patch might as well be merged in the CM 10.1 code in time for the last CM 10.1.3 release. Speaking of that, I am still having problems building the CM 10.2 code, so haven't even blindly tried the patch on it yet.
 

tilal6991

Inactive Recognized Developer
Dec 25, 2010
1,607
2,581
0
If you have tried to use a Bluetooth keyboard like the iGo Stowaway with CyanogenMod 10.1, you have likely been disappointed that it didn't work. The exact manifestation of the problem is that the keyboard pairs fine with the phone, but fails to connect to it afterwards. On inspection, the logs show error messages related to the userspace HID driver obviously missing.

Code:
E/bt-btif ( 3151): bta_hh_co_open: Error: failed to open uhid, err:No such file or directory
W/bt-btif ( 3151): BTA_HH_OPEN_EVT: Error, failed to find the uhid driver...
E/bt-btif ( 3151): uhid_write: Cannot write to uhid:Bad file number
Someone more knowledgeable might explain exactly why the UHID driver is missing from the current kernel(s), but I noticed that the driver has been backported for the ZTE's MSM7x27 kernel on GitHub by plaguedbypenguins for use in KonstaT's CM 10.1 port for the ZTE Blade. So, I decided to give it a try and, with a couple of cosmetic adaptations, the patch applied cleanly to the Sony MSM8x60 source code. It also builds without error and, most importantly, does what's it supposed to do: at least the iGo Stowaway keyboard that I have now works flawlessly with CyanogenMod 10.1.

To make it simpler for anyone interested, I've forked and patched the kernel source code here. And this in particular is the commited patch in question. Let me emphasize once more that my own input into the patch is effectively null, so all credit and thanks should go to the original developers!

Since I'm more a wannabe developer, I'd be very grateful if people who have good experience, especially with the kernel, take a look and see if there isn't something wrong under the surface, despite the fact that the patch applies and builds cleanly and seems to do the job. I guess @tilal6991 might be especially interested. I suppose that if all is OK, the patch might as well be merged in the CM 10.1 code in time for the last CM 10.1.3 release. Speaking of that, I am still having problems building the CM 10.2 code, so haven't even blindly tried the patch on it yet.
Well done! This is the sort of work I really like seeing - a person taking the initiative and fixing a problem themselves. I will try and get this patch included in 10.2 ASAP (10.1 is closed for submissions now).
 

kerberizer

New member
Feb 13, 2013
41
59
0
I will try and get this patch included in 10.2 ASAP (10.1 is closed for submissions now).
Finally managed to build a working CM 10.2 ROM (note to self: when replacing proprietary binaries, "make clean" is your best friend) and I can confirm that at least my BT keyboard works perfectly with it. Thanks a lot for reacting so fast, indeed! :good:
 

quzeyao

New member
Feb 14, 2014
12
1
0
Bluetooth Keyboard doest work

maybe the UHID driver is missing from the current kernel
logcat:
Error: failed to open uhid, err:No such file or directory