393 Commits

Author SHA1 Message Date
Sebastian Zagrodzki
2b78100ce3 Allow the same endpoint number to be reused for IN and OUT endpoints
separately, effectively allowing two endpoints with the same number
- numbers are no unique, only endpoint addresses are.
2017-06-13 23:04:34 +02:00
Sebastian Zagrodzki
883910dd57 Call the API stable. 2017-06-13 10:58:50 +02:00
Sebastian Zagrodzki
f87a74e39f Update uses of List/OpenDevices 2017-06-13 10:56:35 +02:00
Sebastian Zagrodzki
67ddfbabc2 Rename ListDevices to OpenDevices. Add more doc for RemoteWakeup. 2017-06-13 10:55:30 +02:00
Sebastian Zagrodzki
e1fd376a2e more comment updates, rename "intf" parameter of Interface to "num" 2017-06-13 10:48:28 +02:00
Sebastian Zagrodzki
e40669b614 Move examples to external, so that gousb is explicitly referenced. 2017-06-13 10:42:18 +02:00
Sebastian Zagrodzki
b709988501 Fix typos, more precise example for configurations. 2017-06-13 10:40:01 +02:00
Sebastian Zagrodzki
688cb291dd Remove unused references to iso_packet_desc field in libusb_transfer. 2017-05-07 17:54:55 +02:00
Sebastian Zagrodzki
a367f386ff populate MaxControlPacketSize 2017-05-07 13:42:09 +02:00
Sebastian Zagrodzki
ead4e1f406 That didn't pan out - libusb does not have functions that would
allow returning raw config descriptor without opening the device.
2017-05-07 13:38:40 +02:00
Sebastian Zagrodzki
5f9276965f Start decoding descriptor in Go, rather than relying on libusb helper
functions. Descriptor format is defined explicitly by the USB spec.
2017-05-06 23:42:52 +02:00
Sebastian Zagrodzki
b0df83bff6 Add PollInterval specifications. 2017-05-06 13:16:48 +02:00
Sebastian Zagrodzki
bcc0b02135 move sections around 2017-05-06 02:58:50 +02:00
Sebastian Zagrodzki
865b14439b WriteStream not used yet. 2017-05-06 02:56:37 +02:00
Sebastian Zagrodzki
e117225966 lint fixes 2017-05-06 02:54:22 +02:00
Sebastian Zagrodzki
d68d0c1a41 Rename more "Info" fields to "Desc" 2017-05-06 02:52:19 +02:00
Sebastian Zagrodzki
9f04f7bdf0 Replace anonymous DeviceDesc field import with a named "Desc" field. 2017-05-06 02:47:24 +02:00
Sebastian Zagrodzki
4991f9c89b use ConfigDesc, InterfaceDesc and EndpointDesc. 2017-05-06 02:43:16 +02:00
Sebastian Zagrodzki
e5961a7cc4 rename ConfigInfo to ConfigDesc 2017-05-06 02:40:09 +02:00
Sebastian Zagrodzki
fedc9864dd rename Descriptor to DeviceDesc 2017-05-06 02:36:45 +02:00
Sebastian Zagrodzki
86c8e27edf moar comments. Add a done callback to DefaultInterface return values. 2017-05-06 02:30:16 +02:00
Sebastian Zagrodzki
c6b9a04e9f Document Interface parameters. 2017-05-06 02:19:57 +02:00
Sebastian Zagrodzki
89dc91ef06 Moar documentation and examples. 2017-05-06 02:16:53 +02:00
Sebastian Zagrodzki
eb5500f387 Move Control from Config to Device.
Rename Default to DefaultInterface.
2017-05-06 02:16:22 +02:00
Sebastian Zagrodzki
1c9a11b1ce Remove "libusb" from the comments. 2017-05-06 00:31:04 +02:00
Sebastian Zagrodzki
9623c1ba8d replace ActiveConfig with ActiveConfigNum.
Add a Default() helper that simplifies setup for uncomplicated USB
devices.
2017-05-06 00:20:43 +02:00
Sebastian Zagrodzki
5200a36191 Move files from gousb/usb to gousb 2017-05-06 00:11:11 +02:00
Sebastian Zagrodzki
acb9ee3242 Add notes about this being ver 2.0 of kylelemons/gousb 2017-05-05 23:44:51 +02:00
Sebastian Zagrodzki
e33e0fef82 s/kylelemons/google/ in the new repo. 2017-05-05 23:41:11 +02:00
Sebastian Zagrodzki
730c32b9fd Add tests for endpoint NewStream.
Rename OpenWithVidPid to OpenWithVIDPID.
2017-04-29 12:57:55 +02:00
Sebastian Zagrodzki
58c1e6ddb4 add tests for active config and reset 2017-04-29 12:23:45 +02:00
Sebastian Zagrodzki
2794d88744 config is %d, not %s 2017-04-29 12:21:17 +02:00
Sebastian Zagrodzki
6d81ca37d3 Use a map to store endpoint descriptors. Allows easy access to a
particular endpoint number.
2017-04-29 12:19:34 +02:00
Sebastian Zagrodzki
77c176cd4c Replace descriptor Configs with a map - config ids are arbitrary numbers
(unlike interface or alt setting numbers, which are 0-based array indices).
This makes it easier to access a particular config without having to
iterate over the descriptors.
2017-04-29 11:56:49 +02:00
Sebastian Zagrodzki
60d0aba507 Use int for Bus/Addr, not uint8. 2017-04-29 02:12:04 +02:00
Sebastian Zagrodzki
541275d5b9 update error message to be more verbose 2017-04-29 01:37:39 +02:00
Sebastian Zagrodzki
b39b8d9521 Add "empty" to confirm no transfers are in flight in fakeusb.
Update endpoint_test - if buffer length is 0, no transfer is submitted.
2017-04-29 01:35:09 +02:00
Sebastian Zagrodzki
c2d1a4c03d Format bus/addr with a dot. 2017-04-29 01:00:19 +02:00
Sebastian Zagrodzki
ef59587a24 move descriptor to the device, like config and interface.
Clear separation between descriptor stringers and value stringers for
the device and interface.
2017-04-29 00:59:13 +02:00
Sebastian Zagrodzki
59b493ec3c Separate descriptor Stringer from value Stringer. 2017-04-29 00:53:42 +02:00
Sebastian Zagrodzki
a69a315dbd Verify that interface and alternate numbers are 0-based indices, we rely
on this assumption in the config.
2017-04-29 00:50:38 +02:00
Sebastian Zagrodzki
80f3c60b2b Better error messages.
Update rawread to use the new endpoint interface.
2017-04-29 00:41:26 +02:00
Sebastian Zagrodzki
1fd4e7f4c4 Check if the device is already closed and if the interface is already
claimed.
2017-04-29 00:27:51 +02:00
Sebastian Zagrodzki
0cfaee3514 Fail operations if Close was called before. 2017-04-29 00:18:26 +02:00
Sebastian Zagrodzki
b6268be76b Merge branch 'gousb2.0-dev' of https://github.com/kylelemons/gousb into gousb2.0-dev 2017-04-29 00:04:01 +02:00
Sebastian Zagrodzki
5f122b4dcd Introduce two more layers between device and endpoint:
device -> active config -> claimed interface -> endpoints.
Device can have at most one active config. A config can have
multiple claimed interfaces, each with a specific alt setting.
An interface with an alt setting defines a list of endpoints.
2017-04-29 00:01:11 +02:00
Sebastian Zagrodzki
d193e605a4 fix extra Logf arguments 2017-04-28 23:58:56 +02:00
Sebastian Zagrodzki
5c63741f14 more readable debug log prefix 2017-04-28 23:58:16 +02:00
Sebastian Zagrodzki
26b662893d Use a new behavior of newFakeLibusb.
Add a benchmark for subslicing.
2017-04-27 03:26:08 +02:00
Sebastian Zagrodzki
d85a738414 a new fakelibusb will overwrite libusb and restore it automatically on
done()
2017-04-27 03:25:36 +02:00