JasonFerrara/jmtpfs

USBDEVFS_CLAIMINTERFACE EBUSY

Opened this issue · 0 comments

bphd commented

How to debug further that problem?

Maybe doing some verifications in jmtpfs when that happen so it can output more precise errors permitting to troubleshoot

For example (in shell), to get the name and PID of the process hanging the phone

sudo lsof /dev/bus/usb/`lsusb | grep MTP | cut -d ' ' -f 2`/`lsusb | grep MTP | cut -d ' ' -f 4 | cut -d ':' -f 1` | cut -d ' ' -f 1-3 | grep -v COMMAND

(Assume that the phone will have MTP in its name. Adapt to what you see in the command for it to grep your phone. Command can be largely optimized)

To mount if it's not already mounted, otherwise to say what hangs it:

if [ "$(sudo lsof /dev/bus/usb/`lsusb | grep MTP | cut -d ' ' -f 2`/`lsusb | grep MTP | cut -d ' ' -f 4 | cut -d ':' -f 1` 2>/dev/null | cut -d ' ' -f 1-3 | grep -v COMMAND)" = '' ]; then sudo fusermount -u /mnt; sudo jmtpfs /mnt; else printf '%s ' Phone already hanged:; sudo lsof /dev/bus/usb/`lsusb | grep MTP | cut -d ' ' -f 2`/`lsusb | grep MTP | cut -d ' ' -f 4 | cut -d ':' -f 1` 2>/dev/null | cut -d ' ' -f 1-3 | grep -v COMMAND; fi