From 8919eacd7a94561108181acb0b973ea9a6c77488 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 12 Dec 2009 12:25:10 -0700 Subject: [PATCH] libusb info should now work on 32 bit platforms as well --- src/calibre/devices/libusb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/libusb.c b/src/calibre/devices/libusb.c index 3cc506e5fe..c13927d44f 100644 --- a/src/calibre/devices/libusb.c +++ b/src/calibre/devices/libusb.c @@ -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();