View Single Post
Old 02-14-2022, 08:38 PM   #340
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by frostschutz View Post
Just tested USB connection on Libra 2, 4.31 firmware, no mods installed (other than dev mode enabled for telnet access).

Umount always fails when you connect within KEPUB (nickel does not release KEPUB filehandle), and sometimes fails when you connect from Home menu (nickel does not release KoboReader.sqlite filehandle).

Umount works well from within regular EPUB book. So if you have USB corruption issues I recommend you open a regular EPUB first before making the connection, and see if that helps.
I'll have to watch for that. I just plugin and connect no matter whether a book is opened or not. In fact, I frequently have the book opened showing the annotations list after fixing errors in the book. I clear the list and plugin.

I'm mixing epubs and kepubs, so that might explain some of what I am seeing.
Quote:
Lazy umount is a bug that helps sweep other bugs under the rug, so no one will ever notice or fix them.


----

if anyone wants to test, put the following code in /usr/local/Kobo/udev/usb just *before* sync umount -l /mnt/onboard

it will try to umount regularly 5 times, if it fails you'll find umount.txt in the exported filesystem showing a process list and open filehandles and such

Code:
        attempts=5
        for i in $(seq $attempts)
        do
            grep " /mnt/onboard " /proc/mounts || break
            umount /mnt/onboard && break
            (
                echo "-------- umount failed ($i / $attempts) --------"
                umount /mnt/onboard 2>&1
                date -Is
                pstree -p
                grep -E '^([^ ]+ ){3}b3:0[39] ' /proc/*/maps
                find /proc/[0-9]*/cwd /proc/[0-9]*/fd -exec stat -tL {} + | grep -E '^([^ ]+ ){6}b30[39]' | xargs ls -l
            ) > /tmp/umount.txt
            cat /tmp/umount.txt >> /mnt/onboard/umount.txt
            sleep 1
        done
Strange you should mention that. I was hunting through the firmware looking for changes. A few lines below that code, there is a change. In 4.30, it looks like:

Code:
		if [ $CPU == mx6sll ] || [ $CPU == mx6ull ]; then
			PARAMS="idVendor=$VENDOR_ID idProduct=$PRODUCT_ID iManufacturer=Kobo iProduct=eReader-$VERSION iSerialNumber=$SN"
			/sbin/insmod /drivers/$PLATFORM/usb/gadget/configfs.ko
			/sbin/insmod /drivers/$PLATFORM/usb/gadget/libcomposite.ko
			/sbin/insmod /drivers/$PLATFORM/usb/gadget/usb_f_mass_storage.ko
		else
And in 4.31:

Code:
		if [ $CPU == mx6sll ] || [ $CPU == mx6ull ]; then
			PARAMS="idVendor=$VENDOR_ID idProduct=$PRODUCT_ID iManufacturer=Kobo iProduct=eReader-$VERSION iSerialNumber=$SN"
			/sbin/insmod /drivers/$PLATFORM/usb/gadget/configfs.ko && /sbin/insmod /drivers/$PLATFORM/usb/gadget/libcomposite.ko && /sbin/insmod /drivers/$PLATFORM/usb/gadget/usb_f_mass_storage.ko
		else
My shell scripting is terrible. But, in the 4.31 version, I think that means if one of the commands fails, the later commands are not executed. Whereas in the 4.30 version, they will all execute no matter what. They shouldn't, but, it's the only thing I can see that might be involved. But, it's probably more why they fail, and the umount failing might explain it. Of course, my tendency would be to think if these commands didn't work, that the connection could have more problems than what we are seeing.

Hopefully someone with better knowledge on this sort of thing can comment and possibly test.
davidfor is offline   Reply With Quote