View Single Post
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