View Single Post
Old 06-27-2015, 06:20 PM   #7
fastrobot
Connoisseur
fastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to beholdfastrobot is a marvel to behold
 
Posts: 53
Karma: 11844
Join Date: Jun 2014
Location: All over the place...
Device: KOBO AuraHD and GLO
Quote:
Originally Posted by NiLuJe View Post
IIRC, syslog doesn't log to a file on the Kobos, it only keeps track of the n'th latest events in memory, which you can access via logread.

No idea if udev even tries to communicate with the system logger properly on the Kobos, though.
Hmmm... it really doesn't look like it .
And the data in DMESG is actually different than that in logread.... I gave up, and worked the bug out a different way by running scripts on each rule, and having the scripts echo results to my own log file.

What was causing the problem is that I didn't realize that Udev no longer allows the changing of names of devices via the NAME variable... but I really need to change the actual name created in /dev/input, as nickel is hardwired to use a specific name. (I don't want to have to edit libnickel and pickel for future updates.)

And yes, I had to actually compile a dummy device driver (proxyevent) to act as a fifo so that nickel can do ioctls(), and read ABS ranges, etc. Apparently there is a user interface called 'uevent' that can make userspace driven dummy drivers -- but doing it that way was just as complicated (and probably longer code wise) than just duplicating the zforce kernel driver as a skeleton. So I just made a kernel driver because it was simpler.

I made UDEV replace the zforce driver with a dummy driver like this:

udev rule: 60-zforce-proxy.rules
Code:
ACTION=="add", KERNEL=="event*", SUBSYSTEMS=="input", ATTRS{name}=="zforce-ir-touch",  RUN+="/etc/udev/zforce-proxy.sh add %k"
ACTION=="remove", KERNEL=="event*", SUBSYSTEMS=="input", ATTRS{name}=="zforce-ir-touch", RUN+="/etc/udev/zforce-proxy.sh remove %k"
And script to actually swap out event1 with whatever the proxy is named....
Code:
#!/bin/sh
ORIGINAL="event1"
# Add and remove proxy from system

cd /dev/input
if [[ "$1" == "add" ]]; then
	if [[  -e $ORIGINAL && ! -h $ORIGINAL ]]; then
		mv $ORIGINAL zforce # Orignal renamed to zforce
		ln -s $2 $ORIGINAL  # Original now points at the proxy
		ln -s $2 zforce-proxy # Add a symlink for clarity
	fi
	exit 0
fi

if [[ "$1" == "remove" ]]; then
	if [[ -e zforce && ! -h zforce ]]; then
		mv zforce $ORIGINAL # Restore the original when proxy removed
		rm zforce-proxy
	fi
fi
Basically, all I had to do was add those rules to /etc/udev/rules.d, add the script to /etc/udev and then place the dummy kernel module (lazy, I just put it on root) and then patch the rcS script to load it for a test.

patch for rcS.
Code:
# Add these lines to /etc/init.d/rcS right after DBUS_SESSION_BUS_ADDRESS=
insmod /proxyevent.ko
hostname YourNameForKobo
udevadm trigger
udevadm settle
cat /dev/input/zforce > /dev/input/zforce-proxy &
/mnt/onboard/autorun.sh &
sleep 2
The dummy driver and udev script works really well on my AuraHD ; I just have my keyboard driver kill the 'cat' function, and then replace it with a keyboard filter script (not shown) to switch back and forth between a framebuffer terminal program, and the kobo reader.

But for some strange reason, the Kobo GLO's the system appears to crash andomly when not being used (idle) for a minute or more. I thought the GLO and AuraHD were supposed to use the same firmware, so I'm not sure what's wrong.

42d520248dba93f5ae5299e7604e5260 proxymodule.tar.gz
de6bd9fc931a1ff003a8dacd1d02f3d3 udevzforce.tar.gz
Attached Files
File Type: gz proxymodule.tar.gz (30.0 KB, 222 views)
File Type: gz udevzforce.tar.gz (10.0 KB, 233 views)

Last edited by fastrobot; 06-29-2015 at 01:08 AM. Reason: Typographical error, and double clicked a mouse paste which was corrupt.
fastrobot is offline   Reply With Quote