PRS 700 support

This commit is contained in:
Kovid Goyal 2008-11-26 12:41:43 -08:00
parent 5b08d46a1f
commit 470faaecc0
12 changed files with 49 additions and 47 deletions

View File

@ -138,7 +138,7 @@ ProjectID
DA98A0C6-9102-73EC-2516-B147E972D3F7 DA98A0C6-9102-73EC-2516-B147E972D3F7
ProjectVersion ProjectVersion
1.2.10.1 1.2.7.0
SaveOnlyToplevelDirs SaveOnlyToplevelDirs
No No
@ -1100,9 +1100,6 @@ AAFE58A0-2DFB-CA20-1F6E-D3815F885996,Alias
AIX-ppc,Active AIX-ppc,Active
No No
AIX-ppc,BuildSeparateArchives
No
AIX-ppc,DefaultDirectoryPermission AIX-ppc,DefaultDirectoryPermission
0755 0755
@ -1478,9 +1475,6 @@ FBA33088-C809-DD6B-D337-EADBF1CEE966,String
FreeBSD-4-x86,Active FreeBSD-4-x86,Active
No No
FreeBSD-4-x86,BuildSeparateArchives
No
FreeBSD-4-x86,DefaultDirectoryPermission FreeBSD-4-x86,DefaultDirectoryPermission
0755 0755
@ -1532,9 +1526,6 @@ FreeBSD-4-x86,RootInstallDir
FreeBSD-x86,Active FreeBSD-x86,Active
No No
FreeBSD-x86,BuildSeparateArchives
No
FreeBSD-x86,DefaultDirectoryPermission FreeBSD-x86,DefaultDirectoryPermission
0755 0755
@ -1586,9 +1577,6 @@ FreeBSD-x86,RootInstallDir
HPUX-hppa,Active HPUX-hppa,Active
No No
HPUX-hppa,BuildSeparateArchives
No
HPUX-hppa,DefaultDirectoryPermission HPUX-hppa,DefaultDirectoryPermission
0755 0755
@ -1640,9 +1628,6 @@ HPUX-hppa,RootInstallDir
Linux-x86,Active Linux-x86,Active
No No
Linux-x86,BuildSeparateArchives
No
Linux-x86,DefaultDirectoryPermission Linux-x86,DefaultDirectoryPermission
0755 0755
@ -1694,9 +1679,6 @@ Linux-x86,RootInstallDir
Solaris-sparc,Active Solaris-sparc,Active
No No
Solaris-sparc,BuildSeparateArchives
No
Solaris-sparc,DefaultDirectoryPermission Solaris-sparc,DefaultDirectoryPermission
0755 0755
@ -1748,9 +1730,6 @@ Solaris-sparc,RootInstallDir
TarArchive,Active TarArchive,Active
No No
TarArchive,BuildSeparateArchives
No
TarArchive,CompressionLevel TarArchive,CompressionLevel
6 6
@ -1811,15 +1790,9 @@ TarArchive,VirtualTextMap
Windows,Active Windows,Active
Yes Yes
Windows,BuildSeparateArchives
No
Windows,Executable Windows,Executable
<%AppName%>-<%Version%><%Ext%> <%AppName%>-<%Version%><%Ext%>
Windows,FileDescription
{<%AppName%> <%Version%> Setup}
Windows,IncludeTWAPI Windows,IncludeTWAPI
Yes Yes
@ -1856,9 +1829,6 @@ Windows,WindowsIcon
ZipArchive,Active ZipArchive,Active
No No
ZipArchive,BuildSeparateArchives
No
ZipArchive,CompressionLevel ZipArchive,CompressionLevel
6 6
@ -1951,7 +1921,7 @@ E611105F-DC85-9E20-4F7B-E63C54E5DF06,Message
3EA07B17-04D8-6508-B535-96CC7173B49A,Message 3EA07B17-04D8-6508-B535-96CC7173B49A,Message
{<%AppName%> version <%Version%> created by Kovid Goyal {<%AppName%> version <%Version%> created by Kovid Goyal
Please ensure that calibre is not running, as this will cause the installation to fail. Click Next to continue or Cancel to exit Setup.} Please make sure that calibre is not running, as this will cause the install to fail. Click Next to continue or Cancel to exit Setup.}
442920D9-8A51-9476-14E4-787D5C230E84,Message 442920D9-8A51-9476-14E4-787D5C230E84,Message
<%UninstallCompleteText%> <%UninstallCompleteText%>

View File

@ -7,8 +7,9 @@ Device drivers.
def devices(): def devices():
from calibre.devices.prs500.driver import PRS500 from calibre.devices.prs500.driver import PRS500
from calibre.devices.prs505.driver import PRS505 from calibre.devices.prs505.driver import PRS505
from calibre.devices.kindle.driver import KINDLE from calibre.devices.prs700.driver import PRS700
return (PRS500, PRS505, KINDLE) #from calibre.devices.kindle.driver import KINDLE
return (PRS500, PRS505, PRS700)
import time import time

View File

@ -20,6 +20,7 @@ class Device(object):
FORMATS = ["lrf", "rtf", "pdf", "txt"] FORMATS = ["lrf", "rtf", "pdf", "txt"]
VENDOR_ID = 0x0000 VENDOR_ID = 0x0000
PRODUCT_ID = 0x0000 PRODUCT_ID = 0x0000
BCD = 0x0000
THUMBNAIL_HEIGHT = 68 # Height for thumbnails on device THUMBNAIL_HEIGHT = 68 # Height for thumbnails on device
def __init__(self, key='-1', log_packets=False, report_progress=None) : def __init__(self, key='-1', log_packets=False, report_progress=None) :

View File

@ -355,6 +355,6 @@ def get_devices():
for bus in buslist: for bus in buslist:
devices = bus.device_list devices = bus.device_list
for dev in devices: for dev in devices:
device = (dev.device_descriptor.idVendor, dev.device_descriptor.idProduct) device = (dev.device_descriptor.idVendor, dev.device_descriptor.idProduct, dev.device_descriptor.bcdDevice)
ans.append(device) ans.append(device)
return ans return ans

View File

@ -85,6 +85,7 @@ class PRS500(Device):
VENDOR_ID = 0x054c #: SONY Vendor Id VENDOR_ID = 0x054c #: SONY Vendor Id
PRODUCT_ID = 0x029b #: Product Id for the PRS-500 PRODUCT_ID = 0x029b #: Product Id for the PRS-500
BCD = 0x100
PRODUCT_NAME = 'PRS-500' PRODUCT_NAME = 'PRS-500'
VENDOR_NAME = 'SONY' VENDOR_NAME = 'SONY'
INTERFACE_ID = 0 #: The interface we use to talk to the device INTERFACE_ID = 0 #: The interface we use to talk to the device

View File

@ -29,6 +29,7 @@ class File(object):
class PRS505(Device): class PRS505(Device):
VENDOR_ID = 0x054c #: SONY Vendor Id VENDOR_ID = 0x054c #: SONY Vendor Id
PRODUCT_ID = 0x031e #: Product Id for the PRS-505 PRODUCT_ID = 0x031e #: Product Id for the PRS-505
BCD = 0x229 #: Needed to disambiguate 505 and 700 on linux
PRODUCT_NAME = 'PRS-505' PRODUCT_NAME = 'PRS-505'
VENDOR_NAME = 'SONY' VENDOR_NAME = 'SONY'
FORMATS = ['lrf', 'epub', "rtf", "pdf", "txt"] FORMATS = ['lrf', 'epub', "rtf", "pdf", "txt"]
@ -49,9 +50,11 @@ class PRS505(Device):
<match key="info.category" string="volume"> <match key="info.category" string="volume">
<match key="@info.parent:@info.parent:@info.parent:@info.parent:usb.vendor_id" int="%(vendor_id)s"> <match key="@info.parent:@info.parent:@info.parent:@info.parent:usb.vendor_id" int="%(vendor_id)s">
<match key="@info.parent:@info.parent:@info.parent:@info.parent:usb.product_id" int="%(product_id)s"> <match key="@info.parent:@info.parent:@info.parent:@info.parent:usb.product_id" int="%(product_id)s">
<match key="volume.is_partition" bool="false"> <match key="@info.parent:@info.parent:@info.parent:@info.parent:usb.device_revision_bcd" int="%(bcd)s">
<merge key="volume.label" type="string">%(main_memory)s</merge> <match key="volume.is_partition" bool="false">
<merge key="%(app)s.mainvolume" type="string">%(deviceclass)s</merge> <merge key="volume.label" type="string">%(main_memory)s</merge>
<merge key="%(app)s.mainvolume" type="string">%(deviceclass)s</merge>
</match>
</match> </match>
</match> </match>
</match> </match>
@ -81,6 +84,7 @@ class PRS505(Device):
deviceclass=cls.__name__, deviceclass=cls.__name__,
vendor_id=hex(cls.VENDOR_ID), vendor_id=hex(cls.VENDOR_ID),
product_id=hex(cls.PRODUCT_ID), product_id=hex(cls.PRODUCT_ID),
bcd=hex(cls.BCD),
main_memory=cls.MAIN_MEMORY_VOLUME_LABEL, main_memory=cls.MAIN_MEMORY_VOLUME_LABEL,
storage_card=cls.STORAGE_CARD_VOLUME_LABEL, storage_card=cls.STORAGE_CARD_VOLUME_LABEL,
) )
@ -281,7 +285,7 @@ class PRS505(Device):
self.report_progress = pr self.report_progress = pr
def get_device_information(self, end_session=True): def get_device_information(self, end_session=True):
return ('PRS-505', '', '', '') return (self.__class__.__name__, '', '', '')
def card_prefix(self, end_session=True): def card_prefix(self, end_session=True):
return self._card_prefix return self._card_prefix

View File

@ -0,0 +1,6 @@
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''
Device driver for the SONY PRS-700
'''

View File

@ -0,0 +1,15 @@
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''
Device driver for the SONY PRS-700
'''
from calibre.devices.prs505.driver import PRS505
class PRS700(PRS505):
BCD = 0x31a
PRODUCT_NAME = 'PRS-700'
OSX_NAME = 'Sony PRS-700'

View File

@ -47,9 +47,10 @@ class DeviceScanner(object):
return True return True
return False return False
else: else:
for vendor, product in self.devices: for vendor, product, bcdDevice in self.devices:
if device.VENDOR_ID == vendor and device.PRODUCT_ID == product: if device.VENDOR_ID == vendor and device.PRODUCT_ID == product:
return True if hasattr(device, 'BCD') and device.BCD == bcdDevice:
return True
return False return False

View File

@ -57,7 +57,7 @@ usbobserver_get_usb_devices(PyObject *self, PyObject *args) {
IOCFPlugInInterface **plugInInterface = NULL; IOCFPlugInInterface **plugInInterface = NULL;
SInt32 score; SInt32 score;
IOUSBDeviceInterface182 **dev = NULL; IOUSBDeviceInterface182 **dev = NULL;
UInt16 vendor, product; UInt16 vendor, product, bcd;
PyObject *devices, *device; PyObject *devices, *device;
devices = PyList_New(0); devices = PyList_New(0);
@ -80,7 +80,8 @@ usbobserver_get_usb_devices(PyObject *self, PyObject *args) {
kr = (*dev)->GetDeviceVendor(dev, &vendor); kr = (*dev)->GetDeviceVendor(dev, &vendor);
kr = (*dev)->GetDeviceProduct(dev, &product); kr = (*dev)->GetDeviceProduct(dev, &product);
device = Py_BuildValue("(ii)", vendor, product); kr = (*dev)->GetDeviceReleaseNumber(dev, &bcd);
device = Py_BuildValue("(iii)", vendor, product, bcd);
if (device == NULL) { if (device == NULL) {
IOObjectRelease(usbDevice); IOObjectRelease(usbDevice);
(*plugInInterface)->Release(plugInInterface); (*plugInInterface)->Release(plugInInterface);

View File

@ -338,12 +338,14 @@ def setup_udev_rules(group_file, reload, fatal_errors):
<device> <device>
<match key="usb_device.vendor_id" int="%(vendor_id)s"> <match key="usb_device.vendor_id" int="%(vendor_id)s">
<match key="usb_device.product_id" int="%(product_id)s"> <match key="usb_device.product_id" int="%(product_id)s">
<merge key="calibre.deviceclass" type="string">%(cls)s</merge> <match key="usb_device.device_revision_bcd" int="%(bcd)s">
<merge key="calibre.deviceclass" type="string">%(cls)s</merge>
</match>
</match> </match>
</match> </match>
</device> </device>
'''%dict(cls=cls.__name__, vendor_id=cls.VENDOR_ID, product_id=cls.PRODUCT_ID, '''%dict(cls=cls.__name__, vendor_id=cls.VENDOR_ID, product_id=cls.PRODUCT_ID,
prog=__appname__)) prog=__appname__, bcd=cls.BCD))
fdi.write('\n'+cls.get_fdi()) fdi.write('\n'+cls.get_fdi())
fdi.write('\n</deviceinfo>\n') fdi.write('\n</deviceinfo>\n')
fdi.close() fdi.close()

View File

@ -12,7 +12,7 @@ from lxml import html
class NYTimesMobile(BasicNewsRecipe): class NYTimesMobile(BasicNewsRecipe):
title = 'The New York Times (mobile)' title = 'The New York Times'
__author__ = 'Kovid Goyal' __author__ = 'Kovid Goyal'
description = 'Daily news from the New York Times (mobile version)' description = 'Daily news from the New York Times (mobile version)'
timefmt = ' [%a, %d %b, %Y]' timefmt = ' [%a, %d %b, %Y]'