mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
...
This commit is contained in:
parent
01204cce5f
commit
d29f34face
@ -660,13 +660,26 @@ def devinst_from_device_number(drive_letter, device_number):
|
|||||||
return devinfo.DevInst
|
return devinfo.DevInst
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
def develop(vendor_id=0x1949, product_id=0x4, do_eject=False):
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
pprint(get_usb_devices())
|
pprint(get_usb_devices())
|
||||||
print('Is connected:', is_usb_device_connected(0x1949, 0x4))
|
print()
|
||||||
|
print('Is device connected:', is_usb_device_connected(vendor_id, product_id))
|
||||||
|
print('\nAll removable drives:')
|
||||||
pprint(get_all_removable_drives())
|
pprint(get_all_removable_drives())
|
||||||
rd = get_removable_drives()
|
print('\nRemovable drives:')
|
||||||
|
rd = get_removable_drives(debug=True)
|
||||||
pprint(rd)
|
pprint(rd)
|
||||||
pprint(get_drive_letters_for_device(0x1949, 0x4, debug=True))
|
print('\nDrive letters for vid=0x%x, pid=0x%x:' % (vendor_id, product_id))
|
||||||
|
pprint(get_drive_letters_for_device(vendor_id, product_id, debug=True))
|
||||||
|
if do_eject:
|
||||||
for drive in rd:
|
for drive in rd:
|
||||||
eject_drive(drive)
|
eject_drive(drive)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
vendor_id, product_id = map(lambda x:int(x, 16), sys.argv[-2:])
|
||||||
|
else:
|
||||||
|
vendor_id, product_id = 0x1949, 0x4
|
||||||
|
develop(vendor_id, product_id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user