Jump to content

Apple Wireless Keyboard on the Streak


Guest JFDee

Recommended Posts

Guest JFDee

While we are at keyboards - I was looking for a compact but fullsized keyboard and decided to test-drive the current Apple Bluetooth keyboard (aluminium).

Well - it worked.

Now I have a German layout, so after some digging and hacking, I exchanged two files after renaming the existing ones:

/system/usr/keylayout/qwerty.kl

/system/usr/keychars/qwerty.kcm.bin

Maybe BiboTheClown knows how to add/name new layouts so that they are bound to the right device, instead of replacing the default files?

Anyway, it's working and no problem for me as I own only that single BT keyboard. The software keyboard is not affected by the change.

In case someone is interested, here are the files (the names in the ZIP are NOT right, rename for use):

keyboard_apple.zip

Edited by JFDee
Link to comment
Share on other sites

Guest BiboTheClown
Maybe BiboTheClown knows how to add/name new layouts so that they are bound to the right device, instead of replacing the default files?

Hi,

Could you post a logcat containing the BT keyboard attachment ?

With my DiNovo keyboard, I've first replaced the standard qwerty files, as you done. When I looked into the logcat I've then seen that the system first tried to load the Logitech_________Bluetooth_Keyboard.kcm.bin and Logitech_________Bluetooth_Keyboard.kl files, and as it could not find them switch back to the standard qwerty ones.

So if you can find in the adlog your BT keyboard attachment, you should find the proper file name the system try to load first.

Link to comment
Share on other sites

Guest JFDee

I'm not sure how to arrive at the expected filename. It doesn't seem to be shown explicitely in my case (stock 2.2.2 ROM).

Anyway, here is the log of the whole pairing process:

D/BluetoothService(  685): E8:06:88:48:05:A2 bond state 10 -> 11 (0)
E/BluetoothEventLoop.cpp( 685): event_filter: Received signal org.bluez.Adapter:DeviceCreated from /org/bluez/1188/hci0
E/BluetoothEventLoop.cpp( 685): event_filter: Received signal org.bluez.Adapter:PropertyChanged from /org/bluez/1188/hci0
D/BluetoothEventLoop( 685): onPropertyChanged: property: Devices
D/WindowManager( 685): onBluetoothDeviceBondStateChanged state:11
V/BluetoothEventRedirector( 1052): Received android.bluetooth.device.action.BOND_STATE_CHANGED
E/BluetoothEventLoop.cpp( 685): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/1188/hci0/dev_E8_06_88_48_05_A2
D/BluetoothEventLoop( 685): Device property changed:E8:06:88:48:05:A2property:Connected
D/WindowManager( 685): onBluetoothDeviceConnected name:Apple Wireless Keyboard class:2540 device class:1344
D/CachedBluetoothDevice( 1052): [HID status] ACTION_ACL_CONNECTED notify : E8:06:88:48:05:A2
I/bluetoothd( 1188): link_key_request (sba=00:17:CA:98:EA:4D, dba=E8:06:88:48:05:A2)
I/bluetoothd( 1188): pin_code_request (sba=00:17:CA:98:EA:4D, dba=E8:06:88:48:05:A2)
I/ActivityManager( 685): Starting activity: Intent { act=android.bluetooth.device.action.PAIRING_REQUEST flg=0x10000000 cmp=com.android.settings/.bluetooth.BluetoothPairingDialog (has extras) }
I/ActivityManager( 685): Displayed activity com.android.settings/.bluetooth.BluetoothPairingDialog: 222 ms (total 222 ms)
W/KeyCharacterMap( 1052): No keyboard for id 0
W/KeyCharacterMap( 1052): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
D/BluetoothDiscoverableEnabler( 1052): handleModeChanged : mCheckBoxPreference.setChecked(true)
I/bluetoothd( 1188): link_key_notify (sba=00:17:CA:98:EA:4D, dba=E8:06:88:48:05:A2, type=0)
E/BluetoothEventLoop.cpp( 685): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/1188/hci0/dev_E8_06_88_48_05_A2
D/BluetoothEventLoop( 685): Device property changed:E8:06:88:48:05:A2property:Paired
E/BluetoothEventLoop.cpp( 685): event_filter: Received signal org.bluez.Device:PropertyChanged from /org/bluez/1188/hci0/dev_E8_06_88_48_05_A2
D/BluetoothEventLoop( 685): Device property changed:E8:06:88:48:05:A2property:UUIDs
D/BluetoothService( 685): updateDeviceServiceChannelCache(E8:06:88:48:05:A2)
V/BluetoothEventRedirector( 1052): Received android.bleutooth.device.action.UUID
D/BluetoothService( 685): E8:06:88:48:05:A2 bond state 11 -> 12 (0)
D/WindowManager( 685): onBluetoothDeviceBondStateChanged state:12
W/BackupManagerService( 685): dataChanged but no participant pkg='com.android.providers.settings' uid=1001
D/BT HSHFP( 760): Saved priority E8:06:88:48:05:A2 = 100
V/BluetoothEventRedirector( 1052): Received android.bluetooth.device.action.BOND_STATE_CHANGED
D/CachedBluetoothDevice( 1052): [HID status] BONDED : 0 -> 1
D/CachedBluetoothDevice( 1052): [Device Class] : 2540
D/CachedBluetoothDevice( 1052): [Re-connect] : YES
D/CachedBluetoothDevice( 1052): [HID Status] = 1
D/PrintK ( 1300): <6>input: Apple Inc. Keyboard as /devices/virtual/bluetooth/hci0/hci0:12/input6
I/KeyInputQueue( 685): Device added: id=0x20005, name=Apple Inc. Keyboard, classes=3
I/ActivityManager( 685): Config changed: { scale=1.0 imsi=262/7 loc=de_DE touch=3 keys=2/1/2 nav=1/1 orien=2 layout=35 uiMode=17 seq=7}
I/UsageStats( 685): Unexpected resume of com.android.settings while already resumed in com.android.settings
D/PhoneApp( 760): updateProximitySensorMode: state = IDLE
D/StatusBarPolicy( 685): ACTION_CONFIGURATION_CHANGED received
D/PhoneApp( 760): updateProximitySensorMode: lock already released.
D/PrintK ( 1300): <6>apple 0005:05AC:023A.0002: input: BLUETOOTH HID v0.50 Keyboard [Apple Inc. Keyboard] on 00:17:CA:98:EA:4D
D/BluetoothDiscoverableEnabler( 1052): handleModeChanged : mCheckBoxPreference.setChecked(true)
D/CachedBluetoothDevice( 1052): [HID Status] = 1
D/CachedBluetoothDevice( 1052): [HID status] checkHIDConnectionState :connected
D/CachedBluetoothDevice( 1052): [Gallery intent] :true
D/CachedBluetoothDevice( 1052): [HID status] checkHIDConnectionState :connected
D/CachedBluetoothDevice( 1052): [Gallery intent] :true
D/CachedBluetoothDevice( 1052): [HID] REFRESH
D/CachedBluetoothDevice( 1052): Apple Wireless Keyboard isConnected (E8:06:88:48:05:A2) [/codebox]

Link to comment
Share on other sites

Guest BiboTheClown

Hi,

Totally untested, but worth a try :

in your logcat, we have :

D/PrintK ( 1300): <6>input: Apple Inc. Keyboard as /devices/virtual/bluetooth/hci0/hci0:12/input6
In KeyCharacterMap.cpp from Android source code, we have the KeyCharacterMap::load(int id) in which we can find these lines :
...

	sprintf(propName, "hw.keyboards.%u.devname", id);

	err = property_get(propName, dev, "");

	if (err > 0) {

		// replace all the spaces with underscores

		strcpy(tmpfn, dev);

		for (char *p = strchr(tmpfn, ' '); p && *p; p = strchr(tmpfn, ' '))

			*p = '_';

		snprintf(path, sizeof(path), "%s/usr/keychars/%s.kcm.bin", root, tmpfn);

		//LOGD("load: dev='%s' path='%s'\n", dev, path);

		rv = try_file(path);

		if (rv != NULL) {

			return rv;

		}

		LOGW("Error loading keycharmap file '%s'. %s='%s'", path, propName, dev);

	} else {

		LOGW("No keyboard for id %d", id);

	}


	snprintf(path, sizeof(path), "%s/usr/keychars/qwerty.kcm.bin", root);

 ...
To resume, the system takes the name the BT device has been discovered with, replace all the spaces by underscores, and try to load the /system/usr/keychars/BTNameUnderscored.kcm.bin file. So, you can try to rename your apple_qwerty.kl to Apple_Inc._Keyboard.kl, and apple_qwerty.kcm.bin to Apple_Inc._Keyboard.kcm.bin... With my Dinovo keyboard, I had the following logcat :
D/PrintK  ( 1651): <6>input: Logitech		 Bluetooth Keyboard as /devices/virtual/bluetooth/hci0/hci0:12/input6

From what I've renamed my keyboards file to Logitech_________Bluetooth_Keyboard.kl and Logitech_________Bluetooth_Keyboard.kcm.bin.

Have a try and keep me informed :)

Link to comment
Share on other sites

Guest JFDee

Good find with the source code file!

Unfortunately, I keep getting the same message of "No keyboard for id 0".

Looking at the code, it's clear that the file search is not even started; I'm thrown in the "else" branch because "get_property" is obviously returning an error. Seems that "hw.keyboards.<id>.devname" is missing or malformed.

I would not be surprised if Apple doesn't honor the standard in full, by not providing selected properties.

On the other hand, there might be a quirk in the Android code. Let's see if we can follow the source.

Thanks anyway!

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.