Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 06-26-2012, 02:37 PM   #1
tonyv
Member
tonyv began at the beginning.
 
Posts: 13
Karma: 20
Join Date: Oct 2009
Device: elonex eb600
Hacking Kobo Touch suspend usb network eink driver

Hi
Usb networking i have got it to work at boot using 19.16 and 19.17
having it work at boot will mean you can't have it in usb mass storage mode
prob workaround hacking /usr/local/Kobo/udev/usb which seems to be invoked by nickel
when you press connect on popup
Howto
get wifi telnet access using this guide
https://wiki.mobileread.com/wiki/Kobo_Touch_Hacking

manually on kobo
before plugging in
>killall nickel
can restart with http://pastebin.com/gEuQpaU5
>/bin/busybox insmod /drivers/ntx508/usb/gadget/arcotg_udc.ko
>/bin/busybox insmod /drivers/ntx508/usb/gadget/g_ether.ko
plugin don't connect through nickel (main app)
>ifconfig usb0 192.168.2.2
on pc
>lsusb
should get Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget
if so then
>ifconfig usb0 192.168.2.1
>telnet 192.168.2.2

Automatic at boot:

on kobo ( prob easiest to edit on pc and ftp back to kobo i use Gftp on ubuntu)
>killall nickel
can restart with http://pastebin.com/gEuQpaU5
put these command at end of /etc/init.d/
/bin/busybox insmod /drivers/ntx508/usb/gadget/arcotg_udc.ko
/bin/busybox insmod /drivers/ntx508/usb/gadget/g_ether.ko

put these at end of /usr/local/Kobo/udev/ac and /usr/local/Kobo/udev/plug
ifconfig usb0 192.168.2.2
prob don't need to put in both but i'm to lazy to check
>reboot
after main gui Ithink it doesn't matter) plug into pc
ignore popup
On pc
>ifconfig usb0 192.168.2.1


I think i have worked out suspend
echo 1 > /sys/power/state-extended //turns of neonode touchscreen
echo mem > /sys/power/
then after resume
echo 0 /sys/power/state-extended
found this file after looking at strace of nickel
open("/sys/power/state-extended", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 3
dup2(3, 1) //copy filehandle
write(1, "1\n", 2) = 2
execve("/bin/sh", ["sh", "-c", "echo mem > /sys/power/state"]

from kobolabs source /KoboLabs/hw/imx508/cls/linux-2.6.35.3/kernel/power/main.c

static ssize_t state_extended_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t n)
{
if ( buf[0] == '1' )
{
if(!g_sys_full_suspend_state)
{
neonode_activate(0); disable_irq_wake(get_homekey_irq());

g_sys_full_suspend_state=1;
}
}else if(g_sys_full_suspend_state)
{
neonode_activate(1);
enable_irq_wake(get_homekey_irq());
g_sys_full_suspend_state=0;
}

I have tried the above with wifi off and unplugged it seems to work but have not fully tested by looking at battery level after awhile.
Eink stuff next post.
Cheers
Tony

Last edited by tonyv; 06-29-2012 at 10:47 AM.
tonyv is offline   Reply With Quote
Old 06-26-2012, 06:56 PM   #2
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Very interesting. I would try it out if I still had a Touch, but I don't.
KevinShort is offline   Reply With Quote
Advert
Old 07-05-2012, 03:24 PM   #3
sven
Enthusiast
sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.
 
Posts: 39
Karma: 454
Join Date: Jul 2012
Location: Brussels
Device: Kobo Touch
No g_ether.ko

Hi all,

A couple of months ago I also tried to get the usb networking running. Unfortunately I had no success, all I got was an error message:

[root@(none) /]# /bin/busybox insmod /drivers/ntx508/usb/gadget/arcotg_udc.ko
insmod: can't insert '/drivers/ntx508/usb/gadget/arcotg_udc.ko': invalid module format

Same result with force-option for insmod:

[root@(none) /]# /bin/busybox insmod -f /drivers/ntx508/usb/gadget/arcotg_udc.ko
insmod: can't insert '/drivers/ntx508/usb/gadget/arcotg_udc.ko': invalid module format

I'm running 1.9.17, the kernel version of my Kobo Touch is as follows:

[root@(none) /]# uname -r
2.6.35.3-568-g4cf53cf-00050-g1422e3c-dirty

The version of the kernel module is:

[root@(none) /]# /bin/busybox modinfo /drivers/ntx508/usb/gadget/arcotg_udc.ko
filename: /drivers/ntx508/usb/gadget/arcotg_udc.ko
description: ARC USBOTG Device Controller driver
author: Freescale Semiconductor
license: GPL
vermagic: 2.6.35.3-850-gbc67621+ preempt mod_unload modversions ARMv7

It seems that both versions do not match. The version of the kernel module in the freescale branch is closer and I can load the module with insmod:

[root@(none) /]# /bin/busybox modinfo /drivers/freescale/usb/gadget/arcotg_udc.ko
filename: /drivers/freescale/usb/gadget/arcotg_udc.ko
description: ARC USBOTG Device Controller driver
author: Freescale Semiconductor
license: GPL
vermagic: 2.6.35.3-568-g4cf53cf-00044-g1bab09b-dirty preempt mod_unload modversions ARMv7

But there is no g_ether.ko in that folder, only g_file_storage.ko.

I would appreciate any idea how to force busybox insmod to take a module with a different version magic, or how to get the right g_ether.ko module.

Thanks,

Sven

Last edited by sven; 07-05-2012 at 04:03 PM.
sven is offline   Reply With Quote
Old 07-08-2012, 08:56 PM   #4
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Maybe you could compile the proper g_ether.ko using the linux kernel
from Kobo's git repository.
KevinShort is offline   Reply With Quote
Old 07-09-2012, 04:50 PM   #5
tonyv
Member
tonyv began at the beginning.
 
Posts: 13
Karma: 20
Join Date: Oct 2009
Device: elonex eb600
Hi Sven
This what i have found out:
on kobo
uname -r
2.6.35.3-850-gbc67621+
this is from 1.9.16 from recovery partition
this from unzipped http://download.kobobooks.com/firmwa...ate-1.9.17.zip
on pc
strings /kobo3-update-1.9.17/upgrade/ntx508/uImage | grep "2.6.35"
Linux-2.6.35.3-850-gbc67621+
/kobo3-update-1.9.17/drivers/ntx508/usb/gadget$ md5sum *
40b89f6e1836896cec7017f9d7b85e30 arcotg_udc.ko
080fb7caa98968fdaad1aa37d6a956a1 g_ether.ko
f794893729ef24ec5a74fe44db81a9a8 g_file_storage.ko
same md5 from kobo 1.9.16
/usr/local/Kobo/udev/usb implies ntx508 directory is the right one

/kobo3-update-1.9.17/upgrade/strings uImage | grep "2.6.35" // assume uimage of wireless kobo
Linux-2.6.35.3-568-g4cf53cf-0005

incidentally about cross compiler on kobo
strings /lib/libc.so.6 | grep ourcery
GNU C Library (Sourcery G++ Lite 2010q1-202) stable release version 2.11.1, by Roland McGrath et al.

Only thing i can think of is that you got a wireless kobo rather than touch though string from uimage is different but closer than to the touch.

If you have wireless KevinShorts solution seems the only way.
http://blog.ringerc.id.au/2011/01/se...serial-on.html

Tony

Last edited by tonyv; 07-09-2012 at 05:01 PM.
tonyv is offline   Reply With Quote
Advert
Old 07-11-2012, 09:45 AM   #6
sven
Enthusiast
sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.
 
Posts: 39
Karma: 454
Join Date: Jul 2012
Location: Brussels
Device: Kobo Touch
Tony, Kevin,

Many thanks for your support. Finally I ended up with building my own g_ether.ko from source. Since the CodeSourcery toolchain didn't work for me, I switched to Ubuntu gnu-arm-toolchain. And voilá, I could load the module and connect to my Kobo Touch via USB network.

I am still wondering why I get 568 from uname and Tony gets 580. I am sure I have a Kobo Touch including Wifi. Maybe there are different hardware models on the market. I bought my one (Model: N905) in Germany.

Since I am now "familiar" with the gnu-arm toolchain I am looking forward to get multitouch running. As far as I know Nook Simple Touch is also based on Neonode zForce touch interface, and for this one some multitouch tweaks exist. I had a first look into the sources (neonode.c) and it shouldn't be too complicated to report more than one touch event at the same time.


Cheers,

Sven
sven is offline   Reply With Quote
Old 07-26-2012, 10:30 AM   #7
cc13
Junior Member
cc13 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jul 2012
Device: none
Hi Sven,
I am also getting 568 from uname and I am trying to build g_ether.ko from source. What did you use for a .config file? The repository on github seems to be missing it. Also was there a way for you to build only the module or did you have to build the entire kernel to get it?
Thanks!
cc13 is offline   Reply With Quote
Old 07-26-2012, 03:42 PM   #8
sven
Enthusiast
sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.
 
Posts: 39
Karma: 454
Join Date: Jul 2012
Location: Brussels
Device: Kobo Touch
Hello cc13,

You can find an appropriate config file config.gz on your Kobo in the /proc directory. This is the config that was used for building the kernel. Just extract and copy it into your linux source directory.
Then you have to do a make menuconfig to select the g_ether module for building (<M> option). Now, you can build the modules with make modules command.
May I ask what tool-chain you are going to use? With the CodeSourcery chain I had no luck, neither on a Windows nor on a Linux box. Now I am using the gnu-arm chain in an Ubuntu environment.

Regards,
Sven
sven is offline   Reply With Quote
Old 07-27-2012, 09:30 AM   #9
cc13
Junior Member
cc13 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jul 2012
Device: none
Thank you! The /proc/config.gz was exactly what I was looking for! I was not able to configure it with menuconfig though (I think that needs intermediary config files), so I just used oldconfig instead.
I used CodeSourcery from a Ubuntu host and everything worked perfect for me. But I did not try 'make modules', I just ran 'make ARC=arm CROSS_COMPILE=arm-linux-'. CodeSourcery is the only ARM target compiler I have installed.
cc13 is offline   Reply With Quote
Old 08-06-2012, 08:43 AM   #10
tonyv
Member
tonyv began at the beginning.
 
Posts: 13
Karma: 20
Join Date: Oct 2009
Device: elonex eb600
Hi
This is config from git imx5_product_trilogy_defconfig https://github.com/kobolabs/Kobo-Reader/issues/10
Why don't sven or cc13 upload your g_ether.ko.
Tony
tonyv is offline   Reply With Quote
Old 08-06-2012, 02:38 PM   #11
sven
Enthusiast
sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.
 
Posts: 39
Karma: 454
Join Date: Jul 2012
Location: Brussels
Device: Kobo Touch
Tony,

No problem for me to upload my g_ether module. But if you have a look at the number of views of this thread there seems to be not that much interest in this topic (unfortunately).

Sven
Attached Files
File Type: gz g_ether.ko.tar.gz (21.4 KB, 556 views)
sven is offline   Reply With Quote
Old 12-06-2012, 09:32 PM   #12
ryanthejuggler
Junior Member
ryanthejuggler began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Dec 2012
Device: Kobo Touch
Not much interest?!? Thank you so much, I've been STRUGGLING with this!

However, my laptop keeps giving me an "activation of network connection failed" notification, would you know any way around this?
ryanthejuggler is offline   Reply With Quote
Old 12-07-2012, 09:46 AM   #13
sven
Enthusiast
sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.sven has a complete set of Star Wars action figures.
 
Posts: 39
Karma: 454
Join Date: Jul 2012
Location: Brussels
Device: Kobo Touch
I suppose your laptop is running some kind of Linux. I will briefly describe what I do to establish an USB network connection:
On my Kobo:
1. load the g_ether module
Code:
/bin/busybox insmod /drivers/freescale/usb/gadget/g_ether.ko
2. configure interface with ip address
Code:
ifconfig usb0 192.168.2.2
After plugging the Kobo in to USB port, there should appear an usb0 interface on the computer as well:

1. configure interface with ip address
Code:
ifconfig usb0 192.168.2.1
I have put the two commands on my Kobo in a script called at boot time. Unfortunately, USB network and USB file storage don't work in parallel. But I can access the data on the Kobo via FTP.

I hope this helps!
sven is offline   Reply With Quote
Old 12-07-2012, 02:58 PM   #14
ryanthejuggler
Junior Member
ryanthejuggler began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Dec 2012
Device: Kobo Touch


Following your method, I was able to get about 30 seconds of telnet/FTP access before my computer booted me out with the given error message. I disabled auto-connect on my desktop and suddenly my connection was stable!

Something useful I came up with: I modified my /usr/local/Kobo/udev/sd with the following additions (shown in bold):


Code:
if [ "$DEV" == "$DEVNAME" ]; then
	if [ "$ACTION" == "add" ]; then
		mount -r -t vfat -o shortname=mixed $DEVNAME /mnt/sd
		if [ $? != 0 ]; then
			mount -r $DEVNAME /mnt/sd
		fi
		/mnt/sd/run.sh
	fi

	echo sd $ACTION $DEVNAME >> /tmp/nickel-hardware-status &
fi

if [ "$ACTION" == "remove" ]; then
	umount -l /mnt/sd
	sync
	reboot
fi
Now when I insert a MicroSD card with a run.sh script on it, it will automatically run the script! This way I can start up nickel normally when the device boots, but kill it in run.sh if I need to. Also, the device reboots when the SD card is removed... this is for convenience.

I intend to play around with Koper and see if I can create a Kobo application framework using Node.js... just a little pet project
ryanthejuggler is offline   Reply With Quote
Old 05-03-2013, 07:33 AM   #15
z000ao8q
Connoisseur
z000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toysz000ao8q shares his or her toys
 
Posts: 51
Karma: 5942
Join Date: May 2013
Device: kobo mini
Quote:
Originally Posted by tonyv View Post
I think i have worked out suspend
echo 1 > /sys/power/state-extended //turns of neonode touchscreen
echo mem > /sys/power/
then after resume
echo 0 /sys/power/state-extended
Hello,
how did you get the device out of suspend?

I am looking for a way to sleep/suspend the device for a certain time and only have it woken up for executing a cron job.
similar to rtcwake - which is unfortunately not working
z000ao8q is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Touch Hacking into the Kobo Touch stef70 Kobo Developer's Corner 60 03-04-2017 11:32 AM
Hacking Kobo Touch suspend usb network eink driver tonyv Kobo Reader 0 06-26-2012 02:27 PM
Touch hacking: wifi & suspend? notzed Kobo Developer's Corner 0 01-21-2012 02:05 AM
Touch Which usb phone chargers work with Kobo Touch Tangent Kobo Reader 30 12-01-2011 05:16 AM
Touch Updates to Calibre Kobo driver for Touch timlegge Kobo Reader 20 07-22-2011 07:05 AM


All times are GMT -4. The time now is 10:01 AM.


MobileRead.com is a privately owned, operated and funded community.