Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 07-05-2009, 12:17 AM   #46
ebs
Zealot
ebs will become famous soon enoughebs will become famous soon enoughebs will become famous soon enoughebs will become famous soon enoughebs will become famous soon enoughebs will become famous soon enough
 
Posts: 100
Karma: 627
Join Date: Jun 2009
Location: California, USA
Device: Kindle DX
Quote:
Originally Posted by whitepaper View Post
do you have any progress in the web browsing over USB?
I'm not working on it, nor planning to. I use usbnetworking to access Kindle internals.
ebs is offline   Reply With Quote
Old 07-06-2009, 05:22 AM   #47
Acextreme
Enthusiast
Acextreme began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jun 2009
Device: none
Hi, ebs, I can't seem to connect to either the kindle store or wiki from the Kindle DX. I installed your patch just fine, and I tried setting up ICS. I suspect I must have done something wrong here; I setup my main Internet connection for sharing, and then configured the static IP for the new LAN (Kindle's) as 192.168.15.200 (found in the guide here: http://blog.jameslick.com/?p=1149). Well, I tried to Ping 192.168.15.200, and it was ok, but my attempt to Ping 192.168.15.244 (which I understand it to be the Kindle's hardcoded IP) failed. Is there anything I missed? I managed to follow the guide all the way till step 9...

Please help, sorry for this noob question... x_x

Last edited by Acextreme; 07-06-2009 at 06:15 AM.
Acextreme is offline   Reply With Quote
Old 07-06-2009, 06:13 AM   #48
Acextreme
Enthusiast
Acextreme began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jun 2009
Device: none
Hmmm, since I can't seem to ping to my Kindle DX, I can't Telnet it either. Any help to do so is greatly appreciated. I just want to change the Screensaver timeout option and also the date and time if possible. Thanks!

Last edited by Acextreme; 07-06-2009 at 09:34 AM.
Acextreme is offline   Reply With Quote
Old 07-06-2009, 10:05 AM   #49
imode
Junior Member
imode began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jul 2009
Device: Kindle 2
When you mount the Kindle as a USB drive there will be a folder "usbnet" which contains the script: usbnetwork. You have to edit this script with your PC or Mac. There is no longer a default "internal" IP address for the Kindle. It can be anything you want (as long as it's on the same subnet as the network you created on your PC or Mac). When you are done editing, save then reboot the kindle. Issue the `usbNetwork command (you no longer need `usbQa) and you should now be able to "telnet 192.168.15.201" to access the kindle.

So in the script, change (in your case):

1. HOST_IP to HOST_IP=192.168.15.200
2. KINDLE_IP to KINDLE_IP=192.168.15.201
3. Remove the "#" character (which is a comment) from the #route add default gw {$HOST_IP}

The script should look like:

#!/bin/sh

# Tweak these to match your setup
HOST_IP=192.168.15.200
KINDLE_IP=192.168.15.201

U=/mnt/us
R=$U/usbnet

# Check if we already have ethernet gadget driver running
lsmod | grep g_ether > /dev/null && exit 2

# Unload mass storage gadget and load ethernet one
rmmod g_file_storage || exit 1
modprobe g_ether host_addr='EE4900000000' dev_addr='EE1900000000' || exit 1
ifconfig usb0 ${KINDLE_IP} || exit 1
route add default gw ${HOST_IP}

# start telnet & ssh daemons
$R/busybox telnetd
$R/dropbear

exit 0

Last edited by imode; 07-06-2009 at 10:25 AM.
imode is offline   Reply With Quote
Old 07-06-2009, 10:13 AM   #50
imode
Junior Member
imode began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jul 2009
Device: Kindle 2
Couple of additional items. Once you are able to get a root shell you need to edit:

/opt/amazon/ebook/config/framework.mario.conf

Look for "USE_WAN" and set it to false.

Next type the following:

1. mntroot rw
2. vi /etc/resolv.d/resolv.conf.default
3. add the line: nameserver <your DNS IP>

Note: You need to use the "vi" editor to edit both files so I suggest reading up on vi commands before you try this (just google search "vi")

Then type "reboot" at the command prompt. After that you should now be able to use all of the web services through your PC/Mac network. To verify, after reboot setup usbNetwork (it is NOT necessary to use the `usbQa command anymore, in fact don't). Telnet into the kindle and try: ping google.com If it works then everything is setup. I suggest reading this entire thread a few times, you'll find all the tips you need to get this setup

Last edited by imode; 07-06-2009 at 10:41 AM.
imode is offline   Reply With Quote
Old 07-06-2009, 12:24 PM   #51
Acextreme
Enthusiast
Acextreme began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jun 2009
Device: none
Quote:
Originally Posted by imode View Post
When you mount the Kindle as a USB drive there will be a folder "usbnet" which contains the script: usbnetwork. You have to edit this script with your PC or Mac. There is no longer a default "internal" IP address for the Kindle. It can be anything you want (as long as it's on the same subnet as the network you created on your PC or Mac). When you are done editing, save then reboot the kindle. Issue the `usbNetwork command (you no longer need `usbQa) and you should now be able to "telnet 192.168.15.201" to access the kindle.

So in the script, change (in your case):

1. HOST_IP to HOST_IP=192.168.15.200
2. KINDLE_IP to KINDLE_IP=192.168.15.201
3. Remove the "#" character (which is a comment) from the #route add default gw {$HOST_IP}

The script should look like:

#!/bin/sh

# Tweak these to match your setup
HOST_IP=192.168.15.200
KINDLE_IP=192.168.15.201

U=/mnt/us
R=$U/usbnet

# Check if we already have ethernet gadget driver running
lsmod | grep g_ether > /dev/null && exit 2

# Unload mass storage gadget and load ethernet one
rmmod g_file_storage || exit 1
modprobe g_ether host_addr='EE4900000000' dev_addr='EE1900000000' || exit 1
ifconfig usb0 ${KINDLE_IP} || exit 1
route add default gw ${HOST_IP}

# start telnet & ssh daemons
$R/busybox telnetd
$R/dropbear

exit 0
This is a big problem. I did exactly as you said; changed the HOST_IP and KINDLE_IP and also removed the # sign at route add default gw ${HOST_IP}.

Here's the problem. After making the changes, I eject the kindle mass storage device and restarted. Then I enter debug mode on the kindle via ;debugOn command, upon which I enter 'usbNetwork. Next, I plugged in the USB cable but it switched to USB mode. I tried a few times, even copied the code exactly as you had posted and saved it, restart, on debug mode via ;debugOn, as well as entering 'usbNetwork command but plugging in the USB cable still goes to USB drive mode. Even using the 'usbQa command does not work as well. What have I not done?

When patching, I simply copied the update_usbnetwork.bin over to the root folder in USB mode. To which, I proceeded to update my kindle and my kindle restarted after that. Everything went well. When I change the IPs in the usbnetwork script, it will only allow me to connect via USB mode. Replacing the altered script with original script enables me to connect via usbNetwork mode again. Weird...

By the way, what do HOST_IP mean? From my understanding, it means the IP of my PC to which the Kindle is connected to and which the Internet connection is to be shared, or am I wrong?
Acextreme is offline   Reply With Quote
Old 07-06-2009, 08:42 PM   #52
imode
Junior Member
imode began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jul 2009
Device: Kindle 2
HOST_IP is the IP of your PC on the network you created. Before enabling `usbNetwork ensure that the cable is plugged in. Also, when issuing the `usbNetwork command ensure the first character is: ` (back tick) and not '. Ignore the `usbQa command, you don't need it. In fact, issuing the `usbQa command is probably what is causing your issue since I suspect it is trying to set the IP address of the kindle to a fixed value, i.e. .204

This works on both the K2 and the DX.

Last edited by imode; 07-07-2009 at 04:48 AM.
imode is offline   Reply With Quote
Old 07-07-2009, 02:52 AM   #53
Acextreme
Enthusiast
Acextreme began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jun 2009
Device: none
Quote:
Originally Posted by imode View Post
HOST_IP is the IP of your PC network. Before enabling `usbNetwork ensure that the cable is plugged in. Also, when issuing the `usbNetwork command ensure the first character is: ` (back tick) and not '. Ignore the `usbQa command, you don't need it. In fact, issuing the `usbQa command is probably what is causing your issue since I suspect it is trying to set the IP address of the kindle to a fixed value, i.e. .204

This works on both the K2 and the DX.
Ok, this is so WEIRD, I swear! This is what I have been doing and it makes absolutely no sense. As mentioned earlier, I can connect in usbNetwork mode if I haven't altered anything (i.e. usbnetwork script intact). The moment I changed IP or just remove that # sign within that script, it will NOT work. And the funny part is, even when I removed the changes I made (i.e. copied and paste the original script back in and save), it still will not connect in usbNetwork mode; I literally opened the original script, copied everything, and paste it into the usbnetwork script in my kindle drive and still it does not work.

Finally, I replaced the altered usbnetwork file in my kindle with the original usbnetwork file found in the .rar archive, and only THEN did it let me connect in usbNetwork mode. Any idea why this peculiar behavior?

I even re-patched the firmware, but still the same. What I don't understand is, was there some kind of CRC or MD5 check? Because, for example, when I removed the # sign and save and then added back in the # sign at the same place and save, it will not allow me to connect in usbNetwork mode even though the script content is EXACTLY the same. In other words, the moment an alteration is made (MD5 hash changes), I can't connect to usbNetwork mode anymore. Weird!!!

Last edited by Acextreme; 07-07-2009 at 02:55 AM.
Acextreme is offline   Reply With Quote
Old 07-07-2009, 03:29 AM   #54
imode
Junior Member
imode began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jul 2009
Device: Kindle 2
Not weird at all, this is expected behavior when you edit a UNIX file on a PC. The kindle operating system is UNIX (LINUX)

A few things:

1. When you edited the script (probably with windows notepad) it is likely the execution bit got removed. UNIX(LINUX) script files require an execution bit to be set, otherwise they won't execute (sort of...). Anyway, this is most likely missing which is why it didn't work. When you copied back the original file it worked because the execution bit was still set. The script not being executable explains why `usbNetwork didn't behave.

2. The reason the MD5 failed to match is that there is a difference in UNIX and PC text file formats. Editing the file on your PC added a linefeed control character on the end of each line (UNIX requires only a CR). So there is an extra number of invisible bytes added. Therefore, even though you reverted the edits, the invisible LF characters where still there which is why the MD5 hash was different.

To get around these issues you can install cygwin or mingw (unix environment for PC) on your PC (or boot from a Linux CD) and edit inside the cygwin terminal window using vi or emacs. This will preserve the file structure and execution permissions. If you have access to a Mac, do the editing there since MacOS is UNIX. Since I don't have a PC I had forgotten that editing UNIX files on a PC is fraught with danger.

To properly edit:

1. install cygwin http://www.cygwin.com/ or mingw http://www.mingw.org/
2. mount kindle
3. start the "cygwin" shell (should be on your desktop)
4. cd k: (or whatever your kindle drive letter is)
5. edit the usbnetwork network script "using the cygwin shell" with "vi" or "emacs" eg. "vi usbnet/usbnetwork"
6. set the execution bit: "chmod +x usbnetwork"
7. reboot kindle

This should work... You don't need to keep repatching the firmware.

Last edited by imode; 07-07-2009 at 03:52 AM.
imode is offline   Reply With Quote
Old 07-07-2009, 03:31 AM   #55
ebs
Zealot
ebs will become famous soon enoughebs will become famous soon enoughebs will become famous soon enoughebs will become famous soon enoughebs will become famous soon enoughebs will become famous soon enough
 
Posts: 100
Karma: 627
Join Date: Jun 2009
Location: California, USA
Device: Kindle DX
Quote:
Originally Posted by Acextreme View Post
Ok, this is so WEIRD, I swear! This is what I have been doing and it makes absolutely no sense. As mentioned earlier, I can connect in usbNetwork mode if I haven't altered anything (i.e. usbnetwork script intact). The moment I changed IP or just remove that # sign within that script, it will NOT work. And the funny part is, even when I removed the changes I made (i.e. copied and paste the original script back in and save), it still will not connect in usbNetwork mode; I literally opened the original script, copied everything, and paste it into the usbnetwork script in my kindle drive and still it does not work.

Finally, I replaced the altered usbnetwork file in my kindle with the original usbnetwork file found in the .rar archive, and only THEN did it let me connect in usbNetwork mode. Any idea why this peculiar behavior?

I even re-patched the firmware, but still the same. What I don't understand is, was there some kind of CRC or MD5 check? Because, for example, when I removed the # sign and save and then added back in the # sign at the same place and save, it will not allow me to connect in usbNetwork mode even though the script content is EXACTLY the same. In other words, the moment an alteration is made (MD5 hash changes), I can't connect to usbNetwork mode anymore. Weird!!!
It's not EXACTLY the same, most likely you have corrupted line endings if you have edited this file with a dumb Windows editor.
ebs is offline   Reply With Quote
Old 07-07-2009, 03:38 AM   #56
ebs
Zealot
ebs will become famous soon enoughebs will become famous soon enoughebs will become famous soon enoughebs will become famous soon enoughebs will become famous soon enoughebs will become famous soon enough
 
Posts: 100
Karma: 627
Join Date: Jun 2009
Location: California, USA
Device: Kindle DX
Quote:
Originally Posted by imode View Post
5. edit the usbnetwork network script with "vi" or "emacs" eg. "vi usbnet/usbnetwork"
I think you are opening Pandora's box
ebs is offline   Reply With Quote
Old 07-07-2009, 04:40 AM   #57
rfog
Addict
rfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windows
 
Posts: 396
Karma: 120046
Join Date: Aug 2007
Location: Elda - Alicante (Spain)
Device: PB903, K2, K3, K2i, KDX,KDXG,Nook,DR1000S, Boox6, iPad, Q1U, X51v, TM2
Quote:
Originally Posted by ebs View Post
I think you are opening Pandora's box
vi? what's that? emacs rules! emacs forever!

Now seriously, you can use PSPad in Windoze and it will respect unix line endings if found a file with unix file endings: http://www.pspad.com/en/

It's free, fast and very useful.

However, using formal logic, unix format is wrong. To go next line and return to beginning you have two different escape codes: CR and LF. Then if you only uses LF, next line will start at ending of upper one, and if you only uses CR, you will overwrite current line...

[And now RFOG has opened another Pandora's Box ]
rfog is offline   Reply With Quote
Old 07-07-2009, 06:50 AM   #58
Acextreme
Enthusiast
Acextreme began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jun 2009
Device: none
Ok, finally I managed to telnet into kindle. Thanks, imode, for all your help.

Now that I managed to get in, I will try to explore around a little. But basically, I wanted to do a couple of things:

(1) Connect to the Internet from Kindle DX so that the time and date gets updated; can't stand the date being at 1970...I will try what imode posted above about connecting to the Internet via usbNetwork later; only have enough time to do some cursory look into that /opt/amazon/ebook/config/framework.mario.conf file.

(2) Change the timeout before it goes to sleep mode (i.e. goes into screensaver after 10 minutes of idle). I would like to disable that or set it to a very high value. Where is that setting located?

Thanks so much!
Acextreme is offline   Reply With Quote
Old 07-07-2009, 07:06 AM   #59
rfog
Addict
rfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windowsrfog format shifts faster than booting Windows
 
Posts: 396
Karma: 120046
Join Date: Aug 2007
Location: Elda - Alicante (Spain)
Device: PB903, K2, K3, K2i, KDX,KDXG,Nook,DR1000S, Boox6, iPad, Q1U, X51v, TM2
Quote:
Originally Posted by Acextreme View Post
(1) Connect to the Internet from Kindle DX so that the time and date gets updated; can't stand the date being at 1970...I will try what imode posted above about connecting to the Internet via usbNetwork later; only have enough time to do some cursory look into that /opt/amazon/ebook/config/framework.mario.conf file.
Yo do not need internet access for that. When you are in terminal you can type

date MMDDHHMMAAAA

And you will get yor K on time.
rfog is offline   Reply With Quote
Old 07-07-2009, 12:20 PM   #60
Acextreme
Enthusiast
Acextreme began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jun 2009
Device: none
Thanks, rfog, I got that date part down. Now how about the sleep mode thing?
Acextreme is offline   Reply With Quote
Reply

Tags
kindle usb network

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Networking on Mac OS? DairyKnight Kindle Developer's Corner 19 07-02-2012 04:19 PM
Hacks Kindle 3 USB Networking n10 Amazon Kindle 2 10-11-2010 09:29 PM
Firmware Update USB networking for 2.5? dd_engi Amazon Kindle 9 05-09-2010 06:45 AM
Is there any way to remove USB networking hack? aghazi Kindle Developer's Corner 4 11-27-2009 07:35 PM


All times are GMT -4. The time now is 02:24 PM.


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