Thread: Usb Debug
View Single Post
Old 08-05-2015, 07:03 AM   #1
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,282
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
Usb Debug

When the reader is connected to the computer, this hack will

- display a happy face if the Kobo umounted the filesystems properly.
- display a sad face if it's still mounted even though it should not be.

If you see a sad face, you might have filesystem corruption and/or still running processes doing the wrong thing.

While the USB is connected it will keep checking state for about 5 minutes, so if some process is slow to free resources you will see a sad face first and it turns into a happy face. (But if the filesystem was mounted/used while it was still a sad face, there might still be corruption).

A possible cause for the sad face will be stored in /tmp/UsbDebug.log

After making this I found a bug in one of my own mods

This is mainly to debug other mods that may behave incorrectly during a USB connection.

I should also point out that this is by no means a complete check. It only considers obvious mounts; processes with open files or PWD; and libraries linked in by running programs. It does not cover loop devices, bind mounts, and more obscure ways to keep the filesystem busy.

Update:

Added a umount hook so it detects whether non-lazy umount would have worked or not.

The debug info is now copied to .addons/usbdebug/

Hack can be uninstalled by creating .addons/usbdebug/uninstall

Update: now also resolves offending fd names

Update 20160918: fix for GloHD/KA1
Attached Thumbnails
Click image for larger version

Name:	happyface.png
Views:	558
Size:	1.5 KB
ID:	151748   Click image for larger version

Name:	sadface.png
Views:	625
Size:	1.6 KB
ID:	151749  
Attached Files
File Type: zip KoboRoot-UsbDebug-20160918.zip (22.3 KB, 643 views)

Last edited by frostschutz; 09-19-2016 at 03:59 AM.
frostschutz is offline   Reply With Quote