Sebastian Zagrodzki
5115a55a03
Redefine constants around control request types. ( #34 )
2018-04-05 13:23:20 +02:00
Sebastian Zagrodzki
d0366361a2
Add missing arguments to Interface() error on failed descriptor
...
retrieval.
2017-11-12 03:32:09 +01:00
Sebastian Zagrodzki
b893afb018
Add missing endpoint argument to Fatalf.
2017-11-12 03:29:28 +01:00
Davor Kapsa
e9aec43516
travis: update go versions ( #24 )
2017-11-12 03:22:54 +01:00
Sebastian Zagrodzki
85520e6880
Add missing argument to Fatalf.
2017-11-12 03:21:28 +01:00
zagrodzki
5c10dc8f4e
Write stream implementation ( #19 )
...
Defines a WriteStream structure for buffering writes, similar to the existing ReadStream. WriteStreams can be created on OutEndpoints by using ep.NewStream().
2017-09-08 13:41:25 +02:00
CriJonsi
01840c1d23
Add the number of the USB port in the DeviceDesc structure ( #18 )
2017-09-07 17:27:58 +02:00
zagrodzki
c113a5e0de
Parallelize tests ( #17 )
...
* Store a reference to libusb implementation in the context, transfers
and some more places. Remove the global libusb variable.
* Parallelize tests.
* Fix the link in README.
2017-09-04 16:55:47 +02:00
zagrodzki
f9aba6fab5
Config and interface description ( #16 )
...
* Add APIs for config and interface descriptors. Split out the common
parts of selecting a config descriptor from device desc and
selecting a setting descriptor from a config desc.
* Parallelize the few tests that actually can be parallelized safely.
Add comments where they can't. Note to self: it would be beneficial
to restructure the fakelibusb to index all properties of the lib
with the used context. That way a libusb implementation wouldn't need
to be referred via a shared variable.
2017-09-04 14:17:34 +02:00
zagrodzki
cf19eb7001
Fix a race condition in reuse of the same malloc result ( #15 )
...
In free(), remove Go references to the C memory before the C memory
itself is released. That ensures that a concurrent alloc()
will not try to insert the same pointer into the map that was not
yet removed.
2017-09-04 12:52:42 +02:00
Deomid Ryabkov
757722bf8e
Add Device.Manufacturer(), .Product() and .SerialNumber() ( #14 )
2017-09-04 00:42:55 +02:00
zagrodzki
1aaa100bdb
Allocate libusb buffers in C ( #11 )
...
* add alloc/free_transfer_and_buffer. Manages the buffer memory on the C
side.
* switch libusb.go to use the new alloc/free_transfer_and_buffer. Add
a new buffer() call to get access to the allocated buffer as a Go slice.
* Fake USB transfer uses the new alloc/free/buffer interface.
* Switch to the new libusb.alloc signature, where libusb owns the buffer.
* newUSBTransfer now allocates a separate buffer, do a copy on
endpoint.transfer.
* newUSBTransfer will now allocate it's own buffer.
* Enable autodetach in rawread.
2017-08-29 12:11:04 +02:00
Nico MT
bc91dd3f2c
Extend the autodetach behavior
...
Detach interfaces before trying to change the config, as libusb doesn't handle that automatically.
2017-07-21 21:15:49 +02:00
Veniamin Albaev
9829f2fcba
Fixed libusb: warning [libusb_exit] some libusb_devices were leaked ( #7 )
2017-07-20 14:09:58 +02:00
Filzmaier Josef
9fc0278283
Don't reset the configuration if desired config is already active ( #6 )
...
Fixes issue #5
2017-06-29 14:31:12 +02:00
Tamási Benjamin
aa64bae804
Appveyor support ( #2 )
2017-06-20 16:03:55 +02:00
zagrodzki
00e8f24bda
Merge pull request #1 from google/same-endpoint-in-out
...
Allow the same endpoint number to be reused for IN and OUT endpoints separately
2017-06-14 11:15:38 +02:00
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