Commit Graph

90 Commits

Author SHA1 Message Date
Hans Petter Selasky
99cd1f32af Add some missing definitions to build a working FreeBSD's libusb under Linux. 2013-07-14 10:22:00 +00:00
Ed Maste
a9205626a7 Add libusb_get_port_numbers
libusbx deprecated libusb_get_port_path and replaced it with
libusb_get_port_numbers.  The latter omits an extra parameter which was
unused in the FreeBSD implementation anyway.
2013-06-07 13:45:58 +00:00
Joel Dahl
2710751bc3 mdoc sweep. 2013-05-12 22:22:12 +00:00
Ed Maste
5906bf4984 Add libusb_get_port_path wrapper
This follows the libusbx API reference at
http://libusbx.sourceforge.net/api-1.0/group__dev.html

Reviewed by: hselasky@
2013-05-08 00:55:29 +00:00
Ed Maste
22a962c9fe Constify libusb_get_pollfds return
The correct return type, per our libusb(3) man page and the libusb.org
and libusbx projects (whose interface we intend to follow for our libusb),
is const struct libusb_pollfd **.

Unfortunately the doxygen-generated libusbx API documentation[1] omits[2]
the const for some reason.

[1] http://libusbx.sourceforge.net/api-1.0/group__poll.html#gab1a72869a926552b27a6c667695df3a2

[2] http://sourceforge.net/mailarchive/forum.php?thread_name=497D10BE.8090007%40n-dimensional.de&forum_name=libusb-devel

Reviewed by: hselasky@
2013-05-07 20:35:47 +00:00
Hans Petter Selasky
c77a24c24a 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
Hans Petter Selasky
6619413096 - 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
Hans Petter Selasky
aafcb73207 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
Hans Petter Selasky
07b6ce3ba9 Add support for streams to LibUSB v2.0.
MFC after:	2 weeks
2012-08-13 18:10:52 +00:00
Hans Petter Selasky
f7287225df LibUSB v1.0 API compiliance and bugfixes.
- Use CLOCK_MONOTONIC instead of CLOCK_REALTIME, because CLOCK_MONOTONIC
does not wrap into negative in near future. This fixes any potential
problems using "pthread_cond_timedwait()".

- Fix a bug where the "libusb_wait_for_event()" function computes an
absolute timeout instead of a relative timeout. USB transfers do
not depend on this timeout value.

- Add dependency towards LibPthread to Makefile, because LibUSB v1.0
needs this library to function correctly.

MFC after:	1 week
2012-06-12 07:28:25 +00:00
Joel Dahl
9ee2158b55 mdoc: minor Bl improvements. 2012-06-02 08:47:26 +00:00
Glen Barber
a3fb6da9ba General mdoc(7) and typo fixes.
PR:		167734
Submitted by:	Nobuyuki Koganemaru (kogane!jp.freebsd.org)
MFC after:	3 days
2012-05-11 20:06:46 +00:00
Hans Petter Selasky
78ed0e49ff Add missing LibUSB 1.0 API function: libusb_get_string_descriptor().
Reported by:	Xiaofan Chen
2012-05-07 14:07:13 +00:00
Hans Petter Selasky
cb0df9e86e Fix typo. 2012-04-25 21:59:56 +00:00
Hans Petter Selasky
93fab61dfa Bump the libusb major version due to the last commit, which
changes the libusb 1.0 API. While at it, correct a manual
page symlink.

Suggested by:	kib @
2012-04-25 21:50:20 +00:00
Hans Petter Selasky
85ff9a0313 Fix binary compatibility to the official LibUSB 1.0.
This is useful for GNU/kFreeBSD and the libusb2debian port.
Applications using the asynchronous API of LibUSB 1.0 needs
to be recompiled after this update.

Found by: lme @
2012-04-25 17:54:26 +00:00
Hans Petter Selasky
d81535d1f9 Fix some compile warnings.
MFC after:	1 week
2012-04-20 14:29:45 +00:00
Hans Petter Selasky
748205a370 Add missing LibUSB 1.0 API function.
Reported by:	lme @
MFC after:	1 week
2012-04-12 18:06:30 +00:00
Joel Dahl
1844d4fe2d Remove superfluous paragraph macro. 2012-03-29 16:07:22 +00:00
Eitan Adler
50d675f7a9 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
Joel Dahl
d284271a53 Minor mdoc fixes. 2012-03-24 15:17:18 +00:00
Glen Barber
3102cfe2e2 Fix various typos in manual pages.
Submitted by:	amdmi3
PR:		165431
MFC after:	1 week
2012-02-25 14:31:25 +00:00
Hans Petter Selasky
3f709d07c5 Simplify libusb_open_device_with_vid_pid(): Only set
pdev to non-NULL on success instead of unconditonally
setting it and maybe resetting it later.

Submitted by:	Christoph Mallon
MFC after:	3 days
2011-12-03 16:30:47 +00:00
Hans Petter Selasky
dc93480306 libusb_open() sets the given device handle to NULL if it
fails, so there is no need to do it again after returning.

Submitted by:	Christoph Mallon
MFC after:	3 days
2011-12-03 16:19:07 +00:00
Hans Petter Selasky
4c0392e6fd Add definition of some USB 3.0 descriptors to libusb 1.0 and libusb 2.0.
Some header file parts of this patch were taken from a patch submitted
by Maya Erez <merez@codeaurora.org> to the LibUSB developers list.

MFC after:	1 week
2011-11-09 19:03:26 +00:00
Hans Petter Selasky
4d2472aa7b Fix how libusb20_dev_kernel_driver_active() and
libusb_dev_kernel_driver_active() works. In case of
libusb20 the manpage was wrong and in case of
libusb10 the implementation was wrong.

Submitted by:	Kai Wang
MFC after:	3 days
2011-10-10 16:13:33 +00:00
Hans Petter Selasky
c61f25617c Implement missing USB debug information functions.
Approved by:	re (kib)
MFC after:	1 week
2011-09-19 08:52:06 +00:00
Hans Petter Selasky
11867070c6 Spelling corrections for LibUSB manual page (2/2).
MFC after:	1 week
Approved by:	re (kib)
PR:		docs/159898
2011-08-22 21:10:50 +00:00
Hans Petter Selasky
c8c1f2ec4d Whitespace corrections for LibUSB manual page (1/2).
MFC after:	1 week
Approved by:	re (kib)
PR:		docs/159898
2011-08-22 21:05:39 +00:00
Hans Petter Selasky
33ec9f0cb0 Use correct enum instead of constant value.
MFC after:	1 week
Spotted by:	scf @
Approved by:	re (kib)
2011-08-20 14:04:16 +00:00
Hans Petter Selasky
ca96e26a71 Update LibUSB v1.0 manual page:
- fix some minor spelling
 - fix some style
 - add description of new function

MFC after:	1 week
Approved by:	re (kib)
2011-08-16 21:04:04 +00:00
Hans Petter Selasky
9a46d4678d Add missing function to get device speed to the LibUSB v1.0 API.
MFC after:	1 week
Approved by:	re (kib)
2011-08-16 08:34:16 +00:00
Hans Petter Selasky
4eb5923d1a - 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
Hans Petter Selasky
a7e048a23f LibUSB v1.0: Need at least one frame when doing the dummy open
else clear stall won't work in that case.
2011-06-28 14:07:28 +00:00
Hans Petter Selasky
2485d8a793 - 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
Hans Petter Selasky
892f48069d - Add missing MLINKS for libusb and some manpage fixes.
MFC after:	14 days
Approved by:	thompsa (mentor)
2011-02-28 18:53:06 +00:00
Hans Petter Selasky
1c49736857 - 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
Kevin Lo
9998d4b63f Check the return value of malloc().
Reviewed by:	hselasky
MFC after:	3 days
2010-12-14 15:11:49 +00:00
Hans Petter Selasky
c865d740d5 Correct description of the return values of
the LibUSB v1.0 libusb_control_transfer() function.

PR:		usb/151851
Submitted by:	HIROSHI OOTA
Approved by:	thompsa (mentor)
2010-11-18 08:32:47 +00:00
Hans Petter Selasky
31f7072c3b Fix LibUSB v1.0 compliancy.
1) We need to allow the USB callback to free the USB transfer itself.
2) The USB transfer buffer should only be automatically freed when
freeing the USB transfer.

Fixed by:	hselasky
Submitted by:	Gustau Perez i Querol
Approved by:	thompsa (mentor)
2010-11-13 19:25:11 +00:00
Hans Petter Selasky
698e791af5 - Add missing LibUSB API functions:
* libusb_strerror()
  * libusb_get_driver[_np]()
  * libusb_detach_kernel_driver[_np]()
- Factor out setting of non-blocking flag inside libusb.
- Add missing NULL check after libusb_get_device() call.
- Correct some wrong error codes due to copy and paste error.

PR:	usb/150546
Submitted by:	Robert Jenssen, Alexander Leidinger
Approved by:    thompsa (mentor)
2010-10-14 20:50:33 +00:00
Hans Petter Selasky
51fd3d75fe - Add support for LibUSB in 32-bit compatibility mode.
Approved by:    thompsa (mentor)
2010-10-14 20:38:18 +00:00
Hans Petter Selasky
a122154901 - Fix some compile warnings regarding comparing signed to unsigned.
Approved by:    thompsa (mentor)
2010-10-14 20:18:39 +00:00
Hans Petter Selasky
f1b5fa6e49 LibUSB (new API):
- Add a new API function to check the connected
status of the USB handle in the LibUSB v1.0 and
LibUSB v0.1 interfaces.

Approved by:    thompsa (mentor)
2010-10-14 20:04:36 +00:00
Joel Dahl
c2025a7660 Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages.  Minor corrections by me.

Submitted by:	Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
2010-08-16 15:18:30 +00:00
Joel Dahl
f6ac23919b Fix typos and spelling mistakes. 2010-08-06 14:33:42 +00:00
Joel Dahl
799162a628 Spelling fixes. 2010-08-03 17:40:09 +00:00
Andrew Thompson
217c0da373 Fix return values for usb_find_busses() and usb_find_devices(). We should try
to return the actual number of busses and devices.

Reported by:	Mike Tancsa
Submitted by:	Hans Petter Selaksy
2010-05-13 00:26:30 +00:00
Andrew Thompson
9c087c5a19 Fix header file compliancy with libusb 1.0 from sourceforge.
Reported by:	Xiaofan Chen
Submitted by:	Hans Petter Selasky
2010-05-13 00:25:30 +00:00
Wojciech A. Koszek
f3cba95c5b 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