mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More cleanups. Minor GUI bug fixed when deleting books from device list. Version bump.
This commit is contained in:
parent
af7605a075
commit
b81fe715b1
@ -37,7 +37,7 @@ You may have to adjust the GROUP and the location of the rules file to
|
||||
suit your distribution.
|
||||
"""
|
||||
|
||||
__version__ = "0.3.5"
|
||||
__version__ = "0.3.6"
|
||||
__docformat__ = "epytext"
|
||||
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
|
||||
|
||||
|
@ -260,7 +260,9 @@ class PRS500Device(Device):
|
||||
if version not in KNOWN_USB_PROTOCOL_VERSIONS:
|
||||
print >> sys.stderr, "WARNING: Usb protocol version " + \
|
||||
hex(version) + " is unknown"
|
||||
res = self.send_validated_command(SetBulkSize(size=0x028000))
|
||||
res = self.send_validated_command(SetBulkSize(\
|
||||
chunk_size = 512*self.bulk_read_max_packet_size, \
|
||||
unknown = 2))
|
||||
if res.code != 0:
|
||||
raise ProtocolError("Unable to set bulk size.")
|
||||
self.send_validated_command(UnlockDevice(key=0x312d))
|
||||
|
@ -177,6 +177,7 @@ class Main(QObject, Ui_MainWindow):
|
||||
self.status("Syncing media list to card")
|
||||
self.dev.upload_book_list(self.card_model.booklist)
|
||||
self.update_availabe_space()
|
||||
self.model_modified()
|
||||
self.show_book(self.current_view.currentIndex(), QModelIndex())
|
||||
self.window.setCursor(Qt.ArrowCursor)
|
||||
|
||||
@ -479,7 +480,8 @@ class Main(QObject, Ui_MainWindow):
|
||||
self.detector = DeviceConnectDetector(self.dev)
|
||||
self.connect(self.detector, SIGNAL("device_connected()"), \
|
||||
self.establish_connection)
|
||||
self.connect(self.detector, SIGNAL("device_removed()"), self.device_removed)
|
||||
self.connect(self.detector, SIGNAL("device_removed()"), \
|
||||
self.device_removed)
|
||||
self.search.setFocus(Qt.OtherFocusReason)
|
||||
self.show_device(False)
|
||||
self.df_template = self.df.text()
|
||||
|
@ -253,6 +253,8 @@ class DeviceHandle(Structure):
|
||||
if rsize < 0:
|
||||
raise Error('Could not read ' + str(size) + ' bytes on the '\
|
||||
'bulk bus. Error code: ' + str(rsize))
|
||||
if rsize == 0:
|
||||
raise Error('Device sent zero bytes')
|
||||
if rsize < size:
|
||||
arr = arr[:rsize]
|
||||
return arr
|
||||
|
@ -46,6 +46,7 @@ import time
|
||||
|
||||
from libprs500.errors import PacketError
|
||||
|
||||
WORD = "<H" #: Unsigned integer little endian encoded in 2 bytes
|
||||
DWORD = "<I" #: Unsigned integer little endian encoded in 4 bytes
|
||||
DDWORD = "<Q" #: Unsigned long long little endian encoded in 8 bytes
|
||||
|
||||
@ -402,12 +403,17 @@ class GetUSBProtocolVersion(ShortCommand):
|
||||
number=GetUSBProtocolVersion.NUMBER, \
|
||||
type=0x01, command=0x00)
|
||||
|
||||
class SetBulkSize(ShortCommand):
|
||||
class SetBulkSize(Command):
|
||||
""" Set size for bulk transfers in this session """
|
||||
NUMBER = 0x107 #: Command number
|
||||
def __init__(self, size=0x028000):
|
||||
ShortCommand.__init__(self, \
|
||||
number=SetBulkSize.NUMBER, type=0x01, command=size)
|
||||
chunk_size = field(fmt=WORD, start=0x10)
|
||||
unknown = field(fmt=WORD, start=0x12)
|
||||
def __init__(self, chunk_size=0x8000, unknown=0x2):
|
||||
Command.__init__(self, [0 for i in range(24)])
|
||||
self.number = SetBulkSize.NUMBER
|
||||
self.type = 0x01
|
||||
self.chunk_size = chunk_size
|
||||
self.unknown = unknown
|
||||
|
||||
class UnlockDevice(ShortCommand):
|
||||
""" Unlock the device """
|
||||
@ -714,7 +720,8 @@ class Answer(TransferBuffer):
|
||||
if "__len__" in dir(packet):
|
||||
if len(packet) < 16 :
|
||||
raise PacketError(str(self.__class__)[7:-2] + \
|
||||
" packets must have a length of atleast 16 bytes")
|
||||
" packets must have a length of atleast 16 bytes. "\
|
||||
"Got initializer of " + str(len(packet)) + " bytes.")
|
||||
elif packet < 16:
|
||||
raise PacketError(str(self.__class__)[7:-2] + \
|
||||
" packets must have a length of atleast 16 bytes")
|
||||
|
Loading…
x
Reference in New Issue
Block a user