From 26e227eb86d2485f3699aca6b44b5b097d0cc647 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 1 Oct 2011 10:19:34 -0600 Subject: [PATCH] Basic USBMS driver for the T1, since it seems to be very different from previous readers --- src/calibre/customize/builtins.py | 4 +-- src/calibre/devices/prs505/driver.py | 41 ++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index c28ec814ba..a2c0596e0b 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -555,7 +555,7 @@ from calibre.devices.irexdr.driver import IREXDR1000, IREXDR800 from calibre.devices.jetbook.driver import JETBOOK, MIBUK, JETBOOK_MINI from calibre.devices.kindle.driver import KINDLE, KINDLE2, KINDLE_DX from calibre.devices.nook.driver import NOOK, NOOK_COLOR -from calibre.devices.prs505.driver import PRS505 +from calibre.devices.prs505.driver import PRS505, PRST1 from calibre.devices.user_defined.driver import USER_DEFINED from calibre.devices.android.driver import ANDROID, S60, WEBOS from calibre.devices.nokia.driver import N770, N810, E71X, E52 @@ -657,7 +657,7 @@ plugins += [ KINDLE2, KINDLE_DX, NOOK, NOOK_COLOR, - PRS505, + PRS505, PRST1, ANDROID, S60, WEBOS, N770, E71X, diff --git a/src/calibre/devices/prs505/driver.py b/src/calibre/devices/prs505/driver.py index 94c48884e6..097f42f23e 100644 --- a/src/calibre/devices/prs505/driver.py +++ b/src/calibre/devices/prs505/driver.py @@ -19,7 +19,8 @@ class PRS505(USBMS): name = 'SONY Device Interface' gui_name = 'SONY Reader' - description = _('Communicate with all the Sony eBook readers.') + description = _('Communicate with Sony eBook readers older than the' + ' PRST1.') author = 'Kovid Goyal' supported_platforms = ['windows', 'osx', 'linux'] path_sep = '/' @@ -31,14 +32,13 @@ class PRS505(USBMS): CAN_DO_DEVICE_DB_PLUGBOARD = True VENDOR_ID = [0x054c] #: SONY Vendor Id - PRODUCT_ID = [0x031e, 0x05c2] - BCD = [0x229, 0x1000, 0x22a, 0x31a, 0x226] + PRODUCT_ID = [0x031e] + BCD = [0x229, 0x1000, 0x22a, 0x31a] VENDOR_NAME = 'SONY' WINDOWS_MAIN_MEM = re.compile( r'(PRS-(505|500|300))|' - r'(PRS-((700[#/])|((6|9|3)(0|5)0&)))|' - r'(PRS-T1&)' + r'(PRS-((700[#/])|((6|9|3)(0|5)0&)))' ) WINDOWS_CARD_A_MEM = re.compile( r'(PRS-(505|500)[#/]\S+:MS)|' @@ -299,3 +299,34 @@ class PRS505(USBMS): f.write(metadata.thumbnail[-1]) debug_print('Cover uploaded to: %r'%cpath) +class PRST1(USBMS): + name = 'SONY PRST1 and newer Device Interface' + gui_name = 'SONY Reader' + description = _('Communicate with Sony PRST1 and newer eBook readers') + author = 'Kovid Goyal' + supported_platforms = ['windows', 'osx', 'linux'] + + FORMATS = ['epub', 'lrf', 'lrx', 'rtf', 'pdf', 'txt'] + VENDOR_ID = [0x054c] #: SONY Vendor Id + PRODUCT_ID = [0x05c2] + BCD = [0x226] + + VENDOR_NAME = 'SONY' + WINDOWS_MAIN_MEM = re.compile( + r'(PRS-T1&)' + ) + + THUMBNAIL_HEIGHT = 217 + SCAN_FROM_ROOT = True + EBOOK_DIR_MAIN = __appname__ + + + def windows_filter_pnp_id(self, pnp_id): + return '_LAUNCHER' in pnp_id or '_SETTING' in pnp_id + + def get_carda_ebook_dir(self, for_upload=False): + if for_upload: + return __appname__ + return self.EBOOK_DIR_CARD_A + +