Deleted Added
sdiff udiff text old ( 194069 ) new ( 199055 )
full compact
1/* $FreeBSD: head/lib/libusb/libusb20.c 199055 2009-11-08 20:03:52Z thompsa $ */
2/*-
3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.

--- 615 unchanged lines hidden (view full) ---

625
626int
627libusb20_dev_req_string_sync(struct libusb20_device *pdev,
628 uint8_t str_index, uint16_t langid, void *ptr, uint16_t len)
629{
630 struct LIBUSB20_CONTROL_SETUP_DECODED req;
631 int error;
632
633 /* make sure memory is initialised */
634 memset(ptr, 0, len);
635
636 if (len < 4) {
637 /* invalid length */
638 return (LIBUSB20_ERROR_INVALID_PARAM);
639 }
640 LIBUSB20_INIT(LIBUSB20_CONTROL_SETUP, &req);
641
642 /*
643 * We need to read the USB string in two steps else some USB

--- 447 unchanged lines hidden (view full) ---

1091 }
1092 while ((pdev = libusb20_be_device_foreach(pbe, NULL))) {
1093 libusb20_be_dequeue_device(pbe, pdev);
1094 libusb20_dev_free(pdev);
1095 }
1096 if (pbe->methods->exit_backend) {
1097 pbe->methods->exit_backend(pbe);
1098 }
1099 /* free backend */
1100 free(pbe);
1101}
1102
1103void
1104libusb20_be_enqueue_device(struct libusb20_backend *pbe, struct libusb20_device *pdev)
1105{
1106 pdev->beMethods = pbe->methods; /* copy backend methods */
1107 TAILQ_INSERT_TAIL(&(pbe->usb_devs), pdev, dev_entry);
1108}
1109
1110void
1111libusb20_be_dequeue_device(struct libusb20_backend *pbe,
1112 struct libusb20_device *pdev)
1113{
1114 TAILQ_REMOVE(&(pbe->usb_devs), pdev, dev_entry);
1115}