FU Logo
  • Startseite
  • Kontakt
  • Impressum
  • Home
  • Listenauswahl
  • Anleitungen

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

<-- thread -->
<-- date -->
  • From: Thomas Arp <manner.moe@gmx.de>
  • To: Michael Karcher <Michael.Karcher@fu-berlin.de>, linux-minidisc@lists.fu-berlin.de
  • Date: Fri, 23 Sep 2011 21:32:16 +0200
  • Subject: Re: [linux-minidisc] "netmdcli send" does not break on errors

Am 22/09/2011 22:02, schrieb Michael Karcher:
Why do you add a netmd_receive_track function stub to session.c? We already have a corecctly working track receiption code in secure.c

Are you sure that it is working correctly?
This is the main code for the bulk transfer in netmd_secure_real_recv_track(...) :
.
.
.
read = libusb_bulk_transfer((libusb_device_handle*)dev, 0x81, data, (int)chunksize, &transferred, 10000);
        if (read >= 0) {
            done += (uint32_t)read;
            fwrite(data, (uint32_t)read, 1, file);
.
.
.

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.

Thomas


<-- thread -->
<-- date -->
  • Follow-Ups:
    • Re: [linux-minidisc] "netmdcli send" does not break on errors
      • From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
    • Re: [linux-minidisc] "netmdcli send" does not break on errors
      • From: Michael Karcher <Michael.Karcher@fu-berlin.de>
  • References:
    • [linux-minidisc] "netmdcli send" does not break on errors
      • From: Thomas Arp <manner.moe@gmx.de>
    • Re: [linux-minidisc] "netmdcli send" does not break on errors
      • From: Thomas Arp <manner.moe@gmx.de>
    • Re: [linux-minidisc] "netmdcli send" does not break on errors
      • From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
    • Re: [linux-minidisc] "netmdcli send" does not break on errors
      • From: Thomas Arp <manner.moe@gmx.de>
    • Re: [linux-minidisc] "netmdcli send" does not break on errors
      • From: Michael Karcher <Michael.Karcher@fu-berlin.de>
    • Re: [linux-minidisc] "netmdcli send" does not break on errors
      • From: Thomas Arp <manner.moe@gmx.de>
    • Re: [linux-minidisc] "netmdcli send" does not break on errors
      • From: Michael Karcher <Michael.Karcher@fu-berlin.de>
  • linux-minidisc - September 2011 - Archives indexes sorted by:
    [ thread ] [ subject ] [ author ] [ date ]
  • Complete archive of the linux-minidisc mailing list
  • More info on this list...

Hilfe

  • FAQ
  • Dienstbeschreibung
  • ZEDAT Beratung
  • postmaster@lists.fu-berlin.de

Service-Navigation

  • Startseite
  • Listenauswahl

Einrichtung Mailingliste

  • ZEDAT-Portal
  • Mailinglisten Portal