Re: [linux-minidisc] "netmdcli send" does not break on errors


On Sep 23, 2011, at 9:32 PM, Thomas Arp wrote:

> read is the return code from 
> libusb_bulk_transfer. So if return code is 0 which means no error, 
> data size of 0 will be written to the file and 0 will be added to the "done" variable.
> We have to use the variable "transferred" to check the data size. So the code must look like this:
> 
> read = libusb_bulk_transfer((libusb_device_handle*)dev, 0x81, data, (int)chunksize, &transferred, 10000);
>         if (read >= 0) {
>             done += (uint32_t)transferred;
>             fwrite(data, (uint32_t)transferred, 1, file
> );
> 
> This works, please change this. I do not make a patch because i am working on other changes and do not want to rebase yet.

Good point, thanks for finding this. I'm actually the one to blame for this change. It's
a result of the porting from libusb 0.0.1 to 1.0.0. I verified downloads to work, but
not uploads, since I don't have an MZ-RH1 lying around here.

You're definitely right.

I guess uploads didn't work before your fix then? (They shouldn't ;)).

Adrian