Commit Graph

28 Commits

Author SHA1 Message Date
hselasky
37ff270164 Implement new libusb v2.0 API function, libusb20_dev_get_stats().
This function is useful when debugging USB device issues.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2019-12-27 20:35:12 +00:00
hselasky
a8fa0b8b8f Fix for reading the configuration descriptor in libusb. Catch invalid
configuration descriptor reads early on to avoid issues with devices
that don't check for a valid USB configuration read request.

Submitted by:	takahiro.kurosawa@gmail.com
PR:		238412
MFC after:	3 days
2019-06-08 09:34:02 +00:00
hselasky
43ee0168f3 Improve the userspace USB string reading function in LibUSB.
Some USB devices does not allow a partial descriptor readout.

Found by:		bz @
MFC after:		1 week
Sponsored by:		Mellanox Technologies
2018-06-26 16:00:16 +00:00
hselasky
dae3c29923 Allow the libusb20_dev_get_port_path() function to be called when the
USB device is closed. This fixes a compatibility issue with upstream
libusb.

Found by:	romain@
MFC after:	1 week
2018-03-23 09:40:41 +00:00
pfg
260ba0bff1 lib: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using mis-identified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
2017-11-26 02:00:33 +00:00
hselasky
f72f830cb1 Fix array size issue when using the pre-scaling feature for
ISOCHRONOUS USB transfers. Make sure enough length and buffer pointers
are allocated when setting up the libusb transfer structure to support
the maximum number of frames the kernel can handle.

MFC after:	1 week
2016-09-02 08:44:14 +00:00
hselasky
b6f02274aa Add support for libusb_set_auto_detach_kernel_driver() to the LibUSB v1.0 API.
Approved by:	re (kostikbel)
Requested by:	swills
MFC after:	1 week
2016-06-16 14:26:04 +00:00
pfg
aa42ac0ef5 USB: replace 0 with NULL for pointers.
Found with devel/coccinelle.

Reviewed by:	hselasky
2016-04-09 20:36:07 +00:00
hselasky
9ea6fe9fbe Add some missing definitions to build a working FreeBSD's libusb under Linux. 2013-07-14 10:22:00 +00:00
hselasky
b7fe9e8c88 Add new USB API to get the port path of a USB device.
MFC after:	2 weeks
Requested by:	emaste @
2013-05-03 07:44:58 +00:00
hselasky
0b8d792721 - Make the FreeBSD's USB library compile under Linux.
- Fix a compile warning where the return value of a call
to a write() function was ignored.
- Remove redundant include files from userland USB header files.
- Add some now needed include files to various C-files.
2013-03-13 12:23:14 +00:00
hselasky
d7b1840a86 Add USB API to read power draw on USB devices.
Update usbconfig to print power draw on USB devices.

MFC after:	2 weeks
Submitted by:	Matt Burke @ icritical.com
2013-02-14 12:22:40 +00:00
hselasky
ac49f9f94c Add support for streams to LibUSB v2.0.
MFC after:	2 weeks
2012-08-13 18:10:52 +00:00
hselasky
3463f3d087 Fix some compile warnings.
MFC after:	1 week
2012-04-20 14:29:45 +00:00
hselasky
c186259e31 Implement missing USB debug information functions.
Approved by:	re (kib)
MFC after:	1 week
2011-09-19 08:52:06 +00:00
hselasky
cbcc560b1e - Add two missing functions to the LibUSB v0.1 API.
- Clamp the string length to 255 bytes when getting
  the interface description.
- Clamp data request length to 65535 bytes when doing
  control requests.

MFC after:	3 days
2011-07-16 08:29:12 +00:00
hselasky
7549fd80dc - Add two new API's to libusb20 which can be used to retrive information
about the parent USB device:
  - libusb20_dev_get_parent_address
  - libusb20_dev_get_parent_port

- Rename libusb20_compat01.c into libusb01.c

MFC after:	3 days
2011-06-24 11:14:09 +00:00
hselasky
f6b78c32dc - Add support for software pre-scaling of ISOCHRONOUS transfers.
MFC after:	14 days
Approved by:	thompsa (mentor)
2011-02-28 17:23:15 +00:00
hselasky
1c90ef1274 - Add support for LibUSB in 32-bit compatibility mode.
Approved by:    thompsa (mentor)
2010-10-14 20:38:18 +00:00
wkoszek
8d96822e19 Resort includes to match style(9) a bit more. No functional change
is expected after this commit.

Tested by:	make buildworld
Reviewed by:	hps (patch without .h changes)
2010-02-13 09:45:50 +00:00
thompsa
3aae590108 Add a function to check if the usb devices is still connected.
Submitted by:	Hans Petter Selasky
2010-01-29 02:44:06 +00:00
thompsa
0008a6fee1 Reset variable fields in case the transfer is opened again
Submitted by:	Hans Petter Selasky
2010-01-10 19:18:49 +00:00
thompsa
c3a431d719 Sync to P4
- fix a transfer cancelling bug/segfault [1]
 - correct a return code in the transfer cancel function.
 - add new API function, libusb20_tr_bulk_intr_sync().

Submitted by:	HPS
Reported by:	Robert Jenssen [1]
2009-11-20 08:57:25 +00:00
thompsa
aded7665d8 - fix refcounting error during data transfer
- fix a memory leak on the USB backend
- fix invalid pointer computations (in one case memory outside the allocated
  area was written in LibUSB v1.0)
- make sure memory is always initialised, also in failing cases
- add missing functions from v1.0.4

PR:		usb/140325
Reported by:	Robert Jenssen
Submitted by:	Hans Petter Selasky
MFC After:	3 days
2009-11-08 20:03:52 +00:00
thompsa
c9ef77f0ce Cleanup claim/release interface code, which is specific to libusb v0.1. Remove
claim and release interface support from libusb v2.0, because it is not useful.

Submitted by:	Hans Petter Selasky
2009-06-12 16:07:06 +00:00
thompsa
6425a0a49f Add libusb20_tr_get_length to get the transfer length.
Submitted by:	Hans Petter Selasky
2009-06-02 17:27:51 +00:00
thompsa
af6fb4f3d2 s/usb2_/usb_/ on all C structs for the USB stack. 2009-05-28 17:36:36 +00:00
thompsa
b95f7329df libusb20 is now installed as libusb, remove the version number from the
directory name.
2009-03-09 17:09:46 +00:00