platform/upstream/libusb.git
16 years agomore error code sanitization
Daniel Drake [Mon, 5 May 2008 20:17:03 +0000 (21:17 +0100)]
more error code sanitization

16 years agoIsochronous transfer helper functions
Daniel Drake [Mon, 5 May 2008 19:57:43 +0000 (20:57 +0100)]
Isochronous transfer helper functions

16 years agofree open devices on exit
Daniel Drake [Mon, 5 May 2008 16:54:33 +0000 (17:54 +0100)]
free open devices on exit

16 years agomove descriptor parsing into main library
Daniel Drake [Mon, 5 May 2008 16:47:49 +0000 (17:47 +0100)]
move descriptor parsing into main library

OS modules now provide functionality for fetching device/config
descriptors

16 years agoDetect endpoint halts and unsupported control requests
Daniel Drake [Mon, 5 May 2008 15:22:33 +0000 (16:22 +0100)]
Detect endpoint halts and unsupported control requests

16 years agoLinux: fix logical URB allocation
Daniel Drake [Mon, 5 May 2008 00:00:31 +0000 (01:00 +0100)]
Linux: fix logical URB allocation

We were allocating the wrong number of URBs for transfers of size
multiples of 16k.

16 years agoadd functionality for querying and detaching kernel driver
Daniel Drake [Sun, 4 May 2008 15:51:23 +0000 (16:51 +0100)]
add functionality for querying and detaching kernel driver

16 years agoDescriptor reading functionality
Daniel Drake [Sun, 4 May 2008 15:20:46 +0000 (16:20 +0100)]
Descriptor reading functionality

16 years agosanitized error returns from synchronous I/O functions
Daniel Drake [Sun, 4 May 2008 13:22:16 +0000 (14:22 +0100)]
sanitized error returns from synchronous I/O functions

16 years agoimplement libusb_reset_device()
Daniel Drake [Sun, 4 May 2008 13:10:19 +0000 (14:10 +0100)]
implement libusb_reset_device()

16 years agoAdd functionality to clear endpoint halt conditions
Daniel Drake [Sun, 4 May 2008 12:46:41 +0000 (13:46 +0100)]
Add functionality to clear endpoint halt conditions

16 years agoFix libusb_get_device_list return value
Daniel Drake [Sat, 3 May 2008 23:51:59 +0000 (00:51 +0100)]
Fix libusb_get_device_list return value

It was documented to return the list length, but was returning 0.

16 years agoWell-defined error codes for some operations
Daniel Drake [Sat, 3 May 2008 15:50:58 +0000 (16:50 +0100)]
Well-defined error codes for some operations

Also renamed set_interface_altsetting to set_interface_alt_setting for
better consistency

16 years agoAdd libusb_set_configuration()
Daniel Drake [Sat, 3 May 2008 15:24:11 +0000 (16:24 +0100)]
Add libusb_set_configuration()

16 years agorename LIBUSB_ERROR_NOMEM to LIBUSB_ERROR_NO_MEM
Daniel Drake [Sat, 3 May 2008 14:40:23 +0000 (15:40 +0100)]
rename LIBUSB_ERROR_NOMEM to LIBUSB_ERROR_NO_MEM
improves consistency

16 years agoLinux: better EACCES handling
Daniel Drake [Sat, 3 May 2008 13:34:54 +0000 (14:34 +0100)]
Linux: better EACCES handling

16 years agoRename reference counting API
Daniel Drake [Sat, 3 May 2008 13:26:56 +0000 (14:26 +0100)]
Rename reference counting API

This improves consistency with the naming style of other functions

16 years agoLinux: use read-only access to enumerate devices and descriptors
Daniel Drake [Sat, 3 May 2008 13:24:40 +0000 (14:24 +0100)]
Linux: use read-only access to enumerate devices and descriptors

Write access is not needed until later.
Also fix handling of open() error code.

16 years agodocument pollfd notifiers
Daniel Drake [Fri, 2 May 2008 16:45:23 +0000 (17:45 +0100)]
document pollfd notifiers

16 years agoAllow multiple interfaces to be claimed
Daniel Drake [Fri, 2 May 2008 16:33:52 +0000 (17:33 +0100)]
Allow multiple interfaces to be claimed

16 years agoDocumentation improvements
Daniel Drake [Fri, 2 May 2008 15:55:36 +0000 (16:55 +0100)]
Documentation improvements

16 years agodetect short descriptor reads
Daniel Drake [Fri, 2 May 2008 11:55:34 +0000 (12:55 +0100)]
detect short descriptor reads

16 years agoremove "references" and "referenced by" listings in documentation
Daniel Drake [Fri, 2 May 2008 11:32:46 +0000 (12:32 +0100)]
remove "references" and "referenced by" listings in documentation

16 years agoUse typedef ptr types in parameters and return types
Daniel Drake [Fri, 2 May 2008 11:32:08 +0000 (12:32 +0100)]
Use typedef ptr types in parameters and return types

This is passed through to the docs

16 years agoExpose bus number and device address
Daniel Drake [Fri, 2 May 2008 11:28:31 +0000 (12:28 +0100)]
Expose bus number and device address

16 years agostandardised error codes
Daniel Drake [Tue, 29 Apr 2008 14:26:46 +0000 (15:26 +0100)]
standardised error codes

16 years agoFix descriptor handling memory leaks
Daniel Drake [Tue, 29 Apr 2008 12:34:26 +0000 (13:34 +0100)]
Fix descriptor handling memory leaks

16 years agoRename endpoint_type to transfer_type
Daniel Drake [Sun, 27 Apr 2008 22:50:01 +0000 (23:50 +0100)]
Rename endpoint_type to transfer_type

Matches the USB specs more closely

16 years agoRemove a FIXME comment
Daniel Drake [Sun, 27 Apr 2008 22:41:24 +0000 (23:41 +0100)]
Remove a FIXME comment

it can't.

16 years agoFix unlocked flying_transfers list access
Daniel Drake [Sun, 27 Apr 2008 22:30:34 +0000 (23:30 +0100)]
Fix unlocked flying_transfers list access

16 years agoRemove libusb_cancel_transfer_sync
Daniel Drake [Sun, 27 Apr 2008 22:27:04 +0000 (23:27 +0100)]
Remove libusb_cancel_transfer_sync

This wasn't a particularly nice API. Cancellation should be handled by
the completion handler.

16 years agoremove extra timeout check
Daniel Drake [Sun, 27 Apr 2008 18:56:02 +0000 (19:56 +0100)]
remove extra timeout check

If select() didn't timeout then don't check for more timeouts

16 years agoDocumentation touchups
Daniel Drake [Sun, 27 Apr 2008 18:53:51 +0000 (19:53 +0100)]
Documentation touchups

Detail that interrupt polling interval is fixed to endpoint bInterval,
and that data may be transferred even on a timeout condition.

16 years agoadd threaded example program
Daniel Drake [Sat, 19 Apr 2008 15:17:53 +0000 (16:17 +0100)]
add threaded example program

16 years agolibusb_device mutex protection
Daniel Drake [Fri, 18 Apr 2008 22:58:54 +0000 (23:58 +0100)]
libusb_device mutex protection

16 years agomutex protection for device and handle lists
Daniel Drake [Fri, 18 Apr 2008 22:42:40 +0000 (23:42 +0100)]
mutex protection for device and handle lists

16 years agolock flying_transfers during transfer removal
Daniel Drake [Fri, 18 Apr 2008 19:00:31 +0000 (20:00 +0100)]
lock flying_transfers during transfer removal

16 years agopollfds mutex protection
Daniel Drake [Fri, 18 Apr 2008 18:59:56 +0000 (19:59 +0100)]
pollfds mutex protection

16 years agoflying_transfers mutex protection
Daniel Drake [Thu, 17 Apr 2008 17:24:54 +0000 (18:24 +0100)]
flying_transfers mutex protection

This marks the beginnings of thread safety

16 years agoLinux: fix control transfer cancellation
Daniel Drake [Thu, 17 Apr 2008 16:44:28 +0000 (17:44 +0100)]
Linux: fix control transfer cancellation

16 years agoset correct endpoint type for isochronous transfers
Daniel Drake [Mon, 14 Apr 2008 19:03:27 +0000 (20:03 +0100)]
set correct endpoint type for isochronous transfers

Pointed out by Felix Domke

16 years agoLinux: fire multiple URBs at once for split transfers
Daniel Drake [Fri, 11 Apr 2008 20:40:07 +0000 (21:40 +0100)]
Linux: fire multiple URBs at once for split transfers

This results in a significant performance increase for bulk transfers
larger than 16kb, and fixes a bug where data would be spliced and mixed
between two simultaneously submitted transfers to the same endpoint.

It also allows isochronous transfers larger than 16kb to be submitted.

This commit also improves cancellation - the library now understands
what is going on.

16 years agoConstify some return data
Daniel Drake [Tue, 1 Apr 2008 22:28:32 +0000 (23:28 +0100)]
Constify some return data

Make it clear that apps should not mess with these structures

16 years agoRename libusb_poll() to libusb_handle_events()
Daniel Drake [Sun, 30 Mar 2008 21:19:00 +0000 (22:19 +0100)]
Rename libusb_poll() to libusb_handle_events()

16 years agoIsochronous endpoint I/O
Daniel Drake [Tue, 25 Mar 2008 16:24:30 +0000 (16:24 +0000)]
Isochronous endpoint I/O

Due to variable-sized structures, this involved changing allocation
mechanism. All transfers must now be allocated and freed through
libusb.

A synchronous function is missing, and I could do with writing a few
more helper functions to simplify things.

16 years agodistcheck fix for docs
Daniel Drake [Sun, 23 Mar 2008 21:17:32 +0000 (21:17 +0000)]
distcheck fix for docs

16 years agoSupport for changing altsetting
Daniel Drake [Sun, 23 Mar 2008 21:13:14 +0000 (21:13 +0000)]
Support for changing altsetting

Will probably be suject to later consideration w.r.t. claiming of endpoints

16 years agoit's called bmRequestType
Daniel Drake [Thu, 20 Mar 2008 21:10:01 +0000 (21:10 +0000)]
it's called bmRequestType

16 years agoSave transfer flags before invoking callback
Daniel Drake [Thu, 20 Mar 2008 21:07:00 +0000 (21:07 +0000)]
Save transfer flags before invoking callback

The callback may free the transfer, in which case we can't read the flags
after it has returned.

16 years agoAPI documentation
Daniel Drake [Sat, 15 Mar 2008 16:35:12 +0000 (16:35 +0000)]
API documentation

Hopefully mostly complete. Some constants were renamed and move into
enums.

16 years agoFix get_device_list for realloc case
Vasily Khoruzhick [Sat, 15 Mar 2008 11:50:53 +0000 (13:50 +0200)]
Fix get_device_list for realloc case

get_device_list can modify pointer passed to it with realloc, but this
case wasn't handled and caused crash on my machine. Fixed

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
16 years agoBeginnings of cross-platform abstraction
Daniel Drake [Thu, 13 Mar 2008 12:36:56 +0000 (12:36 +0000)]
Beginnings of cross-platform abstraction

This also includes a libusb_get_pollfds API change

16 years agoAdd transfer flags
Daniel Drake [Mon, 10 Mar 2008 18:38:15 +0000 (18:38 +0000)]
Add transfer flags

16 years agoSimplify libusb_fill_control_transfer()
Daniel Drake [Mon, 10 Mar 2008 11:32:15 +0000 (11:32 +0000)]
Simplify libusb_fill_control_transfer()

Transfer length can be inferred from the setup packet.

16 years agoget_device fixup
Daniel Drake [Mon, 10 Mar 2008 11:29:24 +0000 (11:29 +0000)]
get_device fixup

Rename API away from "devh" and fix implementation to match header

16 years agoRename descriptor-getting functions
Daniel Drake [Sun, 9 Mar 2008 16:27:06 +0000 (16:27 +0000)]
Rename descriptor-getting functions

Based on feedback from Tim Roberts

16 years agoSimplify cancellation API
Daniel Drake [Sun, 9 Mar 2008 16:15:02 +0000 (16:15 +0000)]
Simplify cancellation API

No need to provide the device here.

16 years agoRename libusb_dev_handle to libusb_device_handle
Daniel Drake [Sun, 9 Mar 2008 16:12:08 +0000 (16:12 +0000)]
Rename libusb_dev_handle to libusb_device_handle

16 years agoMove synchronous I/O implementation to its own file
Daniel Drake [Sun, 9 Mar 2008 01:01:57 +0000 (01:01 +0000)]
Move synchronous I/O implementation to its own file

16 years agoSeparate transfer allocation and submission
Daniel Drake [Sun, 9 Mar 2008 00:58:09 +0000 (00:58 +0000)]
Separate transfer allocation and submission

Leads to some hefty API changes. Now we're much more similar to the
Linux kernel model.

Problems with dealing with asynchronous control transfers are passed
on to the user, basically you must allocate a buffer, start with the
setup, and put the data after. This won't make much sense until
documented (soon...)

16 years agoRework URB API naming
Daniel Drake [Sat, 8 Mar 2008 12:48:35 +0000 (12:48 +0000)]
Rework URB API naming

Now refer to everything as "transfers" as consistent with the USB spec
libusb_transfer is now a kind of transfer handle. To reduce confusion
with libusb_bulk_transfer and libusb_control_transfer, those have been
renamed to libusb_{control,bulk}_transfer_request.

16 years agoAdd fallback on /proc/bus/usb
Daniel Drake [Sat, 8 Mar 2008 11:53:33 +0000 (11:53 +0000)]
Add fallback on /proc/bus/usb

/dev/bus/usb is a relatively new thing probably not present on every
system

16 years agoPersistent libusb_device storage
Daniel Drake [Sat, 8 Mar 2008 00:10:16 +0000 (00:10 +0000)]
Persistent libusb_device storage

Devices are now assigned a session ID (currently busnum:devaddr) which
is used to distinguish unique devices.

Now multiple callers of libusb_get_device_list will get the same
libusb_device structure instances.

16 years agoAdd convenience function to find and open a device by USB VID+PID
Daniel Drake [Thu, 6 Mar 2008 23:43:57 +0000 (23:43 +0000)]
Add convenience function to find and open a device by USB VID+PID

Lots of libusb apps I write are simple test apps not intended to be real
apps. Having a function available to quickly locate my device will be
handy in such situations.

16 years agoRework device discovery API
Daniel Drake [Thu, 6 Mar 2008 23:25:20 +0000 (23:25 +0000)]
Rework device discovery API

libusb_find_devices and libusb_get_devices are no more

libusb_get_device_list obtains a list of libusb_device structures for all
known devices in the system.

Each libusb_device now has a reference count, defaulting to 1 on
instantiation. The reference count of 1 refers to the fact that it is
present in the list in this scenario.

Opening a device adds a pointer to the libusb_device structure in the
handle, so that also adds a reference. Closing the device removes that
reference.

The function to free the device list can optionally unref all the devices
inside.

In future we will make the libusb_device instances all "global" so that if
the app calls get_device_list twice it actually gets the same libusb_device
structure references back. This way we can start to track disconnects, and
we can investigate adding a unique "session ID" to each libusb_device, an
identifier guaranteed to be unique to that device until reboot.

16 years agoRemove ctrl debug code
Daniel Drake [Thu, 6 Mar 2008 17:05:04 +0000 (17:05 +0000)]
Remove ctrl debug code

This was unintentionally committed

16 years agoNotifications for changes to the fd set
Daniel Drake [Tue, 26 Feb 2008 22:11:34 +0000 (22:11 +0000)]
Notifications for changes to the fd set

Applications can now be notified when they should start and stop polling
new file descriptors.

16 years agoFix header installation path
Daniel Drake [Fri, 1 Feb 2008 12:20:20 +0000 (12:20 +0000)]
Fix header installation path

16 years agoTODO update
Daniel Drake [Wed, 30 Jan 2008 13:24:54 +0000 (13:24 +0000)]
TODO update

16 years agoRemove timers and signalfd
Daniel Drake [Wed, 30 Jan 2008 13:19:10 +0000 (13:19 +0000)]
Remove timers and signalfd

Instead of timers, add a mechanism for informing the parent app when the
next timeout is due to happen, so that it can call us at that time.

As we no longer use signals, signalfd has also been removed.

16 years agoPoll usbfs descriptors directly
Daniel Drake [Sat, 26 Jan 2008 18:16:56 +0000 (18:16 +0000)]
Poll usbfs descriptors directly

We don't need to use signalfd for this functionality because we can poll
the file descriptors for write events.

16 years agoFix dpfp example compilation
Daniel Drake [Sat, 26 Jan 2008 17:26:40 +0000 (17:26 +0000)]
Fix dpfp example compilation

16 years agoC++ header safety
Daniel Drake [Sat, 26 Jan 2008 17:22:53 +0000 (17:22 +0000)]
C++ header safety

Pointed out by JF

16 years agoOnly use -fgnu89-inline when supported
Daniel Drake [Sat, 26 Jan 2008 14:03:43 +0000 (14:03 +0000)]
Only use -fgnu89-inline when supported

J F pointed out that this option only works on gcc 4.3 and newer.

16 years agoRemove more fpusb remnants
Daniel Drake [Sat, 5 Jan 2008 21:59:40 +0000 (21:59 +0000)]
Remove more fpusb remnants

16 years agoTODO update
Daniel Drake [Fri, 4 Jan 2008 01:19:07 +0000 (01:19 +0000)]
TODO update

Start listing the things I want to discuss/reconsider before 1.0 API
is final.

16 years agoRename some _devh_ functions
Daniel Drake [Fri, 4 Jan 2008 01:17:06 +0000 (01:17 +0000)]
Rename some _devh_ functions

Decided against naming functions in this style based on advice from
Tim Roberts. Still not really sure about devh naming in general.

16 years agoUse "transfer" instead of "msg"
Daniel Drake [Fri, 4 Jan 2008 01:13:25 +0000 (01:13 +0000)]
Use "transfer" instead of "msg"

Based on a discussion with Tim Roberts.

16 years agoPlural of bus is busses
Daniel Drake [Fri, 4 Jan 2008 00:57:00 +0000 (00:57 +0000)]
Plural of bus is busses

SF #1633043

16 years agoAPI renaming: remove fpi and usb_ stuff
Daniel Drake [Fri, 4 Jan 2008 00:54:57 +0000 (00:54 +0000)]
API renaming: remove fpi and usb_ stuff

fpi changed to usbi.

We should not expose structures with prefix "usb_" in the public
namespace as it is quite likely there will be some conflict somewhere.
Instead, using "libusb_" should be safer.

16 years agoRename to libusb-1.0
Daniel Drake [Fri, 4 Jan 2008 00:40:49 +0000 (00:40 +0000)]
Rename to libusb-1.0

I've taken over the libusb project, and what was previously known as fpusb
will eventually be released as libusb-1.0.

16 years agoCompiler flags update
Daniel Drake [Sun, 30 Dec 2007 22:09:50 +0000 (22:09 +0000)]
Compiler flags update

Also fix some warnings

16 years agoFix signalfd structure size on x86
Daniel Drake [Sun, 30 Dec 2007 22:05:17 +0000 (22:05 +0000)]
Fix signalfd structure size on x86

ptr is a 64-bit value

16 years agoDon't pass ctrl_msg/bulk_msg structures through async paths
Daniel Drake [Wed, 12 Dec 2007 23:32:54 +0000 (23:32 +0000)]
Don't pass ctrl_msg/bulk_msg structures through async paths

These are easiest to construct on the stack, but in the async case it is
likely that the submitting function returns (hence stack is destroyed)
before URB completion.

16 years agoAdd functionality to access device descriptors
Daniel Drake [Mon, 3 Dec 2007 23:29:22 +0000 (23:29 +0000)]
Add functionality to access device descriptors

16 years agoRename fpusb_device_handle functions to devh
Daniel Drake [Mon, 3 Dec 2007 22:27:21 +0000 (22:27 +0000)]
Rename fpusb_device_handle functions to devh

Prevents confusion with functions that work on fpusb_dev structures.

16 years agoAdd API to access poll fd
Daniel Drake [Sun, 2 Dec 2007 23:16:57 +0000 (23:16 +0000)]
Add API to access poll fd

Almost forgot... :)

16 years agoInitial commit
Daniel Drake [Wed, 28 Nov 2007 13:48:45 +0000 (13:48 +0000)]
Initial commit

Basic library structure which supports enumerating detected USB devices