mirror of
https://github.com/shadps4-emu/ext-libusb.git
synced 2026-01-31 00:55:21 +01:00
Remove more fpusb remnants
This commit is contained in:
@@ -53,17 +53,17 @@ static int scan_device(char *busdir, const char *devnum)
|
||||
return -1;
|
||||
|
||||
snprintf(path, PATH_MAX, "%s/%s", busdir, devnum);
|
||||
fp_dbg("%s", path);
|
||||
usbi_dbg("%s", path);
|
||||
fd = open(path, O_RDWR);
|
||||
if (!fd) {
|
||||
fp_dbg("open '%s' failed, ret=%d errno=%d", path, fd, errno);
|
||||
usbi_dbg("open '%s' failed, ret=%d errno=%d", path, fd, errno);
|
||||
r = -1;
|
||||
goto err;
|
||||
}
|
||||
|
||||
r = read(fd, raw_desc, DEVICE_DESC_LENGTH);
|
||||
if (r < 0) {
|
||||
fp_err("read failed ret=%d errno=%d", r, errno);
|
||||
usbi_err("read failed ret=%d errno=%d", r, errno);
|
||||
goto err;
|
||||
}
|
||||
/* FIXME: short read handling? */
|
||||
@@ -72,13 +72,13 @@ static int scan_device(char *busdir, const char *devnum)
|
||||
|
||||
/* Now try to fetch the rest of the descriptors */
|
||||
if (dev->desc.bNumConfigurations > USB_MAXCONFIG) {
|
||||
fp_err("too many configurations");
|
||||
usbi_err("too many configurations");
|
||||
r = -1;
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (dev->desc.bNumConfigurations < 1) {
|
||||
fp_dbg("no configurations?");
|
||||
usbi_dbg("no configurations?");
|
||||
r = -1;
|
||||
goto err;
|
||||
}
|
||||
@@ -99,7 +99,7 @@ static int scan_device(char *busdir, const char *devnum)
|
||||
/* Get the first 8 bytes to figure out what the total length is */
|
||||
r = read(fd, buffer, sizeof(buffer));
|
||||
if (r < sizeof(buffer)) {
|
||||
fp_err("short descriptor read (%d/%d)", r, sizeof(buffer));
|
||||
usbi_err("short descriptor read (%d/%d)", r, sizeof(buffer));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -115,14 +115,14 @@ static int scan_device(char *busdir, const char *devnum)
|
||||
tmp = config.wTotalLength - 8;
|
||||
r = read(fd, bigbuffer + 8, tmp);
|
||||
if (r < tmp) {
|
||||
fp_err("short descriptor read (%d/%d)", r, tmp);
|
||||
usbi_err("short descriptor read (%d/%d)", r, tmp);
|
||||
free(bigbuffer);
|
||||
goto err;
|
||||
}
|
||||
|
||||
r = usbi_parse_configuration(&dev->config[i], bigbuffer);
|
||||
if (r > 0)
|
||||
fp_warn("descriptor data still left\n");
|
||||
usbi_warn("descriptor data still left\n");
|
||||
free(bigbuffer);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ static int scan_device(char *busdir, const char *devnum)
|
||||
if (!dev->nodepath)
|
||||
goto err;
|
||||
|
||||
fp_dbg("found device %04x:%04x", dev->desc.idVendor, dev->desc.idProduct);
|
||||
usbi_dbg("found device %04x:%04x", dev->desc.idVendor, dev->desc.idProduct);
|
||||
list_add(&dev->list, &usb_devs);
|
||||
r = 0;
|
||||
|
||||
@@ -149,10 +149,10 @@ static int scan_busdir(const char *busnum)
|
||||
struct dirent *entry;
|
||||
|
||||
snprintf(dirpath, PATH_MAX, "%s/%s", USBFS_PATH, busnum);
|
||||
fp_dbg("%s", dirpath);
|
||||
usbi_dbg("%s", dirpath);
|
||||
dir = opendir(dirpath);
|
||||
if (!dir) {
|
||||
fp_err("opendir '%s' failed, errno=%d", dirpath, errno);
|
||||
usbi_err("opendir '%s' failed, errno=%d", dirpath, errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -170,11 +170,11 @@ API_EXPORTED int libusb_find_devices(void)
|
||||
{
|
||||
DIR *buses;
|
||||
struct dirent *entry;
|
||||
fp_dbg("");
|
||||
usbi_dbg("");
|
||||
|
||||
buses = opendir(USBFS_PATH);
|
||||
if (!buses) {
|
||||
fp_err("opendir buses failed errno=%d", errno);
|
||||
usbi_err("opendir buses failed errno=%d", errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -220,11 +220,11 @@ API_EXPORTED struct libusb_dev_handle *libusb_open(struct libusb_dev *dev)
|
||||
{
|
||||
struct libusb_dev_handle *devh;
|
||||
int fd;
|
||||
fp_dbg("open %04x:%04x", dev->desc.idVendor, dev->desc.idProduct);
|
||||
usbi_dbg("open %04x:%04x", dev->desc.idVendor, dev->desc.idProduct);
|
||||
|
||||
fd = open(dev->nodepath, O_RDWR);
|
||||
if (!fd) {
|
||||
fp_err("open failed, code %d errno %d", fd, errno);
|
||||
usbi_err("open failed, code %d errno %d", fd, errno);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ API_EXPORTED void libusb_close(struct libusb_dev_handle *devh)
|
||||
{
|
||||
if (!devh)
|
||||
return;
|
||||
fp_dbg("");
|
||||
usbi_dbg("");
|
||||
|
||||
list_del(&devh->list);
|
||||
do_close(devh);
|
||||
@@ -265,11 +265,11 @@ API_EXPORTED int libusb_claim_interface(struct libusb_dev_handle *dev,
|
||||
int iface)
|
||||
{
|
||||
int r;
|
||||
fp_dbg("interface %d", iface);
|
||||
usbi_dbg("interface %d", iface);
|
||||
|
||||
r = ioctl(dev->fd, IOCTL_USB_CLAIMINTF, &iface);
|
||||
if (r < 0)
|
||||
fp_err("claim interface failed, error %d", r);
|
||||
usbi_err("claim interface failed, error %d", r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -277,18 +277,18 @@ API_EXPORTED int libusb_release_interface(struct libusb_dev_handle *dev,
|
||||
int iface)
|
||||
{
|
||||
int r;
|
||||
fp_dbg("interface %d", iface);
|
||||
usbi_dbg("interface %d", iface);
|
||||
|
||||
r = ioctl(dev->fd, IOCTL_USB_RELEASEINTF, &iface);
|
||||
if (r < 0)
|
||||
fp_err("release interface failed, error %d", r);
|
||||
usbi_err("release interface failed, error %d", r);
|
||||
return r;
|
||||
}
|
||||
|
||||
API_EXPORTED int libusb_init(int signum)
|
||||
{
|
||||
/* FIXME: find correct usb node path */
|
||||
fp_dbg("");
|
||||
usbi_dbg("");
|
||||
list_init(&usb_devs);
|
||||
list_init(&open_devs);
|
||||
return usbi_io_init(signum);
|
||||
@@ -297,9 +297,9 @@ API_EXPORTED int libusb_init(int signum)
|
||||
API_EXPORTED void libusb_exit(void)
|
||||
{
|
||||
struct libusb_dev_handle *devh;
|
||||
fp_dbg("");
|
||||
usbi_dbg("");
|
||||
if (!list_empty(&open_devs)) {
|
||||
fp_dbg("naughty app left some devices open!\n");
|
||||
usbi_dbg("naughty app left some devices open!\n");
|
||||
list_for_each_entry(devh, &open_devs, list)
|
||||
do_close(devh);
|
||||
}
|
||||
|
||||
@@ -79,12 +79,12 @@ static int parse_endpoint(struct libusb_endpoint_descriptor *endpoint,
|
||||
/* Everything should be fine being passed into here, but we sanity */
|
||||
/* check JIC */
|
||||
if (header.bLength > size) {
|
||||
fp_err("ran out of descriptors parsing");
|
||||
usbi_err("ran out of descriptors parsing");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (header.bDescriptorType != LIBUSB_DT_ENDPOINT) {
|
||||
fp_err("unexpected descriptor %x (expected %x)",
|
||||
usbi_err("unexpected descriptor %x (expected %x)",
|
||||
header.bDescriptorType, LIBUSB_DT_ENDPOINT);
|
||||
return parsed;
|
||||
}
|
||||
@@ -105,7 +105,7 @@ static int parse_endpoint(struct libusb_endpoint_descriptor *endpoint,
|
||||
usbi_parse_descriptor(buffer, "bb", &header);
|
||||
|
||||
if (header.bLength < 2) {
|
||||
fp_err("invalid descriptor length %d", header.bLength);
|
||||
usbi_err("invalid descriptor length %d", header.bLength);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ static int parse_endpoint(struct libusb_endpoint_descriptor *endpoint,
|
||||
(header.bDescriptorType == LIBUSB_DT_DEVICE))
|
||||
break;
|
||||
|
||||
fp_dbg("skipping descriptor %x", header.bDescriptorType);
|
||||
usbi_dbg("skipping descriptor %x", header.bDescriptorType);
|
||||
buffer += header.bLength;
|
||||
size -= header.bLength;
|
||||
parsed += header.bLength;
|
||||
@@ -179,7 +179,7 @@ static int parse_interface(struct libusb_interface *interface,
|
||||
while (size >= DESC_HEADER_LENGTH) {
|
||||
usbi_parse_descriptor(buffer, "bb", &header);
|
||||
if (header.bLength < 2) {
|
||||
fp_err("invalid descriptor of length %d", header.bLength);
|
||||
usbi_err("invalid descriptor of length %d", header.bLength);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ static int parse_interface(struct libusb_interface *interface,
|
||||
return parsed;
|
||||
|
||||
if (ifp->bNumEndpoints > USB_MAXENDPOINTS) {
|
||||
fp_err("too many endpoints (%d)", ifp->bNumEndpoints);
|
||||
usbi_err("too many endpoints (%d)", ifp->bNumEndpoints);
|
||||
/* FIXME will leak memory */
|
||||
return -1;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ static int parse_interface(struct libusb_interface *interface,
|
||||
usbi_parse_descriptor(buffer, "bb", &header);
|
||||
|
||||
if (header.bLength > size) {
|
||||
fp_err("ran out of descriptors parsing");
|
||||
usbi_err("ran out of descriptors parsing");
|
||||
/* FIXME will leak memory */
|
||||
return -1;
|
||||
}
|
||||
@@ -278,7 +278,7 @@ int usbi_parse_configuration(struct libusb_config_descriptor *config,
|
||||
size = config->wTotalLength;
|
||||
|
||||
if (config->bNumInterfaces > USB_MAXINTERFACES) {
|
||||
fp_err("too many interfaces (%d)", config->bNumInterfaces);
|
||||
usbi_err("too many interfaces (%d)", config->bNumInterfaces);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ int usbi_parse_configuration(struct libusb_config_descriptor *config,
|
||||
|
||||
if ((header.bLength > size) ||
|
||||
(header.bLength < DESC_HEADER_LENGTH)) {
|
||||
fp_err("invalid descriptor length of %d", header.bLength);
|
||||
usbi_err("invalid descriptor length of %d", header.bLength);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ int usbi_parse_configuration(struct libusb_config_descriptor *config,
|
||||
(header.bDescriptorType == LIBUSB_DT_DEVICE))
|
||||
break;
|
||||
|
||||
fp_dbg("skipping descriptor 0x%x\n", header.bDescriptorType);
|
||||
usbi_dbg("skipping descriptor 0x%x\n", header.bDescriptorType);
|
||||
buffer += header.bLength;
|
||||
size -= header.bLength;
|
||||
}
|
||||
|
||||
72
libusb/io.c
72
libusb/io.c
@@ -44,7 +44,7 @@
|
||||
static int sigfd;
|
||||
static int signum;
|
||||
|
||||
/* this is a list of in-flight fp_urb_handles, sorted by timeout expiration.
|
||||
/* this is a list of in-flight rb_handles, sorted by timeout expiration.
|
||||
* URBs to timeout the soonest are placed at the beginning of the list, URBs
|
||||
* that will time out later are placed after, and urbs with infinite timeout
|
||||
* are always placed at the very end. */
|
||||
@@ -55,16 +55,16 @@ static int setup_signalfd(int _signum)
|
||||
sigset_t sigset;
|
||||
if (_signum == 0)
|
||||
_signum = SIGRTMIN;
|
||||
fp_dbg("signal %d", _signum);
|
||||
usbi_dbg("signal %d", _signum);
|
||||
|
||||
sigemptyset(&sigset);
|
||||
sigaddset(&sigset, _signum);
|
||||
sigfd = signalfd(-1, &sigset, 0);
|
||||
if (sigfd < 0) {
|
||||
fp_err("signalfd failed, code=%d errno=%d", sigfd, errno);
|
||||
usbi_err("signalfd failed, code=%d errno=%d", sigfd, errno);
|
||||
return sigfd;
|
||||
}
|
||||
fp_dbg("got signalfd %d", sigfd);
|
||||
usbi_dbg("got signalfd %d", sigfd);
|
||||
signum = _signum;
|
||||
|
||||
sigemptyset(&sigset);
|
||||
@@ -100,13 +100,13 @@ static int calculate_timeout(struct libusb_urb_handle *urbh,
|
||||
|
||||
r = clock_gettime(CLOCK_MONOTONIC, ¤t_time);
|
||||
if (r < 0) {
|
||||
fp_err("failed to read monotonic clock, errno=%d", errno);
|
||||
usbi_err("failed to read monotonic clock, errno=%d", errno);
|
||||
return r;
|
||||
}
|
||||
|
||||
r = timer_create(CLOCK_MONOTONIC, &sigevt, &urbh->timer);
|
||||
if (r < 0) {
|
||||
fp_err("failed to create monotonic timer");
|
||||
usbi_err("failed to create monotonic timer");
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ static int calculate_timeout(struct libusb_urb_handle *urbh,
|
||||
|
||||
r = timer_settime(&urbh->timer, TIMER_ABSTIME, &itspec, NULL);
|
||||
if (r < 0) {
|
||||
fp_err("failed to arm monotonic timer");
|
||||
usbi_err("failed to arm monotonic timer");
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -183,12 +183,12 @@ static int submit_urb(struct libusb_dev_handle *devh,
|
||||
* rather than: submit, reap, submit, reap, submit, reap
|
||||
* this will improve performance and fix bugs concerning behaviour when
|
||||
* the user submits two similar multiple-urb requests */
|
||||
fp_dbg("transferring %d from %d bytes", urb->buffer_length,
|
||||
usbi_dbg("transferring %d from %d bytes", urb->buffer_length,
|
||||
to_be_transferred);
|
||||
|
||||
r = ioctl(devh->fd, IOCTL_USB_SUBMITURB, &urbh->urb);
|
||||
if (r < 0) {
|
||||
fp_err("submiturb failed error %d errno=%d", r, errno);
|
||||
usbi_err("submiturb failed error %d errno=%d", r, errno);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ API_EXPORTED struct libusb_urb_handle *libusb_async_control_transfer(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fp_dbg("RQT=%02x RQ=%02x VAL=%04x IDX=%04x length=%d",
|
||||
usbi_dbg("RQT=%02x RQ=%02x VAL=%04x IDX=%04x length=%d",
|
||||
transfer->requesttype, transfer->request, transfer->value,
|
||||
transfer->index, transfer->length);
|
||||
|
||||
@@ -261,7 +261,7 @@ static struct libusb_urb_handle *submit_bulk_transfer(
|
||||
struct libusb_urb_handle *urbh = malloc(sizeof(*urbh));
|
||||
int r;
|
||||
|
||||
fp_dbg("length %d timeout %d", transfer->length, timeout);
|
||||
usbi_dbg("length %d timeout %d", transfer->length, timeout);
|
||||
|
||||
if (!urbh)
|
||||
return NULL;
|
||||
@@ -309,10 +309,10 @@ API_EXPORTED int libusb_urb_handle_cancel(struct libusb_dev_handle *devh,
|
||||
struct libusb_urb_handle *urbh)
|
||||
{
|
||||
int r;
|
||||
fp_dbg("");
|
||||
usbi_dbg("");
|
||||
r = ioctl(devh->fd, IOCTL_USB_DISCARDURB, &urbh->urb);
|
||||
if (r < 0)
|
||||
fp_err("cancel urb failed error %d", r);
|
||||
usbi_err("cancel urb failed error %d", r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -320,10 +320,10 @@ API_EXPORTED int libusb_urb_handle_cancel_sync(struct libusb_dev_handle *devh,
|
||||
struct libusb_urb_handle *urbh)
|
||||
{
|
||||
int r;
|
||||
fp_dbg("");
|
||||
usbi_dbg("");
|
||||
r = ioctl(devh->fd, IOCTL_USB_DISCARDURB, &urbh->urb);
|
||||
if (r < 0) {
|
||||
fp_err("cancel urb failed error %d", r);
|
||||
usbi_err("cancel urb failed error %d", r);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ API_EXPORTED int libusb_urb_handle_cancel_sync(struct libusb_dev_handle *devh,
|
||||
}
|
||||
|
||||
int handle_transfer_completion(struct libusb_dev_handle *devh,
|
||||
struct libusb_urb_handle *urbh, enum fp_urb_cb_status status)
|
||||
struct libusb_urb_handle *urbh, enum libusb_urb_cb_status status)
|
||||
{
|
||||
struct usb_urb *urb = &urbh->urb;
|
||||
|
||||
@@ -373,13 +373,13 @@ static int handle_transfer_cancellation(struct libusb_dev_handle *devh,
|
||||
*/
|
||||
if (urbh->flags & LIBUSB_URBH_SYNC_CANCELLED) {
|
||||
urbh->flags &= ~LIBUSB_URBH_SYNC_CANCELLED;
|
||||
fp_dbg("detected sync. cancel");
|
||||
usbi_dbg("detected sync. cancel");
|
||||
return handle_transfer_completion(devh, urbh, FP_URB_SILENT_COMPLETION);
|
||||
}
|
||||
|
||||
/* if the URB was cancelled due to timeout, report timeout to the user */
|
||||
if (urbh->flags & LIBUSB_URBH_TIMED_OUT) {
|
||||
fp_dbg("detected timeout cancellation");
|
||||
usbi_dbg("detected timeout cancellation");
|
||||
return handle_transfer_completion(devh, urbh, FP_URB_TIMEOUT);
|
||||
}
|
||||
|
||||
@@ -398,13 +398,13 @@ static int reap_for_devh(struct libusb_dev_handle *devh)
|
||||
if (r == -1 && errno == EAGAIN)
|
||||
return r;
|
||||
if (r < 0) {
|
||||
fp_err("reap failed error %d errno=%d", r, errno);
|
||||
usbi_err("reap failed error %d errno=%d", r, errno);
|
||||
return r;
|
||||
}
|
||||
|
||||
urbh = container_of(urb, struct libusb_urb_handle, urb);
|
||||
|
||||
fp_dbg("urb type=%d status=%d transferred=%d", urb->type, urb->status,
|
||||
usbi_dbg("urb type=%d status=%d transferred=%d", urb->type, urb->status,
|
||||
urb->actual_length);
|
||||
list_del(&urbh->list);
|
||||
|
||||
@@ -412,7 +412,7 @@ static int reap_for_devh(struct libusb_dev_handle *devh)
|
||||
return handle_transfer_cancellation(devh, urbh);
|
||||
/* FIXME: research what other status codes may exist */
|
||||
if (urb->status != 0)
|
||||
fp_warn("unrecognised urb status %d", urb->status);
|
||||
usbi_warn("unrecognised urb status %d", urb->status);
|
||||
|
||||
/* determine how much data was asked for */
|
||||
trf_requested = MIN(urbh->transfer_len - urbh->transferred,
|
||||
@@ -423,19 +423,19 @@ static int reap_for_devh(struct libusb_dev_handle *devh)
|
||||
/* if we were provided less data than requested, then our transfer is
|
||||
* done */
|
||||
if (urb->actual_length < trf_requested) {
|
||||
fp_dbg("less data than requested (%d/%d) --> all done",
|
||||
usbi_dbg("less data than requested (%d/%d) --> all done",
|
||||
urb->actual_length, trf_requested);
|
||||
return handle_transfer_completion(devh, urbh, FP_URB_COMPLETED);
|
||||
}
|
||||
|
||||
/* if we've transferred all data, we're done */
|
||||
if (urbh->transferred == urbh->transfer_len) {
|
||||
fp_dbg("transfer complete --> all done");
|
||||
usbi_dbg("transfer complete --> all done");
|
||||
return handle_transfer_completion(devh, urbh, FP_URB_COMPLETED);
|
||||
}
|
||||
|
||||
/* otherwise, we have more data to transfer */
|
||||
fp_dbg("more data to transfer...");
|
||||
usbi_dbg("more data to transfer...");
|
||||
memset(urb, 0, sizeof(*urb));
|
||||
return submit_urb(devh, urbh);
|
||||
}
|
||||
@@ -453,7 +453,7 @@ static void handle_timeout(struct libusb_urb_handle *urbh)
|
||||
urbh->flags |= LIBUSB_URBH_TIMED_OUT;
|
||||
r = libusb_urb_handle_cancel(urbh->devh, urbh);
|
||||
if (r < 0)
|
||||
fp_warn("async cancel failed %d errno=%d", r, errno);
|
||||
usbi_warn("async cancel failed %d errno=%d", r, errno);
|
||||
}
|
||||
|
||||
static int handle_timeouts(void)
|
||||
@@ -516,11 +516,11 @@ static int flush_sigfd(void)
|
||||
struct signalfd_siginfo siginfo;
|
||||
r = read(sigfd, &siginfo, sizeof(siginfo));
|
||||
if (r < 0) {
|
||||
fp_err("sigfd read failed %d %d", r, errno);
|
||||
usbi_err("sigfd read failed %d %d", r, errno);
|
||||
return r;
|
||||
}
|
||||
if ((unsigned int) r < sizeof(siginfo)) {
|
||||
fp_err("sigfd short read (%d/%d)", r, sizeof(siginfo));
|
||||
usbi_err("sigfd short read (%d/%d)", r, sizeof(siginfo));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@@ -537,7 +537,7 @@ static int poll_io(struct timeval *tv)
|
||||
if (r == -1 && errno == EINTR)
|
||||
return 0;
|
||||
if (r < 0) {
|
||||
fp_err("select failed %d err=%d\n", r, errno);
|
||||
usbi_err("select failed %d err=%d\n", r, errno);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -563,18 +563,18 @@ API_EXPORTED int libusb_poll(void)
|
||||
}
|
||||
|
||||
struct sync_ctrl_handle {
|
||||
enum fp_urb_cb_status status;
|
||||
enum libusb_urb_cb_status status;
|
||||
unsigned char *data;
|
||||
int actual_length;
|
||||
};
|
||||
|
||||
static void ctrl_transfer_cb(struct libusb_dev_handle *devh,
|
||||
struct libusb_urb_handle *urbh, enum fp_urb_cb_status status,
|
||||
struct libusb_urb_handle *urbh, enum libusb_urb_cb_status status,
|
||||
struct libusb_ctrl_setup *setup, unsigned char *data, int actual_length,
|
||||
void *user_data)
|
||||
{
|
||||
struct sync_ctrl_handle *ctrlh = (struct sync_ctrl_handle *) user_data;
|
||||
fp_dbg("actual_length=%d", actual_length);
|
||||
usbi_dbg("actual_length=%d", actual_length);
|
||||
|
||||
if (status == FP_URB_COMPLETED) {
|
||||
/* copy results into user-defined buffer */
|
||||
@@ -617,23 +617,23 @@ API_EXPORTED int libusb_control_transfer(struct libusb_dev_handle *devh,
|
||||
case FP_URB_TIMEOUT:
|
||||
return -ETIMEDOUT;
|
||||
default:
|
||||
fp_warn("unrecognised status code %d", ctrlh.status);
|
||||
usbi_warn("unrecognised status code %d", ctrlh.status);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
struct sync_bulk_handle {
|
||||
enum fp_urb_cb_status status;
|
||||
enum libusb_urb_cb_status status;
|
||||
int actual_length;
|
||||
};
|
||||
|
||||
static void bulk_transfer_cb(struct libusb_dev_handle *devh,
|
||||
struct libusb_urb_handle *urbh, enum fp_urb_cb_status status,
|
||||
struct libusb_urb_handle *urbh, enum libusb_urb_cb_status status,
|
||||
unsigned char endpoint, int rqlength, unsigned char *data,
|
||||
int actual_length, void *user_data)
|
||||
{
|
||||
struct sync_bulk_handle *bulkh = (struct sync_bulk_handle *) user_data;
|
||||
fp_dbg("");
|
||||
usbi_dbg("");
|
||||
bulkh->status = status;
|
||||
bulkh->actual_length = actual_length;
|
||||
/* caller frees urbh */
|
||||
@@ -671,7 +671,7 @@ static int do_sync_bulk_transfer(struct libusb_dev_handle *devh,
|
||||
case FP_URB_TIMEOUT:
|
||||
return -ETIMEDOUT;
|
||||
default:
|
||||
fp_warn("unrecognised status code %d", bulkh.status);
|
||||
usbi_warn("unrecognised status code %d", bulkh.status);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ typedef struct libusb_dev_handle libusb_dev_handle;
|
||||
struct libusb_urb_handle;
|
||||
typedef struct libusb_urb_handle libusb_urb_handle;
|
||||
|
||||
enum fp_urb_cb_status {
|
||||
enum libusb_urb_cb_status {
|
||||
FP_URB_SILENT_COMPLETION = 0,
|
||||
FP_URB_COMPLETED,
|
||||
FP_URB_TIMEOUT,
|
||||
@@ -201,7 +201,7 @@ struct libusb_control_transfer {
|
||||
};
|
||||
|
||||
typedef void (*libusb_ctrl_cb_fn)(libusb_dev_handle *devh, libusb_urb_handle *urbh,
|
||||
enum fp_urb_cb_status status, struct libusb_ctrl_setup *setup,
|
||||
enum libusb_urb_cb_status status, struct libusb_ctrl_setup *setup,
|
||||
unsigned char *data, int actual_length, void *user_data);
|
||||
|
||||
struct libusb_bulk_transfer {
|
||||
@@ -211,7 +211,7 @@ struct libusb_bulk_transfer {
|
||||
};
|
||||
|
||||
typedef void (*libusb_bulk_cb_fn)(libusb_dev_handle *devh, libusb_urb_handle *urbh,
|
||||
enum fp_urb_cb_status status, unsigned char endpoint,
|
||||
enum libusb_urb_cb_status status, unsigned char endpoint,
|
||||
int rqlength, unsigned char *data, int actual_length, void *user_data);
|
||||
|
||||
int libusb_init(int signum);
|
||||
|
||||
@@ -134,14 +134,14 @@ void usbi_log(enum usbi_log_level, const char *function, const char *format, ...
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_DEBUG_LOGGING
|
||||
#define fp_dbg(fmt...) _usbi_log(LOG_LEVEL_DEBUG, fmt)
|
||||
#define usbi_dbg(fmt...) _usbi_log(LOG_LEVEL_DEBUG, fmt)
|
||||
#else
|
||||
#define fp_dbg(fmt...)
|
||||
#define usbi_dbg(fmt...)
|
||||
#endif
|
||||
|
||||
#define fp_info(fmt...) _usbi_log(LOG_LEVEL_INFO, fmt)
|
||||
#define fp_warn(fmt...) _usbi_log(LOG_LEVEL_WARNING, fmt)
|
||||
#define fp_err(fmt...) _usbi_log(LOG_LEVEL_ERROR, fmt)
|
||||
#define usbi_info(fmt...) _usbi_log(LOG_LEVEL_INFO, fmt)
|
||||
#define usbi_warn(fmt...) _usbi_log(LOG_LEVEL_WARNING, fmt)
|
||||
#define usbi_err(fmt...) _usbi_log(LOG_LEVEL_ERROR, fmt)
|
||||
|
||||
struct libusb_dev {
|
||||
struct list_head list;
|
||||
|
||||
Reference in New Issue
Block a user