Hi Albert, guys,

I've struggled to make PDFUSB bootloader work on a new Linux based PC. This
is basically a user permission error, I wasn't able to read USB devices.

The problem is I had to modify bootloader host application to track the
error, until I reach an error explaining the problem ("Operation not
permitted"). I think USB bootloader app catches too many exception, without
reporting to user. In  UsbBootLoader.py, UsbBootLoader.WaitForDevice():


            try:
                version_number = usb_driver.ReadVersion()

            except:
                """ catch exception """

This will catch any exceptions, the one(s) raised when USB device isn't
there (reset needed), but also those related to system error. I would
suggest to refine the except part (which, in this form, is a bad practice
anyway) to only catch relevant errors.

>From what I understand, in this part of the code, we're waiting for the
device. So either it is here, either it's not and in this case, we'll have
an AttributeError, where a method isn't defined (USB handle is None). I
would suggest the following:

            try:
                version_number = usb_driver.ReadVersion()

            except AttributeError:
                """ catch exception """
                # if we get there, this means USB object doesn't have
                # appropriate method defined, meaning USB device
                # meaning USB device doesn't exist on the system
                pass

This way, any error not related to finding the device should be reported to
users (including any permissions errors).

Would this sound reasonable to you ? Do you agree ?


Cheers,
Seb



-- 
Sébastien Lelong
http://www.sirloon.net
http://sirbot.org

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to