I have comments and questions about usb_read_TuxDroid():

  (1) It uses a for loop to read data from USB, and tampers with the
      loop index within the loop's body. This is generally not a good
      idea; a while loop would be preferable in such a case.

  (2) Where does the loop's upper bound (5) come from ? Does it have
      anything to do with TUX_RECV_LENGTH, which also happens to be
      5 (but soon to be fixed) ?

  (3) The documentation[1] of usb_interrupt_read() doesn't say much,
      but I guess it may read fewer bytes than requested, and even
      return 0 in case of a timeout. This means that the loop could
      have read data in several iterations and still reset the loop
      index to 0.

[1] http://libusb.sourceforge.net/doc/function.usbinterruptread.html

I don't get what this is supposed to do. If this code is indeed
correct, it should be rewritten and/or commented.

        Damien

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
tux-droid-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-user

Reply via email to