Deleted Added
full compact
libusb20.c (194069) libusb20.c (199055)
1/* $FreeBSD: head/lib/libusb/libusb20.c 194069 2009-06-12 16:07:06Z thompsa $ */
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
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
633 if (len < 4) {
634 /* invalid length */
635 return (LIBUSB20_ERROR_INVALID_PARAM);
636 }
637 LIBUSB20_INIT(LIBUSB20_CONTROL_SETUP, &req);
638
639 /*
640 * We need to read the USB string in two steps else some USB

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

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