No virtual keyboard when BT gamepad connected on Andorid 12 - General Questions and Answers

I have Samsung S10 with Android 12
When I connect bluetooth gamepad, it gets recognized as "Physical keyboard" (gamepad is VR BOX)
When I enter in SCUMMVM (gaming app), it has a hud on screen shortcut key (HUD)to call a onscreen keyboard (needed in some games). If a bluetooth gamepad is connected, the shortcut key doesn't work and I can't call the onscreen keyboard. Under "Physical keyboard" options I have turned on "show on-screen keyboard" but it didn't help.
I've read that in past people had simmilar problems with other gamepads on older andorid phones and that the solution was to go to Android settings and "select your default keyboard. (physical or virtual)" but I don't have that option.
Any idea how to solve this problem?

The root problem is that the USB HID report descriptors in your little handheld are written incorrectly.
It's reporting that it can send the alphabet (specifically "Q").
Me? I'd fix the problem by reverse engineering the device.
The next possibility is to use a custom /system/usr/idc/Vendor...idc to make it clear that this is not a qwerty
The last possibility (and the one you probably want) is in Settings > System > Languages & input > Physical keyboard > Keyboard assistance > Show virtual keyboard.
You can load my UsbMode.apk (in the sig) and see that your handheld is identified as a qwerty.

Renate said:
The root problem is that the USB HID report descriptors in your little handheld are written incorrectly.
It's reporting that it can send the alphabet (specifically "Q").
Me? I'd fix the problem by reverse engineering the device.
The next possibility is to use a custom /system/usr/idc/Vendor...idc to make it clear that this is not a qwerty
The last possibility (and the one you probably want) is in Settings > System > Languages & input > Physical keyboard > Keyboard assistance > Show virtual keyboard.
You can load my UsbMode.apk (in the sig) and see that your handheld is identified as a qwerty.
Click to expand...
Click to collapse
Thanks for your answer
As I've mentioned before "Show virtual keyboard" doesn't work. I can see the on screen button that would call the virtual keyboard but it doesn't work if the gamepad is connected
I'm interested in solution to use custom Vendor.idc or to reverse engineer the device but I'm a noob to do it myself. I've went to /system/usr/idc/ dir and can see 4 .idc files where in the files, it says that two are form "Sony DS4...", and two are for "Google Reference RCU Remote" - none seams that belongs to the "no name" gamepad device I'm using? There are bunch of other .idc files but also no one seams to belong to the device...
Here's the paste from the Google RCU device:
1st file:
# Input Device Configuration file for Google Reference RCU Remote.
#
# Basic Parameters
# Due to a memory error on early prototypes of the reference remote control
# the VID/PID is mapped to 248a/8266 instead of 0957/0001
keyboard.layout = Vendor_0957_Product_0001
keyboard.doNotWakeByDefault = 1
audio.mic = 1
2nd file:
# Input Device Configuration file for Google Reference RCU Remote.
#
# Basic Parameters
keyboard.layout = Vendor_0957_Product_0001
keyboard.doNotWakeByDefault = 1
audio.mic = 1
Any help?
This gamepad I'm trying to use is pretty neat to play games by one hand which is great on mobile as you can hold device in one hand and gamepad in other so it would be great to hack it if to also be able to show keyboard on keypress demand if it is possible

Try the UsbMode.apk. Also, does a little boxed "A" appear on the status bar when the remote is active?
First, with the remote active, identify the VID/PID of your device
Code:
$ logcat|grep btif
bt_btif : bta_hh_co_send_hid_info: vendor_id = 0x291a, product_id = 0x8502, // something like this
^C
Could you do me a favor (just for my own interest)?
Code:
$ cd /sys/bus/hid/devices
$ cd whatever // there's only one directory here, named ????:VID#:PID#:????
$ cp report_descriptor /sdcard/descript.img
$ ^D
C:\>adb pull /sdcard/descript.img
Hmm, it looks like there is no option in idc. You'll have to make a keylayout file.
Please use the UsbMode.apk and write down what all the buttons do.
There's not that many. I just need the Android names, you don't need to say which button on the remote it is.

Related

Can you change the keyboard alt-modifier chars?

Well, I am currently fooling around with my ADP1 and the one thing that bothers me the most is the fact that the keyboard isnt that well suited for me as Norwegian characters arent easily accessible (I need to hold a in order to get å, etc). I was just wondering if its possible to change what the alt-modifier chars do? (alt+k returns a " for example). I would love to have it as I have on my Touch Pro, where Fn + certain keys give me my norwegian letters
Thanks!
you can write your own key layout map by modifying existing english one.
tell me, if you are interested in and i can guide you
I might be interested in this as well... Depends on how hard it is to do!
Thanks,
Christopher
Here is the thing:
You should take qwerty.kcm file
http://android.git.kernel.org/?p=pl...b_plain;f=emulator/keymaps/qwerty.kcm;hb=HEAD
which is a text file needed to generate key layout.
This file is actually not exact from G1 keyboard, because some meta-symbols are from another key layout.
If you open it, you can find 7 columns like this:
Code:
F 'F' '3' 'f' 'F' '[' '['
The first and the second tells you what key is being considered.
Forth - what symbole would be produced, when you press the key
Fifth - the same, but with _shift_
Sixth - the same, but with _alt_
So what you need to do, is to edit certain column and add symbol you need.
For example both x and alt+x produce the same char 'x', so you can change alt+'x' on whatever you want.
The best way is to enter a Unicode code for you symbols, if they are not covered with ASCII. Based on this:
http://www.fiskeklubben.org/charcters/digitized.html
you should use 00E6 for æ. In this file it should be typed as 0x00E6
When you insert character you need and adjust some other characters, you can send this layout to me and I will generate binary file for layout, which you can use on your G1
Well, it should be easier than it seems to be.
hmm, looking at the qwerty.kcm file, it doesnt all make sense. Take x for example. Fn+x should give x, as you said.. but in the .kcm file, x is displayed like this:
X 'X' '9' 'x' 'X' '8' 0xEF00
Where the the FN-coloumn shows an 8 instead of x. Any idea why?
That is because I don't have layout file for G1.
This file is for some common android device, and fn-keys (or you can call it alt-keys) differs.
So first we need to modify it in order to match with real G1 keyboard.
There is also qwerty2.kcm file
http://android.git.kernel.org/?p=pl..._plain;f=emulator/keymaps/qwerty2.kcm;hb=HEAD
may be it is closer to real G1, but anyway does not match 100%
Ah, will take some time to edit it to match the G1. Il work on it though! What do I do with the binary layout after you're done though?
Thanks for the help
You should backup your G1 layout file and replace with new.
Ive made this one, Not 100% sure its fully correct, but it should do the trick!
I compiled it (though I have to change euro and pound symbols into unicode).
Code:
R 'R' '7' 'r' 'R' 0x00A3 0x20AC
S 'S' '7' 's' 'S' '|' 0x00DF
T 'T' '8' 't' 'T' 0x20AC 0x00A3
I tried it with emulator, seems to work fine.
The idea is: to replace /system/usr/keychars/trout-keypad-v3.kcm.bin with new file.
Here are the details:
I do not write exact instruction, hope you realize how to log into device and copy files.
Now, log to your device. Be sure you have system in rw mode.
otherwise you have to remount:
#mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
navigate to /system/usr/keychars/
#cd /system/usr/keychars/
if you type ls you can see a whole bunch of files, I recommend to backup them all.
if you have busybox installed (if you don't, you'll have to do it manually by dd if= of=)
Code:
#cd /system/usr/keychars/
#mkdir backup
#busybox cp * ./backup/
now you need to replace a file trout-keypad-v3.kcm.bin with attached
Changes should affect newly started applications and it should take some time to affect already running (other words you have to type a lot into them in order they run garbage collector and reload keylayout)
Other thing, if your phone is not US G1 your system may be using other file to read layout (not trout-keypad-v3.kcm.bin ). You can check it if you type getevent:
Code:
# getevent
add device 1: /dev/input/event4
name: "compass"
add device 2: /dev/input/event3
name: "trout-nav"
could not get driver version for /dev/input/mouse1, Not a typewriter
add device 3: /dev/input/event2
name: "trout-keypad-v3"
add device 4: /dev/input/event1
name: "synaptics-rmi-touchscreen"
could not get driver version for /dev/input/mouse0, Not a typewriter
could not get driver version for /dev/input/mice, Not a typewriter
add device 5: /dev/input/event0
name: "h2w headset"
As you can see mine using
Code:
add device 3: /dev/input/event2
name: "trout-keypad-v3"
Finally, if you'll succeed, we can write a fancy guide for other people.
WARN: if you mess up badly with layouts you probably won't be able to start telnetd from G1 keyboard and other stuff like this.
So be sure you can login to your G1 from pc with root access and revert changes. I am using JF 1.3, so I can log in via adb shell with root any time from my pc.
Thanks for the guide! I have a question regarding the qwerty file though. What about the keys on the G1's keyboard that is not in the qwerty file? Such as the @-key?
Untouchab1e said:
Thanks for the guide! I have a question regarding the qwerty file though. What about the keys on the G1's keyboard that is not in the qwerty file? Such as the @-key?
Click to expand...
Click to collapse
I don't know, what would happen if you do not map all keys (probably it will yield an error upon certain key or just give nothing), but @ is present in your layout:
Code:
AT '@' '@' '@' '@' '@' 0x2022
I have a question please.
Usualy double click on the up arrow key change the keyboard layout to full upper case, is there any way to set that the double clicking on it will change the layout to other language and not upper case?
I understood that there is a difficult with changing the layout, maybe that may be a nice solution at least for some of us.
zrubi
I don't think there is a strait forward way to do it by now.
But soon (Feb 2009 I think) T-Mobile will introduce G1 to some European countries other then GB, so Google have to develope some easy way to change layouts by this time.
worry said:
zrubi
I don't think there is a strait forward way to do it by now.
But soon (Feb 2009 I think) T-Mobile will introduce G1 to some European countries other then GB, so Google have to develope some easy way to change layouts by this time.
Click to expand...
Click to collapse
Hi!
worry, first of all, thank you for all your research and work on keyboard layout. I've been following your research here and on russian forums.
I've also investigated this topic a bit and found the following following property described at http://www.kandroid.org/android_pdk/keymaps_keyboard_input.html as the one which would allow to switch the layout dynamically without kcm file substitution, but unfortunately it does NOT work.
setprop android.keychar.trout-keypad-v3 /system/usr/keychars/qwerty_ru.kcm.bin
Do you have any new information on this topic?
Do you happen to know how French and German keyboard layout switch is implemented (if there is any switching at all)?
Thank you!
i wanna change my @ button to a /
This is incredible! One step closer to be able to switch keyboard layouts on G1.
Thank you, guys!
How can I change the characters which's showed when I hold a char on keyboard ? (for an example : hold "A" and see)
And how can I creat a new type rule ? For an example I type double "A" an it become "Â", and if type triple "A" , it will return "AAA" and creat an option to on/off this feature ?
worry said:
...you can send this layout to me and I will generate binary file for layout, which you can use on your G1
Click to expand...
Click to collapse
So how exactly does one generate the binary file? I'm eager to know so I wouldn't need to ask people to do that for me when trying out layouts
Does anyone have the .kcm (not .kcm.bin) file for US G1 or ADP? (I guess it's trout-keypad-v3.kcm) or know where I can find it?
/Mats

[TUTORIAL] External keyboard remapping [3.0+]

Disclaimer
This short tutorial is based on my own research regarding missing keyboard layout mapping in stock Honeycomb/ICS Android for my Motorola XOOM. It is not intended to be a complete description of the Android input system, please refer to the official documentation for more information. This text should suffice for anyone with a basic knowledge about IT Anyway, if you break something, 'aint my fault. Won't take any responsibilities for YOUR actions.
Requirements
- rooted Android 3.0+ device (3.0, 3.1, 3.2, 4.0)
- text editor
- external keyboard to play with
Background stuff
(simplified, no bashing )
Keyboard (connected to any device) sends key codes to the target device. Key codes are just plain numbers, eg. if you press the "A" key on the keyboard, the computer reads "30" number. Since "30" is quite difficult to remember as being the "A" button, it is much more handy to describe keycodes as char codes: in the target software we get a KEY_A instead of 30.
Android uses two files for keyboard key-to-output mapping: .kl (key layout) and .kcm (key character map).
*.kl file describes the mapping between real keyboard codes to their virtual values, eg. 30 => KEY_A.
*.kcm file converts char codes to key events (KEY_A pressed? Send character "a". Shift + KEY_A? Send character "A", etc.)
So if you connect an external keyboard (USB, BT, Ir?) to your Android device, you get the following chain:
Code:
[keyboard] => [kl] => [kcm] => [application]
All devices (well, most of them) can be identified by VID (Vendor ID) and PID (product ID). VID and PID are 4 hex symbols each.
Android by default uses /system/usr/keylayout/Generic.kl and /system/usr/keychars/Generic.kcm for keyboard handling. If you look into /system/usr/keylayout/ and /system/usr/keychars/ you may find some more keymaps, including something like Vendor_xxxx_Product_xxxx.* Those files are used for specific devices, eg. Vendor_045e_Product_028e.kl is used for XBox 360 controller. When you connect the keyboard, Android checks the peripherial device VID and PID and looks for matching kl and/or kcm. If there is no matching file found, Generic.kl/Generic.kcm is used instead (disjoint -> you may have a specific kl and generic kcm, generic kl and specific kcm, etc.).
You may get the PID/VID of your external keyboard under for example Windows (in device manager [devmgmt.msc] find your keyboard and check its details [properties->details], for example HID\VID_046D&PID_C312\6&26DA469B&0&0000 => Vendor_046d_Product_C312). So if you would like to prepare a keymap for my USB Logitech keyboard, you will have to provide me with Vendor_046d_Product_C312.[kl|kcm] files
Both KCM and KL files are encoded in ANSI -> no special (national) characters allowed except for 'classic' set! If you want to include any national or extra character, you need to use their unicode hex values in \uXXXX variant. See http://www.tamasoft.co.jp/en/general-info/unicode.html for a huge list of unicode characters.
Getting hands dirty
- pull Generic.kcm from your device via adb:
Code:
adb pull /system/usr/keychars/Generic.kcm
- open it with Notepad++
- scroll through the blahblah about not modifying the file to the section with
Code:
key A {
label: 'A'
- this is where your work starts!
In general the map is composed as fillows:
Code:
# comment starts with a hash
key [keycode] {
label: '[label]'
base: '[key without any modifiers]'
[modifier]: '[key with modifier]'
[modifier]+[modifier]: '[key with both modifiers]'
[modifier],[modifier]: '[key with any of listed modifiers]'
[modifier]: fallback [magic key] # read below
[modifier],[modifier]: none
}
Modifiers can be: ralt, lalt, alt (right/left ALT, any ALT), rshift, lshift, shift (right/left SHIFT, any SHIFT), rctrl, lctrl, ctrl (left/right CTRL, any CTRL), capslock (no right CAPSLOCK on the kb, sorry ), rmeta, lmeta, meta (right/left WIN key, any WIN key). There are probably more, but didn't encounter any...
So, let's make the A key work like on Polish (Programmer) keyboard layout (namely a, A, ą, Ą letters):
Code:
key A {
label: 'A'
base: 'a'
shift, capslock: 'A'
ralt: '\u0105'
shift+ralt, capslock+ralt: '\u0104'
lalt, meta: none # ctrl omitted - ctrl+a does something...
}
Polish letters "ą" and "Ą" have their unicode values of 0x0105 and 0x0104 respectively, thus in order to have them available via right alt + A, we use ralt modifier and shift/capslock ralt modifier. Please note, that it is necessary to have 'shift' modifier for capital A.
Code:
fallback [i]magic key[/i]
is used to map certain key combinations to other commands ("hardware buttons"), such as HOME, SEARCH, MENU, APP_SWITCH, etc. Thus if for example you would like to have lalt+tab for app switching you would have to use the following:
Code:
key TAB {
label: '\t'
base: '\t'
lalt: fallback APP_SWITCH # alt + tab :)
ralt, meta: none
}
And now a Windows+D for desktop shortcut:
Code:
key D {
label: 'D'
base: 'd'
shift, capslock: 'D'
meta: fallback HOME # show desktop
alt: none
}
In short
- in most cases the Generic.kl file is ok, there is no need to prepare .kl for a common keyboard
- either edit Generic.kcm or get VID/PID of your keyboard and prepare a key layout for your language and push it to /system/usr/keychars/
Hints
- backup your Generic.kcm file!
- try to be as specific as possible if you do not use a combination, map it into 'none' section; when you map ralt, don't include alt in 'none', include lalt instead. Remember, that some key combinations have special meanings (ctrl+d, ctrl+c, ctrl+v, etc), and it is better not to include them in your map.
- backup your layout - I lost a lot of time re-creating my keymap after ROM upgrade (symbolic link is a better idea!)
- look through the entire Generic.kcm file - there are a lot of fancy key combinations, for example ESCAPE key can !by default! handle MENU, BACK and HOME keys!
- possible fallback keys are listed in .kl file
- use logcat! You can spot information about external input device and a note about applied KCM/KL files
Finally
Hit "thanks" if you find it helpful. If you prepare a good (national) key layout, please share it!
For Polish national characters we can use "Polska Klawiatura Programisty V2" it works very well with external keyboard on MoPho with 2.3.
thanks for the information. I couldnt find the the Android ICS/Honeycomb virtual key for task switcher..do you know what name is that Task switcher virtual key ?
Hi, I am a newbie with android....
I modify the kcm file to (spanish layout, Generic to Vendor both attached):
An I can't make it work, maybe:
Something is missing?
Errors in the kcm file?
Any advice would be appreciated :crying:
I am away from my PC, but:
1) run Terminal Emulator before connecting the external keyboard
2) enter superuser mode (su)
3) launch logcat (logcat)
4) launch another Terminal Emulator window
5) enter superuser mode (su)
6) connect external keyboard
7) break logcat feed
8) launch dmesg (dmesg) in other window
9) check logcat and dmesg outputs looking for errors
I'm on vacation till next Sunday. I will help you directly once I'm back
Sent from my Galaxy Nexus using Tapatalk 2
Thanks for the help:
Here are fragments of:
dmesg
Start called p = df8e3820
starting connect time
DWC_OTG : [tcc_set_vbus] vbus_state:1
usb 1-1: new low speed USB device number using dwc_otg
usb 1-1: device v1241 p1503 is not supported
input: USB Keyboard as /devices/platform/dwc_otg.0/usb1/1-1/1-1:1.0/input/input5
Click to expand...
Click to collapse
logcat
D/EventHub( 1114): No input device configuration file found for device ' USB Keyboard'.
E/KeyCharacterMap( 1114): /system/usr/keychars/Generic.kcm:454: Malformed character literal.
E/KeyCharacterMap( 1114): /system/usr/keychars/Generic.kcm:454: Invalid character literal for key.
Click to expand...
Click to collapse
I will check line 454 and see what I can do.
UPDATE
So I checked the 454 lien an a 'u' was missing, "\00xx" to "\u00xx".
I use the droidedit pro (1.15.2, and god the save file doesn't work unless root mode is enabled), changed in the ext_sd version use the terminal and copy then I connect the keyboard and it work, oh yeah it simply works (just a fu..ing 'u' for 22kb file)
Anyway thanks for the tip it really, REALLY help me :highfive: :highfive: :good: :good:
Thanks for this, will come in handy.
Hi everyone! Need some help with character map modding for Jelly Bean. I need to assign multiple letters to one button, e.g. "A" for single tap and "[" for double tap (just an example, don't mention).
What I found on source.android.com:
http://source.android.com/tech/input/key-character-map-files.html said:
The following keyboard types are recognized:
...
PREDICTIVE: A keyboard with all the letters, but with more than one letter per key.
This type of keyboard is generally designed for thumb typing.
Corresponds to KeyCharacterMap.PREDICTIVE.
Click to expand...
Click to collapse
Seems like the one thing I need, but I haven't found any syntax explanations or charmap examples for that layout type. Neither on AOSP pages, nor via Google. If your device uses such keymap type or you just know the syntax, post here examples, or attach kcm files. Any hint is good.
Android 4.2.2 - Virtual
Hi
Many thanks for this guides.
On my device Virtual.kcm is used (Acer A1-811, android 4.2.2)
Obviously it is nice to modify some file, rather than to pay 2$ for some application to do such mappings to right characters.
Regards
Logitech K400
Not sure if this goes here, but I have a Logitech K400 keyboard and it has some "special" keys, like the music player key.
What I want to do is to change the default player that opens when pressing that key, in my case it would be Poweramp.
The keyboard also has some other keys on the function keys, and when pressed some of them just are letters, want to edit this too.
There is also a "lock pc" key that opens S Planner.
I hope someone knows what I mean and can help me.
Mapping an external keyboard
In attempting to re-map an external keyboard, i have succesfully found and edited the P1_keyboard.kl file for instance changing the function of the voice search button from performing that function to performing an "Enter" or typing a letter "B" . However what i am trying to do is to use that button to do a combination of Both Letter B and then ENTER, i have tried "+" space etc but with no luck... Is this possible to do in any way?
kcm file has no effect
I create this file for the logitech K810
/system/usr/keylayout/Vendor_046d_Product_b319.kl
This successfully remaps keys.
However creating and editing this has no effect:
/system/usr/keychars/Vendor_046d_Product_b319.kcm
The generic behavior also does not match Generic.kcm
One example is Alt-Tab which switches actually switches applications on my device. It is not mentioned anywhere in anything in /system/usr. Redefining
Alt-Tab in the kcm file has no effect.
I am running KitKat on a Galaxy Note 10.1 2014.
file permissions
injola said:
I create this file for the logitech K810
/system/usr/keylayout/Vendor_046d_Product_b319.kl
This successfully remaps keys.
However creating and editing this has no effect:
/system/usr/keychars/Vendor_046d_Product_b319.kcm
The generic behavior also does not match Generic.kcm
One example is Alt-Tab which switches actually switches applications on my device. It is not mentioned anywhere in anything in /system/usr. Redefining
Alt-Tab in the kcm file has no effect.
I am running KitKat on a Galaxy Note 10.1 2014.
Click to expand...
Click to collapse
Just a guess, are the file permission set appropriately? (chmod 644 /system/usr/keychars/*.kcm)
Ctrl+SPACE does not work
On my nexus7 2012 4.4.4, chroot debian wheezy is running.
When I use emacs with Apple Wireless Keyboard (JIS).
Ctrl-SPACE does not allow me to set mark,
although keep pressing them for about one second just makes it work.
(but keep pressing makes flickering "Mark activated", "Mark deactivated"...)
In the kcm file, CTRL+SPACE is specified as "fallback LANGUAGE_SWITCH".
I tried changing it to none, or commenting out the line, but these doesn't affect.
I also used keytest.apk to inspect the behavior.
It seems just when CTRL+SPACE is pressed, no event happens...?
Does anyone know how to make Ctrl+SPACE (without keep pressing) function as setting mark ?
thank you in advance.
Genius luxepad 9100 keyboard
Hi i have this keyboard and android 4.2.2 i want the keyboard with spanish layout without pay an app, i want to choose the language on the system. Thanks in advance
Keycodes not recognised
Hi there,
I have a problem where I can't remap a key because it's not showing any keycode.
That is: standard keys like A, B, C, etc are ok: I can see their scan code and change it if I want to, but I don't.
Keys like Volume_up, play_pause, etc I would like to have them changed, but I cannot as I can't see any scan code when I press them.
I know all keys work as I tested the remote on windows and it works properly, and I can see keycodes there (but they are not the same as in android, so I can't use windows' keycodes)
Thank you if you can help
enter to send message
hello everyone! does anyone solve question about ENTER key to sending message insdeat of new line command? combination of buttons not works too for the sending messages....
android 4.4.2 + universal external keyboard (with comand buttons)
Toggle Languages
Thanks for this helpful and specific tutorial. :good:
I am trying to map keys for Urdu language. :angel:
My question is, will it work properly with lollipop?
Will it be able to toggle between language.
...
Thanks in advance for you kind information
_TB_TB_ said:
Disclaimer
- rooted Android 3.0+ device (3.0, 3.1, 3.2, 4.0)
Click to expand...
Click to collapse
Hi!
Is there any way to replace kcm without loosing your warranty?
Code:
adb push move /system/usr/
push: move/keychars/Virtual.kcm -> /system/usr/keychars/Virtual.kcm
failed to copy 'move/keychars/Virtual.kcm' to '/system/usr/keychars/Virtual.kcm': Read-only file system
Should I change permissions to put back onto system/usr?

Remap gamepad buttons

Hello there!
I am trying to get a Shanwan Generic Gamepad to work with my Tronsmart MK908.
I own two alike gamepads. They both basically work, but send D_Pad_xx and Generic button messages to my system.
I have installed the following apk, to see what is sent by my gamepads: [ github.com/chrisboyle/keytest/downloads ]
It shows me, that both gamepads send the same signals to my Android Mini PC.
As I plan to make them work with MAME4DROID, I would like to remap the inputs to letters (as if sent by a keyboard), which I can again remap to certain actions in MAME4DROID (latter works).
I have found a ressource on the internet which describes how to define keys mapped to a certain keycode from a certain device [ source.android.com/tech/input/key-layout-files.html ]
I have installed USB Device Info [ de.appszoom.com/android_applications/tools/usb-device-info_btyps.html ] to see how the gamepads are seen by my Android PC. Whatever Vendor or ProductID (changes from tab "Android" to tab "Linux") I name my *.kl file after, I cannot remap the keycodes sent from my gamepads.
Does anyone of you know how to map gamepad inputs to, say, letters of a keyboard?
Sorry for not posting real URLs, but I am not able yet (<10 posts)...
Thank you so much!
LeFish

Xserver chroot on TF700t

I've been running kexecboot native Linux for a while now and this has been a side project of mine since bumping into Linux Deploy. I really wanted to run my Linux and have my Android too... So, I got tired of trying to get Linux to run on the Android frambuffer and went this route... This runs pretty fast on my tablet. Resources seem way lower than a vnc chroot. And running on an xserver has more advantages. This is only tested so far with an image file and LXDE (I will be trying a microsd directory install soon).
XFCE4 and microsd partition install running fine also.
Use gparted to partition your microsd.
I used a SanDisk Class 10 16gb UH-I (8.5mb/s write and 24.5mb/s read) partitioned to 12gb fat32, 4gb ext4
These are just the settings I used that worked first for me. Play around, you can't hurt anything...
Download/Install:
Linux Deploy, Xserver XSDL and Connectbot
Setup Linux Deploy:
-Goto settings update environment
-On main screen click the install icon (it is the little down arrow)
---Under Deploy:
-Select your distro
-Architecture - arm7hf
-Installation type - File or ext4 partition
-Installation Path - change path and or file name or microsd partition (ex /dev/block/mmcblk1p2 for 2nd partition on microsd)
-Image size - at least 2GB (default is 4GB)
-User name - pick one or leave it
-Select components - check all
-Desktop environment - LXDE
---Under Startup:
-Check ssh server and Custom mount points
---Under Action:
-Go back to the top and select install.
-After it finishes click Start
Setup Xserver XSDL:
-Home button out and start Xserver XSDL
-Click screen immediately and choose 1900x1136(native) and font 0.5
-For those without a dock you may need to click "Change device configuration" at the top
when it first starts
Setup Connectbot:
-Home button out and start Connectbot
-ssh: [email protected]
-password: changes
-export DISPLAY=:0
-startlxde
-Recent apps select Xserver XSDL
**Profit**
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
XSDL works fine with my symlinked Arch.
Running super fast from an ext4 partition on my sdcard...
sound?
workdowg said:
Running super fast from an ext4 partition on my sdcard...
Click to expand...
Click to collapse
Did you manage to make sound work?
I tried to install alsa, audio devices are present but do not work...
pinaz said:
Did you manage to make sound work?
I tried to install alsa, audio devices are present but do not work...
Click to expand...
Click to collapse
No... @_that may have.
workdowg said:
No... @_that may have.
Click to expand...
Click to collapse
No, I only tried apps like Gimp and LibreOffice.
Linux Deploy update
With the latest version of Linux Deploy, Connect Bot is not needed any more.
Just select the option "GUI - Allow startup graphical environment", on "Graphics Subsystem" select "X Window System", and then on "GUI Settings" set "Display" to 0 and "X Server Address" to localhost
Now first start XServer XSDL and then start the Linux Deploy service
BTW, I am trying XFCE desktop on Ubuntu Precise, it is really fast.
A good idea (if you use ubuntu and xfce) may be to install the package xubuntu-desktop (Linux Deploy makes a very basic installation of XFCE, even icons are completely missing!)
PROBLEMS WITH KEYBOARD LAYOUTS OTHER THAN "US" - SOLUTIONS
I have a dock with Italian keyboard and I had some problems, probably due to some XServer XSDL bugs.
I set "it" keyboard layout in XFCE settings, all keys are working correctly apart from two things (only using XServer XSDL, with other android apps I have no problem with the keyboard):
1) Keys " ' ? " and " - _ " are swapped
Solution:
edit /usr/share/X11/xkb/symbols/it and swap AE11 and AB10 codes in the "basic" section, in this way:
Code:
partial default alphanumeric_keys
xkb_symbols "basic" {
include "latin(type4)"
name[Group1]="Italian";
.........
key <[COLOR="Red"]AB10[/COLOR]> { [apostrophe, question, grave, questiondown ] };
.........
key <[COLOR="Red"]AE11[/COLOR]> { [ minus, underscore, dead_macron, division ] };
.........
include "level3(ralt_switch)"
};
I checked with Input event logger app, the problem is probably due to a bug in dock keyboard remapping by Android (I use CROMBI-KK with _that kernel, I do not know what part causes the problem)
The simpler workaround is to manually remap the keys in XServer XSDL: the Italian keyboard's "minus" key shoud be remapped to "SLASH" and Italian "apostrophe" to "MINUS" (in fact US-minus corresponds to IT-apostrophe, and US-slash to IT-minus)
2) the 102nd key is not working at all. ( It is the key at the right of the left-SHIFT key, that in the Italian keyboard layout corresponds to the " < > " key)
It is a problem of XServer XSDL, because if I check key press events in X with the following command:
Code:
xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
all keys work except for the 102nd key, while if I check key press events from the input device, in this way:
Code:
evtest /dev/input/event1
the 102nd key works.
Solution:
We need a little workaround, because it seems that XServer XSDL does not "see" the 102nd key at all.
First, install some stuff
Code:
sudo apt-get install inputlirc lirc input-tools xautomation
Then create a file .lircrc in your home directory with the following content:
Code:
begin
prog = irexec
remote = /dev/input/event1
button = KEY_102ND
config = xte 'str <'
repeat = 0
end
begin
prog = irexec
remote = /dev/input/event1
button = SHIFT_KEY_102ND
config = xte 'str >'
repeat = 0
end
then execute the following commands
Code:
sudo inputlircd -c -m 0 /dev/input/event1
irexec -d
You may put the above code in a script that starts automatically with the X session (in XFCE, see Applications Menu->Settings->Sessions and Startup)
Note that the "irexec -d" part must be executed from within the X session by the X session user, so you cannot use a Custom Script in Linux Deploy (which executes commands as root outside the X session)
So it is simpler to use an autostart script within XFCE
Hope that this may help also other people, in fact XServer XSDL officially supports only US Keyboards, so I guess that also keyboard layouts other than the Italian one may be affected
Cheers, and happy 2015!
EDIT:
It is definitively an XServer XSDL bug. I tried to connect a wireless Italian keyboard and I got the same problems as with the asus dock keyboards (apostrophe and minus keys swapped, 102nd key not working)
Custom mount points
(I use CROMBI_KK, but I guess the following applies also to other ROMs)
To access internal and external sdcards, usbdisks etc with read-write permission one has to correctly set custom mount points in Linux Deploy. I was using /storage/sdcard0, /storage/sdcard1 but it is not correct, you get only read permissions with normal user (rw only with root).
The right mount points are (in CROMBI_KK)
/data/media/0 (for internal SD)
/mnt/media_rw/sdcard1 (for external MicroSD)
/mnt/media_rw/sdcard2 (for external SD in dock)
/mnt/media_rw/usbdisk0 (for Usb disk in dock)
In other ROMs mount point may change, you can check with a mount command from terminal within android (avoid fuse mounts and search for "real" mounts)
LITTLE TRICK:
When you start Linux Deploy service, it can only mount already mounted sdcards and usbdisks, if you insert a new sdcard after having started Linux Deploy, you cannot see it automatically from Linux.
However, you just have to click again on "Start" in Linux Deploy, it will skip already started services and mount only the missing sdcard(s) or usbdisk
keyboard dock
_that said:
No, I only tried apps like Gimp and LibreOffice.
Click to expand...
Click to collapse
See my previous posts, I have almost managed to configure everything for office use (including printing, excluding sound...), I am quite satisfied because it is reasonably fast and usable, but one important part is missing: esc, del and function keys.
XServer XSDL can remap them but it does not help much: it seems that the following keys are not intercepted normally but seem to be handled specially by CM 11/CROMBI KK:
TOGGLE_(WIFI, BT, TOUCHPAD) , BRIGHTNESS_(UP, DOWN, AUTO), CAMERA, EXPLORER, SETTINGS, POWER
So even with remapping, when I try to press the key corresponding to F1, I get an F1 event on the chrooted linux but also a toggle-wifi event on Android, when I press F2 I get F2 on linux and toggle-bluetooth on android, and so on...
Even using shift/ctrl/alt/fn+ dock special keys, CM11/CROMBI-KK intercepts them as if no shift/ctrl/alt/fn is used.
Other people experienced the same problem, see here:
http://forum.cyanogenmod.org/topic/83065-how-to-re-map-keyboard-dock-layout-for-custom-keymap/
I guess I have to stop some service in CM11/CROMBI KK that handles special keys, any idea about which one I have to kill? @_that?
pinaz said:
but one important part is missing: esc, del and function keys.
Click to expand...
Click to collapse
Try playing with the kernel level function key remapping that I added in my kernel:
http://forum.xda-developers.com/showpost.php?p=40168242&postcount=3
If you're not using my kernel, you need to extract the patch that implements this feature from my kernel on github and compile your own.
_that said:
Try playing with the kernel level function key remapping that I added in my kernel:
http://forum.xda-developers.com/showpost.php?p=40168242&postcount=3
If you're not using my kernel, you need to extract the patch that implements this feature from my kernel on github and compile your own.
Click to expand...
Click to collapse
Great! It works!
I can write parameters even from inside the chrooted environment.
Now I only have to change remapping of function keys done by XServer XSDL in order to avoid "double" remapping of the same key, and I am done
Thank you!
_that's Kernel key remapping function works perfectly, I can use the following commands (in Android terminal or within the chrooted environment, as root in both cases) to enable Esc, Del, Ins keys, and to use special keys as Function keys without needing to press Alt/Alt Gr:
Code:
echo 3 > /sys/module/asusdec/parameters/key_flags
The problem is XServer XSDL.
Problem 1:
Xserver XSDL sees Esc, Del and Ins keys (corresponding to Back, Lock, Volume Mute dock keys) as if they were the same key, that in the default XServer XSDL config is mapped to 'Unknown'.
So even if you try to remap them, you can choose only one option for ALL of them.
Solution:
Do not touch XServer XSDL default key mapping settings .
Follow my previous post, point 2, and add to the $HOME/.lircrc config file the following lines:
Code:
begin
prog = irexec
remote = /dev/input/event1
button = KEY_ESC
config = xte 'key Escape'
repeat = 0
end
begin
prog = irexec
remote = /dev/input/event1
button = KEY_DELETE
config = xte 'key Delete'
repeat = 0
end
begin
prog = irexec
remote = /dev/input/event1
button = KEY_INSERT
config = xte 'key Insert'
repeat = 0
end
It is a problem of android kbd mapping, see next posts
Problem 2:
With _that's kernel key remapping functions, function keys (with no alt/Alt gr) and dock's special keys (with Alt/Alt Gr) are different key events, however XServer XSDL sees them as the same event, so you cannot remap them differently.
If you use function keys in your chrooted linux GUI, everithing is fine.
If you try to use dock's special keys (with Alt/Alt Gr to toggle wifi, bluetooth, adjust brightness etc.) you get the special key event AND the function key event at the same time.
So if you press Alt/AltGr+ToggleWifi you toggle wifi AND press F1 at the same time, so you may see the help window of the program you are using. And so on...
Quite annoying....
Solution
none found at the moment, I guess it would be necessary to modify XServer XSDL code.
Simply do not try use dock special keys (with Alt/AltGr) when you are inside your chrooted linux GUI
Anyway, thanks @_that!
@_that:
I chatted with @pelya , see my comments on github:
https://github.com/pelya/commandergenius/issues/40#issuecomment-69906349
it seems to be a problem of your kernel-level keyboard remapping function: it sends correct Scancodes but wrong keycodes (always 0) for "fake" ESC, DEL and INS keys (checked in android with input event logger app) see my next post
https://github.com/pelya/commandergenius/issues/40#issuecomment-69908886
keycode and scancode swap for keys SLASH (Italian kbd: minus) and MINUS (IT kbd: apostrophe) may be a problem of the kernel remapping function or of CM11-CROMBI-KK, needs to be investigated
pinaz said:
@_that:
I chatted with @pelya , see my comments on github:
https://github.com/pelya/commandergenius/issues/40#issuecomment-69906349
it seems to be a problem of your kernel-level keyboard remapping function: it sends correct Scancodes but wrong keycodes (always 0) for "fake" ESC, DEL and INS keys (checked in android with input event logger app)
Click to expand...
Click to collapse
Thanks for your research so far! The kernel sends only one set of codes, those defined in linux/input.h, through the event interface. The keycodes you're seeing come from Android and it looks like you need to copy some lines from /system/usr/keylayout/Generic.kl to asusdec.kl.
_that said:
Thanks for your research so far! The kernel sends only one set of codes, those defined in linux/input.h, through the event interface. The keycodes you're seeing come from Android and it looks like you need to copy some lines from /system/usr/keylayout/Generic.kl to asusdec.kl.
Click to expand...
Click to collapse
You're right, thanks!
I solved the esc-ins-del problem in the following way
In Android terminal:
Code:
su
mount -o remount,rw /system
nano /system/usr/keylayout/asusdec.kl
then I added at the end
Code:
key 1 ESCAPE WAKE_DROPPED
key 110 INSERT WAKE_DROPPED
key 111 FORWARD_DEL WAKE_DROPPED
then
Code:
mount -o remount,ro /system
reboot
---------- Post added at 10:26 AM ---------- Previous post was at 10:17 AM ----------
pinaz said:
https://github.com/pelya/commandergenius/issues/40#issuecomment-69908886
keycode and scancode swap for keys SLASH (Italian kbd: minus) and MINUS (IT kbd: apostrophe) may be a problem of the kernel remapping function or of CM11-CROMBI-KK, needs to be investigated
Click to expand...
Click to collapse
@_that : the swap between the MINUS and SLASH keys (respectively, apostrophe and minus in Italian keyboards) seems to be a problem at the kernel level.
I looked here:
http://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html#ss1.4
The correct scancode for US MINUS key is #0c (12) while for US SLASH key is #35 (53)
If I use @pelya 's input logger app, I get swapped scancodes (12 when I press US-SLASH/IT-minus, and 53 when I press US-MINUS/It-apostrophe, while it should be the other way round).
I did not notice it before because I was confused (in Italian kbd minus=US-SLASH, and apostrophe=US-MINUS, I saw KEY MINUS in the logger app when I was pressing It-minus and I thought it was OK, but it was not, I should see KEY SLASH instead!).
So I guess that it is something at the kernel level. @_that?
P.S. The same problem (swap of scancodes 12 and 53) happens also with an external wireless keyboard, so it is not a problem related to the asus dock kbd
pinaz said:
The correct scancode for US MINUS key is #0c (12) while for US SLASH key is #35 (53)
Click to expand...
Click to collapse
These are exactly the codes that I get when I run evtest, which operates directly on the kernel's event interface.
The key near the right Shift key ("/" on US keyboards, "-" on my German one) sends keycode 53 (KEY_SLASH).
The key next to 0 in the top row ("-" on US keyboards, "ß" on my German one) sends keycode 12 (KEY_MINUS).
The same happens on my PC.
_that said:
These are exactly the codes that I get when I run evtest, which operates directly on the kernel's event interface.
The key near the right Shift key ("/" on US keyboards, "-" on my German one) sends keycode 53 (KEY_SLASH).
The key next to 0 in the top row ("-" on US keyboards, "ß" on my German one) sends keycode 12 (KEY_MINUS).
The same happens on my PC.
Click to expand...
Click to collapse
mmm
I am not an expert in such kind of things
Do you think it is a problem of Asus hardware? Why am I getting wrong codes both on dock kbd and on external kbd?
(A simple workaround in my case is to use key remapping function in XServer XSDL, but I would like to solve the problem)
pinaz said:
Do you think it is a problem of Asus hardware? Why am I getting wrong codes both on dock kbd and on external kbd?
(A simple workaround in my case is to use key remapping function in XServer XSDL, but I would like to solve the problem)
Click to expand...
Click to collapse
No, the hardware works fine, and the kernel works correctly too - according to your own log output you're getting the correct scancodes:
Italian Kbd Apostrophe key: Keycode 76 KEYCODE_SLASH Scancode 12
Italan Kbd minus key: keycode 69 KEYCODE_MINUS Scancode 53
Click to expand...
Click to collapse
_that said:
No, the hardware works fine, and the kernel works correctly too - according to your own log output you're getting the correct scancodes:
Click to expand...
Click to collapse
You're right!
The fact that IT-MINUS corresponds to US-SLASH and not to US-MINUS was confusing me, sorry.
I repeated the tests having in mind the corresponding US keys, if I press US-MINUS I get 12, and if I press US-SLASH I get 53.
So it may be a problem of XServer XSDL.
I will check with @pelya
Thanks!
Alberto

Copy text to clipboard in shell

Interacting with the Clipboard from the shell can be difficult.
It used to be easier and you could use service call clipboard ...
Nowadays Clipboard only takes ClipData.
Ok, you could still do it using the service executable but you'd have a long list of opaque numbers.
I wrote a regular executable (not using any Java itself) to fill the Clipboard with your text.
It works for UTF-8, although I haven't gotten it to work pretty-like on Windows.
(I got the CHCP 65001, but I don't have a font for the console.)
Code:
# /data/local/tmp/copyclip 'I want to go to 中关村科贸电子城.'
This is an ELF64, you have to be rooted, it's a beta and everything is subject to change.
It works on A10. Later Android might need some fixes for attribution tags.
You should rename it to plain "copyclip".
Just park it somewhere (/data/local/tmp is fine) and chmod 755 it.
I've made a few tiny tweaks.
You can do the paste automatically, but there's a rub.
The input keyevent is pretty stupid because it rolls out a whole zygote just to inject a key.
Still, if you don't expect performance you can always:
Code:
# ./copyclip 'The short tedious text' && input keyevent 279
Normally, I do either a USB HID device or a key injector daemon if I want performance.
As noted previously, copyclip itself doesn't roll out a zygote, so it's quick.
Edit: Update again March 7th.
Yet another fine tuning.
I'm thinking about -e processing like echo has.
copyclip can be found in my sig.
Hmm, that's interesting. There were big changes in ClipData from A10 to A11.
This wouldn't work if you are on A11.
There's a two new versions out that works for at least A9, A10 & A11, either 32 bit or 64 bit.
If you're not rooted you'll probably get:
Code:
Error: Package android does not belong to 2000
You'll find it in the sig.
I'd appreciate any feedback on success/failure.
It seems like this would be really useful for entering snippets of Unicode text selected from the desktop.
input text can't handle Unicode.
One of the reasons that I'm having fun with this is the efficiency of not using app_process/Zygote/Java.
Code:
Poke3:/ # time input text Hello
0m00.51s real 0m00.28s user 0m00.20s system
Poke3:/ # time /data/local/tmp/copyclip Hello
0m00.04s real 0m00.01s user 0m00.02s system
Yow! I love talking to myself! I'm 7 posts in and no interruptions from somebody who wants to know something.
I just posted (Win32) adbclip.exe, an amazing accessory that works in concert with (Android) copyclip.
If you're on your desktop you can go to some nice Korean (or Japanese or Arabic or English) website, select some text and then paste it to the Android clipboard!
Amazing, eh?
All the details are in my sig, or more directly: http://www.temblast.com/copyclip.htm.
The Android utility copyclip has been updated:
You can style the text bold with -b and/or italic with -i
You can pipe other shell commands to it: date | /data/local/tmp/copyclip

Categories

Resources