1
1
__license__ = 'GPL v3'
2
2
__copyright__ = '2009, Tijmen Ruizendaal <tijmen at mybebook.com>'
4
5
Device driver for BeBook
7
10
from calibre.devices.usbms.driver import USBMS
9
12
class BEBOOK(USBMS):
13
name = 'BeBook driver'
14
description = _('Communicate with the BeBook eBook reader.')
15
author = 'Tijmen Ruizendaal'
16
supported_platforms = ['windows', 'osx', 'linux']
10
19
# Ordered list of supported formats
11
20
FORMATS = ['mobi', 'epub', 'pdf', 'txt']
13
22
VENDOR_ID = [0x0525]
14
23
PRODUCT_ID = [0x8803, 0x6803]
18
27
WINDOWS_MAIN_MEM = 'FILE-STOR_GADGET'
19
WINDOWS_CARD_MEM = 'FILE-STOR_GADGET'
28
WINDOWS_CARD_A_MEM = 'FILE-STOR_GADGET'
21
OSX_MAIN_MEM = 'BeBook Internal Memory'
22
OSX_CARD_MEM = 'BeBook Storage Card'
30
OSX_MAIN_MEM = 'Linux File-Stor Gadget Media'
31
OSX_CARD_A_MEM = 'Linux File-Stor Gadget Media'
24
33
MAIN_MEMORY_VOLUME_LABEL = 'BeBook Internal Memory'
25
34
STORAGE_CARD_VOLUME_LABEL = 'BeBook Storage Card'
27
36
SUPPORTS_SUB_DIRS = True
29
FDI_LUNS = {'lun0':1, 'lun1':0, 'lun2':2}
31
38
def windows_sort_drives(self, drives):
32
39
main = drives.get('main', None)
33
card = drives.get('card', None)
34
if card and main and card < main:
40
card = drives.get('carda', None)
41
if card and main and card > main:
43
drives['carda'] = main
47
drives['carda'] = None
42
class BEBOOKMINI(BEBOOK):
51
def osx_sort_names(self, names):
52
main = names.get('main', None)
53
card = names.get('carda', None)
56
main_num = int(re.findall('\d+', main)[0]) if main else None
60
card_num = int(re.findall('\d+', card)[0]) if card else None
64
if card_num is not None and main_num is not None and card_num > main_num:
74
def linux_swap_drives(self, drives):
75
if len(drives) < 2: return drives
83
class BEBOOK_MINI(BEBOOK):
84
name = 'BeBook Mini driver'
85
description = _('Communicate with the BeBook Mini eBook reader.')
44
88
VENDOR_ID = [0x0492]
45
89
PRODUCT_ID = [0x8813]
48
92
OSX_MAIN_MEM = 'BeBook Mini Internal Memory'
49
93
OSX_CARD_MEM = 'BeBook Mini Storage Card'