Commit Graph

90 Commits

Author SHA1 Message Date
Wojciech A. Koszek
d426c025be Remove redundand headers and use more standard ones where necessary.
Reviewed by:	hps@
2010-02-11 08:34:41 +00:00
Wojciech A. Koszek
ac840bfcf1 Use more standard way for setting nonblocking flag for a filedescriptor.
This makes libusb porting a bit easier.

There shouldn't by any negative change in behaviour after this commit.

Remove redundant headers.

Reviewed by:	hps@
2010-02-11 08:30:43 +00:00
Wojciech A. Koszek
9c7e1de8c3 Within libusb 0.1 API, bus number is always faked to 0. Device numbers,
however, are possitive and seem to be reverse sorted in the list.

Conform device numbering and bring a result that is consistent with the
libusb 0.1 API.  It is now possible to distinguish a device based on its
(bus, dev) numbers.

There shouldn't be any negative change in behavior after this commit.

Tested with:    scanimage (sane)
		http://freebsd.czest.pl/~wkoszek/qemu/l.c
Reviewed by:    hps@
2010-02-11 08:24:35 +00:00
Andrew Thompson
e50ac68b3d 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
Andrew Thompson
c740e8e4b2 Reset variable fields in case the transfer is opened again
Submitted by:	Hans Petter Selasky
2010-01-10 19:18:49 +00:00
Ed Schouten
daaf575910 Build lib/ with WARNS=6 by default.
Similar to libexec/, do the same with lib/. Make WARNS=6 the norm and
lower it when needed.

I'm setting WARNS?=0 for secure/. It seems secure/ includes the
Makefile.inc provided by lib/. I'm not going to touch that directory.
Most of the code there is contributed anyway.
2010-01-02 09:58:07 +00:00
Sean Farley
abdbb3fecd Fix libusb_open_device_with_vid_pid() to return a NULL if no device is
found instead of the last device in its search list.

Reviewed by:	thompsa
MFC after:	5 days
2009-12-12 00:24:30 +00:00
Andrew Thompson
4594d907db 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
Andrew Thompson
ccef4ddf40 - 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
Andrew Thompson
0c35eaad3f Prevent wraparound of the timeout variable.
Submitted by:	HPS
2009-10-22 21:01:41 +00:00
Alfred Perlstein
390065b18e LibUSB v1.0:
- Significantly improve libusb10 support.
        - Many minor issues fixed.
        - P4 ID: 166189, 165853, 165991, 166052, 166069

Submitted by:	hps
Approved by:	re
2009-07-30 00:11:41 +00:00
Ken Smith
3ca3047aee Bump the version of all non-symbol-versioned shared libraries in
preparation for 8.0-RELEASE.  Add the previous version of those
libraries to ObsoleteFiles.inc and bump __FreeBSD_Version.

Reviewed by:    kib
Approved by:    re (rwatson)
2009-07-19 17:25:24 +00:00
Andrew Thompson
c500e4dd03 Sync the libusb 1.0 exported api to the latest GSoC code.
- Fix possible uninitialised variables and null derefs
 - Support big transfers
 - Various bug fixes and style changes

Submitted by:	Sylvestre Gallon
Sponsored by:	Google Summer of Code 2009
Approved by:	re (kib)
2009-07-10 14:15:53 +00:00
Andrew Thompson
ed6d949afd - Make struct usb_xfer opaque so that drivers can not access the internals
- Reduce the number of headers needed for a usb driver, the common case is just   usb.h and usbdi.h
2009-06-23 02:19:59 +00:00
Andrew Thompson
8c8fff3177 Add files missed in r194674.
Add libusb 1.0 support which is compatible with the latest revision on
Sourceforge. Libusb 1.0 is a portable usb api released December 2008 and
supersedes the original libusb released 10 years ago, it supports isochronous
endpoints and asynchronous I/O.  Many applications have already started using
the interfaces.

This has been developed as part of Google Summer of Code this year by Sylvestre
Gallon and has been cribbed early due to it being desirable in FreeBSD 8.0

Submitted by: Sylvestre Gallon
Sponsored by: Google Summer of Code 2009
Reviewed by:  Hans Petter Selasky
2009-06-23 01:04:58 +00:00
Andrew Thompson
a5118bdfe9 Add libusb 1.0 support which is compatible with the latest revision on
Sourceforge. Libusb 1.0 is a portable usb api released December 2008 and
supersedes the original libusb released 10 years ago, it supports isochronous
endpoints and asynchronous I/O.  Many applications have already started using
the interfaces.

This has been developed as part of Google Summer of Code this year by Sylvestre
Gallon and has been cribbed early due to it being desirable in FreeBSD 8.0

Submitted by:	Sylvestre Gallon
Sponsored by:	Google Summer of Code 2009
Reviewed by:	Hans Petter Selasky
2009-06-23 01:00:26 +00:00
Andrew Thompson
4315b3c95d 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
Andrew Thompson
545b01ad3a Add libusb20_tr_get_length to get the transfer length.
Submitted by:	Hans Petter Selasky
2009-06-02 17:27:51 +00:00
Andrew Thompson
760bc48e7e s/usb2_/usb_/ on all C structs for the USB stack. 2009-05-28 17:36:36 +00:00
Andrew Thompson
c54c1f7c08 Fix libusb20_dev_get_device_desc and defunt xref.
Submitted by:	Hans Petter Selasky
2009-05-21 17:16:35 +00:00
Andrew Thompson
dc8f21bc49 MFp4 //depot/projects/usb@159934
Update libusb function descriptions.

Submitted by:	Chuck Robey
2009-04-05 18:30:24 +00:00
Xin LI
38d3e5fecf Add prototypes for libusb20_be_[gs]et_template. 2009-03-17 21:20:39 +00:00
Andrew Thompson
4eaae44dbf Update libusb.3 name and add mlinks for usb.3 and libusb20.3 2009-03-10 15:49:43 +00:00
Andrew Thompson
0b6e7271f0 Be compatible with LibUSB from sourceforge and close the handle after reset
Submitted by:	Hans Petter Selasky
2009-03-10 14:29:34 +00:00
Andrew Thompson
df4b8c2a2d libusb20 is now installed as libusb, remove the version number from the
directory name.
2009-03-09 17:09:46 +00:00
Josef Karthauser
a6402160b1 Follow NetBSD and rename libusb to libusbhid.
MFC after:	7 days
2002-03-27 16:07:20 +00:00
David E. O'Brien
69160b1eb7 Remove __P() usage. 2002-03-21 23:54:04 +00:00
Alfred Perlstein
5bcd0580d7 Prefix structure members to protect them against clashes with eg.
c++ keywords.

This keeps us in sync with NetBSD because they actually committed
my delta first.

Ok'd by: lennard
2002-02-20 20:47:21 +00:00
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Matthew Dillon
209040d8b0 Add __FBSDID()s to libusb 2001-09-30 22:30:55 +00:00
Ruslan Ermilov
265c01df49 mdoc(7) police: Fixed broken xrefs. 2001-08-22 14:16:31 +00:00
Ruslan Ermilov
4a558355e5 MAN[1-9] -> MAN. 2001-03-27 17:27:19 +00:00
Bruce Evans
1a7d8d0695 Fixed prototypes. About half of them were wrong (mainly due to const
poisoning having not reached here).
2001-02-06 01:02:59 +00:00
Bruce Evans
ea81d4327f Added used include of <sys/cdefs.h>.
Declare all the interfaces documented in usb.3 (2 were missing).
2001-02-06 00:54:00 +00:00
Ruslan Ermilov
251c176f41 mdoc(7) police: use certified section headers wherever possible. 2000-11-17 11:44:16 +00:00
Ben Smithurst
cb17760de7 Remove fullstops from the end of .Xr lines in SEE ALSO section. 2000-11-15 14:40:14 +00:00
Nick Hibma
b425e31947 Sync with NetBSD:
K&R -> ANSI

Bugfix: 'Keep the bit position even when the report descriptor says POP.'

Add hid_use_report_desc, hid_parse_usage_page, hid_parse_usage_in_page.

Changed iface for hid_report_size.
2000-10-16 18:13:59 +00:00
Nick Hibma
25d1d43d78 Sync with NetBSD:
Print unknown usages with 4 digits.
Mask in page extraction.
2000-08-26 13:53:27 +00:00
Nick Hibma
96102cae1a Remove DIAGASSERT 2000-07-07 08:15:19 +00:00
Nick Hibma
9e2046dfec The USB library from NetBSD by Lennart Augustsson <lennart@augustsson.net>. 2000-06-11 18:19:14 +00:00