Commit Graph

204 Commits

Author SHA1 Message Date
Sebastian Zagrodzki
69f9eb93e2 When terminating the Context, wait for the background goroutine
to sync on c.done channel before exiting.
2017-02-24 09:36:17 +01:00
Sebastian Zagrodzki
81e9253f49 no more C in transfer.go 2017-02-23 10:46:04 +01:00
Sebastian Zagrodzki
bf3b23ccd2 move all transfer C parts to libusb.go to alloc() 2017-02-23 10:45:35 +01:00
Sebastian Zagrodzki
21d53c9180 usb.go no longer needs "C" 2017-02-23 10:39:50 +01:00
Sebastian Zagrodzki
74b932b022 Duh, missing libusb.go... 2017-02-23 10:38:25 +01:00
Sebastian Zagrodzki
82184ea552 make libusbDevHandle part of alloc() 2017-02-23 10:29:24 +01:00
Sebastian Zagrodzki
cc135fe616 move all libusb wrappers to libusb.go. 2017-02-23 10:25:02 +01:00
Sebastian Zagrodzki
577447ecbf s/newRealUSBTransfer/newLibUSBTransfer/ 2017-02-22 23:52:28 +01:00
Sebastian Zagrodzki
313ba15ee6 unexport read/write timeout. 2017-02-22 23:51:36 +01:00
Sebastian Zagrodzki
01ec3a240e use named receiver in all methods for nicer indentation. 2017-02-22 23:36:28 +01:00
Sebastian Zagrodzki
9fdd8c7eb8 Rename epSetup to epCfg. 2017-02-22 01:36:36 +01:00
Sebastian Zagrodzki
34c00f398b - more tests, for "out" endpoint. 2017-02-22 01:35:13 +01:00
Sebastian Zagrodzki
ea2d93bbca Merge branch 'master' into endpoint_tests 2017-02-22 01:04:45 +01:00
Sebastian Zagrodzki
fc1be79d5d range xfers 2017-02-22 01:00:27 +01:00
Sebastian Zagrodzki
0e46520137 change test slightly, add test for write on in endpoint 2017-02-22 00:58:50 +01:00
Sebastian Zagrodzki
c7c647e701 First tests. 2017-02-19 16:04:16 +01:00
Sebastian Zagrodzki
2efb1a354f Use newEndpoint() for initialization. Add an indirection for
newUSBTransfer.
2017-02-19 15:35:35 +01:00
Sebastian Zagrodzki
360740e76c Cast libusb_transfer explicitly, to make Go 1.8 happy. 2017-02-18 18:13:22 +01:00
Sebastian Zagrodzki
8eaaee4223 Merge remote-tracking branch 'origin/master' into transfer_tests 2017-02-18 18:06:00 +01:00
vincentserpoul
303eb08f98 comment nitpicking :) 2017-02-17 02:48:05 +08:00
vincentserpoul
a431f86bcb comment grammar 2017-02-17 02:28:24 +08:00
vincentserpoul
0a1a8e43cd error handling and bool handling 2017-02-17 02:00:24 +08:00
vincentserpoul
d8e3995f7c improve comment 2017-02-17 02:00:24 +08:00
vincentserpoul
09dcccd0dd add bool handling 2017-02-17 02:00:24 +08:00
vincentserpoul
6586e027a6 remove systematic detach, add SetAutoDetach method 2017-02-17 02:00:24 +08:00
vincentserpoul
7c2897852d detach before claim 2017-02-17 02:00:24 +08:00
Sebastian Zagrodzki
fce1a48eba Endpoint no longer needs cgo. 2017-02-16 12:05:48 +01:00
Sebastian Zagrodzki
99ec211c43 Improve tests - use offsetof to find the position of the iso packet
descriptor in the transfer struct.
2017-02-16 12:04:10 +01:00
Sebastian Zagrodzki
ef932806ed more comments about transfer protocol. 2017-02-15 18:20:32 +01:00
Sebastian Zagrodzki
0ba09a9942 Move device handle to newUSBTransfer args, remove separate attach() 2017-02-14 01:24:20 +01:00
Sebastian Zagrodzki
16f99ed0b0 Merge remote-tracking branch 'origin/master' into async_transfers_everywhere 2017-02-14 01:12:35 +01:00
Sebastian Zagrodzki
1b4014cb28 Set the pointer type, to make the compiler happy, otherwise it might
complain about the incompatible pointer types.
2017-02-13 19:25:24 +01:00
Sebastian Zagrodzki
d4d7011a44 Don't assume libusb headers are always in libusb-1.0.
Use pkg-config to add correct include paths for libusb regardless of the
platform.
2017-02-13 17:08:46 +01:00
Sebastian Zagrodzki
e9d2ce49f0 Add missing attach. 2017-02-13 03:17:29 +01:00
Sebastian Zagrodzki
931a15849b set the same channel in t.xfer.user_data as in t.done. 2017-02-13 03:14:38 +01:00
Sebastian Zagrodzki
ea1db2d56a move to updated transfer init protocol 2017-02-13 03:02:32 +01:00
Sebastian Zagrodzki
4a64c18350 move newUSBTransfer as a vanilla function to transfer.go.
Initialize all static params at new.
2017-02-13 03:01:30 +01:00
Sebastian Zagrodzki
a47809fda8 Simplify the C part even more - the buffer that xfer uses for
transferring data is the same as the one that was created in
newUSBTransfer.
2017-02-13 02:50:47 +01:00
Sebastian Zagrodzki
83a4778988 wait() does not need the buffer passed explicitly, it's already stored
in t.buf.
2017-02-10 22:32:16 +01:00
Sebastian Zagrodzki
1860441a7b iso.go is no longer needed, the only iso-specific part lives in
transfer.c
2017-02-10 22:12:21 +01:00
Sebastian Zagrodzki
31b3ac1c67 move iso.c to transfer.c, as it's used for all transfers.
move transfer callback to transfer.go.
2017-02-10 22:11:54 +01:00
Sebastian Zagrodzki
d7ed6d67e6 Rename iso_callback to transfer_callback, it's used for all transfer
types.
2017-02-10 22:08:39 +01:00
Sebastian Zagrodzki
87abb704d7 Make all transfer types use a generic endpoint.transfer() function
that uses libusb's asynchronous interface.
2017-02-10 22:06:57 +01:00
Sebastian Zagrodzki
c9c2757fe6 Replace the libusb_bulk_transfer with the same prepare-submit-wait
routine iso transfers use.
2017-02-10 21:46:12 +01:00
Sebastian Zagrodzki
9e50cd8c1c Rename extract_data to extract_iso_data, add extract_data for use by
other transfer types.
2017-02-10 21:45:26 +01:00
Sebastian Zagrodzki
b4393ac372 Merge branch 'rawread_benchmark' 2017-02-09 22:52:55 +01:00
Sebastian Zagrodzki
c792f8e028 replace allocTransfer with a new more generic newUSBTransfer 2017-02-09 22:51:28 +01:00
Sebastian Zagrodzki
de92c7047b make methods of usbTransfer private 2017-02-09 22:38:16 +01:00
Sebastian Zagrodzki
80b2741a2c Rename Transfer to usbTransfer, it's internal to gousb.
Move usbTransfer and it's methods to transfer.go, it's not only used by
iso transfers.
2017-02-09 22:36:51 +01:00
Sebastian Zagrodzki
66a1f45cd9 Remove the artificial limit. The worst case is a longer timeout for the
transfer is required.
2017-02-08 23:29:17 +01:00