03-11-2012, 10:18 AM | #1 |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Kindle input event device file names can CHANGE.
I have been doing most of my native mode program and script testing in diags SSH recently, because on the k4 and touch, there is a "Lock to HOME Button" menu item, and I can safely test touchscreen events there without accidentally pressing active buttons or menu items on the window hidden below my app.
I discovered that when I boot my touch to main and launch SSH using yifanlu's launcher menu, the touchscreen events are at /dev/input/event4 like I documented some time ago in mobileread posts. But when I boot diags and run SSH from the "Enable USBnet" menu, the touchscreen events are at /dev/input/event3 like I have been using in my recent scripts: touchpaint (touchscreen ascii paint), and oskb (onscreen keyboard). This means that even on a single device, we cannot trust input device filenames. We must follow the examples for linux event processing shown elsewhere on the net, where those examples scan ALL input devices, looking for one with PROPERTIES that match the device that we want to use. The "correct" way to open an input event device must first FIND that device, making no assumptions as we have been doing here (including other event processing such as in the myts onscreen terminal). We must NOT just ASSUME that a device has a fixed file name, even on a kindle touch. And while discussing linux devices, perhaps a native mode app can easily control framework menus and kindlets with this gizmo daemon: Last edited by geekmaster; 03-11-2012 at 10:28 AM. |
03-11-2012, 10:28 AM | #2 |
(offline)
Posts: 2,907
Karma: 6736092
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
Some of the event devices (unfortunately not all, and probably not those that you want ) also have symbolic names:
Code:
[root@kindle input]# ls -la drwxr-xr-x 3 root root 160 Mar 10 18:15 . drwxr-xr-x 16 root root 1120 Mar 11 15:15 .. drwxr-xr-x 2 root root 100 Mar 10 18:15 by-path crw-r----- 1 root root 13, 64 Mar 10 18:15 event0 crw-r----- 1 root root 13, 65 Mar 10 18:15 event1 crw-r----- 1 root root 13, 66 Mar 10 18:15 event2 crw-r----- 1 root root 13, 67 Mar 10 18:15 event3 crw-r----- 1 root root 13, 68 Mar 10 18:15 event4 [root@kindle input]# ls -la by-path/ drwxr-xr-x 2 root root 100 Mar 10 18:15 . drwxr-xr-x 3 root root 160 Mar 10 18:15 .. lrwxrwxrwx 1 root root 9 Mar 10 18:15 platform-soc-audio.1-event -> ../event1 lrwxrwxrwx 1 root root 9 Mar 10 18:15 platform-whitney-button-event -> ../event2 lrwxrwxrwx 1 root root 9 Mar 10 18:15 platform-zforce.0-event -> ../event4 |
Advert | |
|
03-11-2012, 10:33 AM | #3 |
Wizard
Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
|
Edit: the following was directed at OP, was too slow to type :-)
Quite right, but, err, *cough*, you can just open every input device that comes across. In most cases, that is. You get input events, and frankly probably don't care if that's from the touchscreen or an USB digitizer tablet that some mad-minded hacker managed to connect to the kindle... There would however be reasons from a security standpoint against this. But there are much, much bigger security flaws to fix first (thinking of my K3 running everything and the kitchen sink as root, probably just because system integrators were lazy). |
03-11-2012, 10:36 AM | #4 | |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
Those "by-path" names (such as "whitney") look rather device-specific. For all we *should* care, that HOME button on a touch is just a keyboard button. I am a firm believer in the KISS principle: http://en.wikipedia.org/wiki/KISS_principle But we also need to follow the Einstein principle too: http://c2.com/cgi/wiki?EinsteinPrinciple Perhaps I just want my code to be TOO simple. |
|
03-11-2012, 10:38 AM | #5 | |
(offline)
Posts: 2,907
Karma: 6736092
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
Quote:
|
|
Advert | |
|
03-11-2012, 10:55 AM | #6 | |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
Although we may WANT to process all device events (including the "headphone insertion and removal" events at the "headphone jack" device), I do not believe that it is a safe to assume that we can identify an event as coming from a device without knowing WHICH device that event came from. Here is what I mean about the "correct" way to find a device with the properties we want: http://www.linuxjournal.com/article/6429?page=0,1 |
|
03-11-2012, 11:04 AM | #7 | |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
The accelerometer is a different device (which CAN detect violent shaking, by the way, so your IDEA is sound). We just need a reliable method of detecting a device REGARDLESS of its specific device file name, or its descriptive name either. Only its PROPERTIES are important. EDIT: Without actually doing the research, I think we can guess why they called the touchscreen device "z-force"... When you apply force, your finger tip deforms, blocking more light, so you CAN indirectly determine the amount of force being applied to the touchscreen. There is a nifty little toy built into the touch that will demonstrate this (and what I used to prove that you can determine the diameter of a coin placed on the touchscreen): mount /dev/mmcblk0p2 /mnt/mmc /mnt/mmc/usr/local/bin/zforcediag This cool little tool shows how much light your finger is blocking from the X and Y light sensors. It also demonstrates that you can interpolate much higher resolution than expected by comparing the ratio of light blockage from the outer partially blocked sensors. You can see in the kindle touch teardown photos that there are not many LEDs or photosensors on the touch PCB, so analog interpolation is needed to get the 4096x4096 high resolution we get from this device. Also, it is interesting to see that we can read the touchscreen at a lower level (individual LEDs) than is provided by input device events. Last edited by geekmaster; 03-11-2012 at 12:07 PM. |
|
03-11-2012, 11:34 AM | #8 |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
A bit off-topic, but while looking for the code I saw before that scans devices to find the one you want, I think I discovered why I respond defensively when certain people in this forum question the accuracy of my facts, without supplying any of their own facts or references:
http://c2.com/cgi/wiki?AggressiveListening I think that some replies to my posts in other threads fall into the "aggressive listening" category, which tends to irritate me in ways that I cannot easily describe. You may have seen posts where I went a bit overboard on my self-defensive replies (then later removed a lot of the "self-justification" content). For me, "false accusations" have always been a "hot button". Sorry... At least now I know why (read the above link). EDIT: Amazing what you find accidentally, while looking for something else, isn't it? I think Google found that one because it contains "we pass the contents of the event with the notification". Last edited by geekmaster; 03-11-2012 at 11:54 AM. |
03-11-2012, 12:14 PM | #9 | |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
When you plug a "USB Rubber Ducky" into a USB port on a "victim" computer, the computer OS thinks it is a new "USB keyboard", so even without permission, it just starts "typing stuff" for you... Last edited by geekmaster; 03-11-2012 at 12:17 PM. |
|
03-11-2012, 12:52 PM | #10 |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
cat /proc/bus/input/devices
Interestingly, when in diags bootmode, the contents of /etc/xorg.conf are not correct... Last edited by geekmaster; 03-11-2012 at 02:23 PM. |
03-11-2012, 02:22 PM | #11 |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Here is some "evtest" output from touch diags SSH:
PHP Code:
Last edited by geekmaster; 03-11-2012 at 02:28 PM. |
03-11-2012, 03:51 PM | #12 | |
Wizard
Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
|
Quote:
What I meant above, BTW, is to listen for all events (on all devices) and then handle the events you care about. E.g. keypresses, touchscreen events etc. Trust them to generate certain key codes/event values, don't bother with addressing. Of course you're right that physical access is always the biggest threat to the security of a computer. Well, but the physical access path isn't something I would worry about on my Kindle. If someone took it from me, I'm not trusting it anymore as a computing platform anyway. And don't think you could lure me into soldering a connection cable to a 1V8 TTL controlled rubberduck on my ebook reader :-P |
|
03-11-2012, 06:56 PM | #13 | |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
Beware kindle hacks you did not compile from your own source code. |
|
03-11-2012, 07:07 PM | #14 | |
(offline)
Posts: 2,907
Karma: 6736092
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
|
Quote:
... just kidding. But it sure is a valid point. |
|
03-11-2012, 07:16 PM | #15 | |
Carpe diem, c'est la vie.
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
Some years ago, the US military discovered that the standard C compiler distributed with Unix systems contained binary code that was NOT in its source code, even after compiling it yourself. Further study showed that the C compiler recognized when it compiled itself, and injected that extra payload into the next version. It had been this way since the early days. But the *real* payload was that it ALSO recognized when it was compiling the login application, and it inserted a secret backdoor login account and password that was not in the passwd file. Some of the well-known "big names" in the Unix world had to appologize to the US military and promise to never do it again. Last edited by geekmaster; 03-11-2012 at 07:22 PM. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need to modify the file names on my kindle | jbcohen | Amazon Kindle | 27 | 04-01-2023 10:11 AM |
File names on device | tempestadept | Devices | 4 | 04-13-2012 11:50 AM |
Kindle Fire file names | dgirts | Kindle Fire | 1 | 02-15-2012 07:18 PM |
Remove and Add pages and change file names | emonster | ePub | 0 | 01-26-2012 01:05 PM |
Kindle File Names | Captain Skurvy | Amazon Kindle | 2 | 08-14-2010 02:22 AM |