From e6af33d5e911a386046226a6c724224fdcfddc6e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 2 Sep 2012 19:38:46 +0530 Subject: [PATCH] Disable libusb/libmtp on OS X --- src/calibre/devices/mtp/unix/driver.py | 3 ++- src/calibre/devices/scanner.py | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/calibre/devices/mtp/unix/driver.py b/src/calibre/devices/mtp/unix/driver.py index 338913114f..2f215f6353 100644 --- a/src/calibre/devices/mtp/unix/driver.py +++ b/src/calibre/devices/mtp/unix/driver.py @@ -27,7 +27,8 @@ def fingerprint(d): class MTP_DEVICE(MTPDeviceBase): - supported_platforms = ['linux', 'osx'] + # libusb(x) does not work on OS X. So no MTP support for OS X + supported_platforms = ['linux'] def __init__(self, *args, **kwargs): MTPDeviceBase.__init__(self, *args, **kwargs) diff --git a/src/calibre/devices/scanner.py b/src/calibre/devices/scanner.py index 6865546a54..e0bb74fa2a 100644 --- a/src/calibre/devices/scanner.py +++ b/src/calibre/devices/scanner.py @@ -292,7 +292,15 @@ if islinux: libusb_scanner = LibUSBScanner() if isosx: - osx_scanner = libusb_scanner + # Apparently libusb causes mem leaks on some Macs and hangs on others and + # works on a few. OS X users will just have to live without MTP support. + # See https://bugs.launchpad.net/calibre/+bug/1044706 + # See https://bugs.launchpad.net/calibre/+bug/1044758 + # osx_scanner = libusb_scanner + usbobserver, usbobserver_err = plugins['usbobserver'] + if usbobserver is None: + raise RuntimeError('Failed to load usbobserver: %s'%usbobserver_err) + osx_scanner = usbobserver.get_usb_devices if isfreebsd: freebsd_scanner = FreeBSDScanner()