mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
libusb info should now work on 32 bit platforms as well
This commit is contained in:
parent
a4082773ad
commit
8919eacd7a
@ -65,19 +65,23 @@ py_libusb_scan(PyObject *self, PyObject *args) {
|
||||
|
||||
PyObject*
|
||||
py_libusb_info(PyObject *self, PyObject *args) {
|
||||
unsigned long idVendor, idProduct, bcdDevice;
|
||||
uint16_t idVendor, idProduct, bcdDevice;
|
||||
ssize_t ret = 0, i = 0; int err = 0, n;
|
||||
libusb_device **list = NULL;
|
||||
libusb_device_handle *handle = NULL;
|
||||
struct libusb_device_descriptor dev;
|
||||
PyObject *ans, *t;
|
||||
PyObject *ans, *t, *t1 = NULL, *t2 = NULL, *t3 = NULL;
|
||||
unsigned char data[1000];
|
||||
|
||||
if (ctxt == NULL) return PyErr_NoMemory();
|
||||
|
||||
if (!PyArg_ParseTuple(args, "LLL", &idVendor, &idProduct, &bcdDevice))
|
||||
if (!PyArg_ParseTuple(args, "OOO", &t1, &t2, &t3))
|
||||
return NULL;
|
||||
|
||||
idVendor = (uint16_t)PyInt_AsSsize_t(t1);
|
||||
idProduct = (uint16_t)PyInt_AsSsize_t(t2);
|
||||
bcdDevice = (uint16_t)PyInt_AsSsize_t(t3);
|
||||
|
||||
ret = libusb_get_device_list(ctxt, &list);
|
||||
if (ret == LIBUSB_ERROR_NO_MEM) return PyErr_NoMemory();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user