08-27-2016, 04:26 AM | #1 |
Connoisseur
Posts: 54
Karma: 60222
Join Date: Aug 2016
Device: PW3, Kobo Aura H2O
|
OTG Keyboard Support - Kludged Together Solution!
Objective
*Full USB OTG keyboard support so that my kindle can be used as a long-lasting outdoor writing device. StatusSolution (inelegant, kludged together, but working for now): lucida's usb otg kindlet (start otg service, then plug in hub/keyboard) coplate's makexconfig copied to /var/local/kindlekbd per knc1 and: Code:
# mntroot rw # mount -o bind /var/local/kindlekbd /etc/upstart/makexconfig # mntroot ro # restart x *work in progress Current (known) problems & Next Steps* external battery does not power the hub, so writing time will be shortened * automate all this in a KUAL extension (probably just modifying lucida's scripts) * learn more about why my earlier attempts failed in such an odd manner Kindle PW3, FW 5.8.1 Earlier aspects of post, put in spoiler b/c I can't seem to format a strikethrough font ;-)Jailbroken following knc1's post KUAL USB OTG Mouse support by lucida and team uGreen Powered USB OTG hub Storm Quickfire Rapid non-LED keyboard 10000mA battery Spoiler:
Any thoughts are welcome and appreciated as I continue to tinker on this. I created a separate thread, as I didn't want to hijack lucida's (which seems to have a different end goal), but I'll merge this if that's the etiquette/most useful idea here here. Last edited by glasnost; 08-28-2016 at 06:02 AM. Reason: It's WORKING! |
08-27-2016, 08:53 AM | #2 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
you missed making the root filesystem rw
Code:
mntroot rw ; mount --bind whatever ; mntroot ro Last edited by knc1; 08-27-2016 at 08:55 AM. |
Advert | |
|
08-27-2016, 03:27 PM | #3 | |
Connoisseur
Posts: 54
Karma: 60222
Join Date: Aug 2016
Device: PW3, Kobo Aura H2O
|
Quote:
I'll give it a shot :-) |
|
08-27-2016, 03:54 PM | #4 | |
Guru
Posts: 645
Karma: 1888888
Join Date: Jun 2009
Device: prs-505, Kindle Keyboard 3g, PW3
|
Quote:
Don't bind '/etc/xorg.conf', copy and bind '/etc/upstart/makexconfig', when X is restarted, it runs this script to delete and recreate /etc/xorg.conf. You can have teh makexconfig make all the same changes that you did to your xorg.conf. Or bind both of them, and make makexconfig just an empty script, so it doesn't delete the other file. If you upload your makexconfig, I can add all the changes needed for your device, the only real difference between mine and yours should have been the /dev/input/exentXXX number of the keyboard You also shouldnt need a 'kill x' and a 'restart x', I would think you can pick 1 or the other, through I recommend 'restart x' Last edited by coplate; 08-27-2016 at 04:04 PM. |
|
08-27-2016, 04:26 PM | #5 |
Guru
Posts: 645
Karma: 1888888
Join Date: Jun 2009
Device: prs-505, Kindle Keyboard 3g, PW3
|
I wrote a makexxconfig that will automatically detect keyboard and mouse, that are NOT the touchscreen.
the keyboard checks for key 'F4', and the mouse checks for "relative movement in the X direction" which the touchscreen does not have. It also comments out the 5 way keypad, so if someone accidentally runs on the device with that, it wont break. I also attached a copy of the xorg.conf that it generates. The part to compare to the original in the makexconf is the loop where it checks all the devices: # Scan for input device and call associate output function do_input() |
Advert | |
|
08-27-2016, 04:54 PM | #6 | |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
If you wish to give the user a chance to escape from a bad file or other incompatible change with a simple re-boot . . . Then use a bind mount. Making sure it is not automatically created by the start-up code, only by the menu entry to enable it. If neither you nor the computer never makes an in-compatible file change that someone might need to escape from, then change the system file. |
|
08-27-2016, 06:19 PM | #7 |
Addict
Posts: 229
Karma: 136002
Join Date: Apr 2013
Device: PW
|
Keep up the good work, this is very cool, fantastic. Great for ssh-ing into remote servers to perform some tasks. Although funny the keyboard will be by far the biggest thing!
|
08-27-2016, 07:31 PM | #8 | |
Connoisseur
Posts: 54
Karma: 60222
Join Date: Aug 2016
Device: PW3, Kobo Aura H2O
|
Quote:
* I've tried with both a mouse and keyboard, as well as just a keyboard. Ideally, I'd like just the keyboard (and to use the touchscreen for pointer, so no need for the cursor, though I can always edit that later) knc1 - when I do a bind mount of xorg.conf directly, it seems to get overwritten by the makexconfig (like coplate has found). I must be missing a step, or need to do the makexconfig phase like coplate. |
|
08-27-2016, 07:49 PM | #9 | |
Connoisseur
Posts: 54
Karma: 60222
Join Date: Aug 2016
Device: PW3, Kobo Aura H2O
|
Quote:
Situation: #mount -bind /var/local/xorg.conf /etc/xorg.conf #restart X /Etc/xorg.conf is overwritten by makexconfig If / was mounted rw, then bound, then ro - /etc/xorg.conf would still be overwritten by makexconfig because makexconfig would need rw privs in order to write xorg.conf in the first place, no? And if not, then wouldn't a reboot leave you with the edited xorg.conf? I think this is why coplate is suggesting the 'mount bind and edit makexconfig route.' Or I'm completely wrong and confusing the situation. |
|
08-27-2016, 07:53 PM | #10 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
What are you trying to do with this statement?
Code:
InputDevice \"keyboard"\ \"CoreKeyboard" |
08-27-2016, 08:17 PM | #11 | |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Quote:
You can't mount to a ro mount point, at least not in Linux, which this is. The "mount --bind" operation will not persist across re-boots, unless you write code to make it happen as part of the boot process. The directory name is /etc not /Etc /var/local is the file system on partition #3, the / file sytem is on partition #1. The Kindle script provided by Lab126 changes the rw/ro status of the file system mounted as / The script does not affect any other partitions / file systems. The change of status of / is not reflected in /var/local (because the file systems are independent backing stores). In analogy, in some operating systems you can change the rw/ro status of the B:\ drive (backing store) without affecting the A:\ drive (backing store). Typical of a multi-rooted file tree. Linux (and all other *nix) uses a single rooted file tree and a backing store(s) per mount point. X11 is compiled to look at only one place for its configuration file, /etc/xorg.conf That must be set before X11 starts or re-starts, you can change it while X11 is running because it is only read during X11 start-up. = = = = = = Now consider the sequencing of operations all that above implies - Kindle is running normally, un-modified. Your scripting is triggered (called) either by a KUAL menu entry or a u-dev rule (however/wherever you program it). Make the root file system writable (so the mount command does not fail) Do the bind mount with the custom file. Return the root file system to ro Restart X11 without calling upstart - send: ctrl-alt-backspace to X11 on X11's keyboard input. (or maybe it also has a restart signal (interrupt), I forget) I just looked for it, but my google foo is failing today, try sending SIGINT to X11. You can try the last on your desktop - X11 is X11 is X11 etc You probably want to bring up an alternate session (ctrl-alt-function-key, other than F7 - which is usually what X11 is running on) before sending SIGINT to the X11 session running your GUI. ; Last edited by knc1; 08-27-2016 at 08:26 PM. |
|
08-27-2016, 11:23 PM | #12 | |
Connoisseur
Posts: 54
Karma: 60222
Join Date: Aug 2016
Device: PW3, Kobo Aura H2O
|
Quote:
Code:
[root@kindle root]# cd /mnt/us/MyProject/ [root@kindle MyProject]# echo "blahblahblah" > ./badxorg.conf [root@kindle MyProject]# ls Installbinaries Keyboard Uninstallbinaries badxorg.conf iptables.log [root@kindle MyProject]# mount -o bind /mnt/us/MyProject/badxorg.conf /etc/xorg.conf [root@kindle MyProject]# cat /etc/xorg.conf blahblahblah [root@kindle MyProject]# Code:
[root@kindle MyProject]# mount | grep -i etc /dev/loop/4 on /etc/kdb.src type cramfs (ro,noatime,nodiratime) /dev/loop/4 on /chroot/etc/kdb.src type cramfs (ro,noatime,nodiratime) /dev/root on /chroot/etc/fonts type ext3 (ro,noatime,nodiratime,barrier=0,data=writeback) /dev/root on /chroot/etc/gtk-2.0 type ext3 (ro,noatime,nodiratime,barrier=0,data=writeback) /dev/root on /chroot/etc/pango type ext3 (ro,noatime,nodiratime,barrier=0,data=writeback) /dev/root on /chroot/etc/resolv.d type ext3 (ro,noatime,nodiratime,barrier=0,data=writeback) Code:
InputDevice \"keyboard"\ \"CoreKeyboard" Let me try again with a custom xorg (just adding the keyboard to the core script) and I'll (hopefully) be able to report back that it works. Thank you for bearing with me, knc1! Last edited by glasnost; 08-28-2016 at 03:21 AM. |
|
08-27-2016, 11:57 PM | #13 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Check if the 'mount' command is being provided by busybox or if it is a standalone binary.
It could be you are using the BB 'mount' command and that minimized version is missing the error message about the mount point being on a read-only file system. Because it certainly failed in the example you give. Another thing to check - - Although /etc/xorg.conf is only read once, on start-up - - It may still be held open by X11 - So run a listing of open files, see if it is being held open. Because if it is, it will not matter if it is over-written or even deleted, the /etc directory is on an inode file system, the original data will still be read. - - - - If you pause the framework, does that shutdown X11? I.E: There should be a nice clean way to get upstart to help you, rather than fight you. Last edited by knc1; 08-28-2016 at 12:04 AM. |
08-28-2016, 05:50 AM | #14 |
Connoisseur
Posts: 54
Karma: 60222
Join Date: Aug 2016
Device: PW3, Kobo Aura H2O
|
OMG: lucida, coplate, knc1 - I <3 you all!
Between the three of you, my machine is alive! problem 1 - #mount -o bind wasn't working b/c mntroot was not rw. Busybox wasn't reporting anything and files appeared to be altered, but it wasn't working. As such, nothing stuck. That said, xorg.conf is a forced symbolic link from /var/local/xorg.conf and var/local/xorg.conf is always rewritten by upstart when doing 'restart x' Problem 2 - broken xorg.conf from makexconfig - honestly, I don't know what happened. I do not understand the file interactions well enough to figure out why I was generating those weird conf files using @coplate's cursor2 scripts. Especially because root was not mounted rw when I tried the bind mount. Solution (inelegant, kludged together, but working for now): lucida's usb otg kindlet (start otg service, then plug in hub/keyboard) coplate's makexconfig copied to /var/local/kindlekbd per knc1 and: Code:
# mntroot rw # mount -o bind /var/local/kindlekbd /etc/upstart/makexconfig # mntroot ro # restart x |
08-28-2016, 10:19 AM | #15 |
Going Viral
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
The mount point can be a device, a directory or a file -
It can not be a symbolic link. Sorry, it didn't occur to me to ask you to check for that condition. I just assumed that the up-start script was changing the rw/ro status of /etc before it generated the config file. That, and the lack of proper messages from the busybox version of the 'mount' command made this a lot more difficult than it has to be. - - - - - - {rant} Why didn't Lab126 re-configure X11 to get its configure file from /var/local/etc/x11.conf to begin with? After all, they are doing a custom build-from-source for every firmware release. {/rant} Hmm... that is a rhetorical question, there may be a very good reason that escapes me at the moment. Last edited by knc1; 08-28-2016 at 10:22 AM. |
Tags |
external, input device, keyboard, otg, pw3 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OTG support | Kumabjorn | Kindle Developer's Corner | 73 | 05-05-2024 11:24 AM |
USB OTG Mouse Support and page turn on PW3(possible KV/KOA) | lucida | Kindle Developer's Corner | 104 | 01-01-2022 01:21 AM |
[Progress] Jailbreaking Kindle 4.0 (Touch/No Keyboard) | yifanlu | Kindle Developer's Corner | 434 | 04-22-2016 11:29 AM |
CC and USB/OTG support | GEB | Calibre Companion | 2 | 05-30-2015 01:24 PM |
ebook android readers and usb host - otg support | sasimako | Which one should I buy? | 4 | 02-18-2015 07:26 AM |