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

[linux-minidisc] [PATCH] Work around hangs on NetMD music download.

<-- thread -->
<-- date -->
  • From: Michael Karcher <karcher@physik.fu-berlin.de>
  • To: linux-minidisc@lists.fu-berlin.de
  • Date: Wed, 27 Oct 2010 00:36:43 +0200
  • Subject: [linux-minidisc] [PATCH] Work around hangs on NetMD music download.

This hopefully "fixes" the observed MZ-RH1 download hangs.
---
 netmd/libnetmd.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/netmd/libnetmd.py b/netmd/libnetmd.py
index 3bcdc25..d2a3d4a 100644
--- a/netmd/libnetmd.py
+++ b/netmd/libnetmd.py
@@ -208,6 +208,20 @@ class NetMD(object):
         """
         self.usb_handle.bulkWrite(BULK_WRITE_ENDPOINT, data)
 
+    def flushWriteBulk(self):
+        """
+          Send some dummy data to the device, with a low timeout.
+          Used to help against lockups on music download.
+          The MZ-RH1 seems to need it sometimes, while an ancient Sharp
+          unit is fine without.
+        """
+        try:
+            self.usb_handle.bulkWrite(BULK_WRITE_ENDPOINT, "\0"*128, 1)
+        except libusb1.USBError as result:
+            if result.value != libusb1.LIBUSB_ERROR_TIMEOUT:
+                raise
+            
+
 ACTION_PLAY = 0x75
 ACTION_PAUSE = 0x7d
 ACTION_FASTFORWARD = 0x39
@@ -1184,6 +1198,7 @@ class MDSession:
         self.sessionkey = retailmac(ekbobject.getRootKey(), nonce)
 
     def downloadtrack(self, trk):
+        self.md.net_md.flushWriteBulk()
         self.md.setupDownload(trk.getContentID(), trk.getKEK(), self.sessionkey)
         dataformat = trk.getDataFormat()
         (track,uuid,ccid) = self.md.sendTrack(dataformat, diskforwire[dataformat], \
-- 
1.7.1




<-- thread -->
<-- date -->
  • linux-minidisc - October 2010 - 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