mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 17:54:55 +02:00
i hate windows
This commit is contained in:
parent
19367baec8
commit
8c566b877e
1 changed files with 12 additions and 0 deletions
|
|
@ -138,6 +138,14 @@ def fget(self):
|
|||
return ans
|
||||
return property(doc=doc, fget=fget)
|
||||
|
||||
class NTStatus(Structure):
|
||||
_fields_ = [\
|
||||
('code', c_uint, 16),
|
||||
('facility', c_uint, 13),
|
||||
('c', c_uint, 1),
|
||||
('sev', c_uint, 2)
|
||||
]
|
||||
|
||||
class DeviceHandle(Structure):
|
||||
_fields_ = [\
|
||||
('fd', c_int), \
|
||||
|
|
@ -159,6 +167,8 @@ def claim_interface(self, num):
|
|||
Must be called before doing anything witht the device.
|
||||
"""
|
||||
ret = _libusb.usb_claim_interface(byref(self), num)
|
||||
if _iswindows:
|
||||
return
|
||||
if -ret == ENOMEM:
|
||||
raise Error("Insufficient memory to claim interface")
|
||||
elif -ret == EBUSY:
|
||||
|
|
@ -286,6 +296,8 @@ def reset(self):
|
|||
_libusb.usb_control_msg.restype = c_int
|
||||
_libusb.usb_bulk_read.restype = c_int
|
||||
_libusb.usb_bulk_write.restype = c_int
|
||||
if _iswindows:
|
||||
_libusb.usb_claim_interface.restype = NTStatus
|
||||
_libusb.usb_init()
|
||||
|
||||
def busses():
|
||||
|
|
|
|||
Loading…
Reference in a new issue