View Single Post
Old 09-17-2016, 09:44 PM   #5
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Assuming a Linux of some flavor on the pc.

open terminal
clear kernel ring buffer:
$ sudo dmesg -c

Kindle is "hung" -
Connect usb cord

watch the kernel ring buffer for messages:
watch -n1 dmesg
(It should be blank at this point if the Kindle is really hung where it can't detect your plugging in the usb cable. If not, then copy messages and paste into next post.)

Ring buffer still empty:
Reboot Kindle.
*nix recognizes USB bus changes:
Code:
[883333.028027] usb 9-1: new high speed USB device number 20 using xhci_hcd
[883333.054420] scsi11 : usb-storage 9-1:1.0
[883334.053069] scsi 11:0:0:0: Direct-Access     Kindle   Internal Storage 0100
PQ: 0 ANSI: 2
That is only the "raw storage device" recognition step.
That happens early in the boot sequence, but the Kindle has only initialized the drivers to announce the USB storage device, without any media in it.

Next, if the boot process gets that far, it will export the "media" (a fuse file system thingy):
Code:
[883336.447790]  sdc: sdc1 <<-- ***
See the sequence?
The storage media is attached - sg3
Then it is identified as a removable disk - sdc
Then media is found - sdc1 (a single partition on media sdc)
The file system is identified (FAT-32)

At which point your desktop automation will probably auto-mount it and open a file manager window.

Then when ejected by file manager action - which is actually an un-mount and then an eject - you will see:
Code:
[883343.923536] sdc: detected capacity change from 3269459968 to 0
I.E: The Kindle system diddles the fuse file system and the kernel drivers to do the equivalent of physically removing the disk from the removable disk driver.

From the point marked: "<<-- ***" above, you can write to the USB storage media.

(ctrl-c now to stop watching the dmesg buffer).

That will happen ONCE, during early boot-up (while still in initramfs boot stage) -
IF the boot sequence gets that far, you can probably do:
Code:
touch /media/Kindle/DO_FACTORY_RESTORE
I.E: Poke (as in the Basic Language Peek and Poke instruction pair) a flag filename to top of visible USB storage.
It may not be availabe long enough for you to type it, so you will probably want to pre-type that command (in another terminal instance)
OR
write a simple do forever loop to keep trying the device write
OR
write a simple expect/send script
OR
get extra fancy a write a custom u-dev rule to "poke" (I.E: using :"touch" utility) the filename write when the storage media first becomes available.

- - -

Got the flag name written?
Good! Now remove USB cable and re-boot the Kindle.
It **should** restore itself.

Last edited by knc1; 09-17-2016 at 09:51 PM.
knc1 is offline   Reply With Quote