Commit Graph

149 Commits

Author SHA1 Message Date
Sebastian Zagrodzki
c437b39ef7 comments for endpointinfo type fields 2017-04-09 16:56:36 +02:00
Sebastian Zagrodzki
3e59eeac6c replace class/subclass with Class type 2017-04-09 16:41:38 +02:00
Sebastian Zagrodzki
83302ae558 add test for an interrupt endpoint. 2017-04-09 00:22:11 +02:00
Sebastian Zagrodzki
ab6b612d1b String of the endpoint should use EndpointInfo, not the default mapping
from InterfaceInfo.
2017-04-09 00:18:54 +02:00
Sebastian Zagrodzki
ca02c03241 since this is the only usecase, return a *libusbDevice for a new
pointer.
2017-04-09 00:12:39 +02:00
Sebastian Zagrodzki
3ec748db4c An invalid pointer triggers a runtime failure when passed as argument in
Go1.7:
runtime: bad pointer in frame
github.com/kylelemons/gousb/usb.(*fakeLibusb).open at 0xc420045ce0: 0x1
fatal error: invalid stack pointer

Use an arbitrary C-allocated pointer instead.
2017-04-09 00:10:15 +02:00
Sebastian Zagrodzki
e0f30623b3 Modify EndpointInfo to provide meaningful data rather than raw USB
descriptor values. E.g. for the user, the distinction between
MaxIsoPkt and MaxPktSize is irrelevant, only the calculated max packet
size matters.
2017-04-08 23:49:10 +02:00
Sebastian Zagrodzki
d982ef5a37 Add constants for device speed. 2017-03-27 23:01:02 +02:00
Sebastian Zagrodzki
f3b2f37e3a Rename the rest of the constants. 2017-03-27 22:33:29 +02:00
Sebastian Zagrodzki
36241e869e more constants 2017-03-27 22:29:24 +02:00
Sebastian Zagrodzki
b70848cf73 start renaming the constants to Go-style. 2017-03-27 22:23:47 +02:00
Sebastian Zagrodzki
341fde410e replace Endpoint interface with a real Endpoint struct. 2017-03-27 22:15:45 +02:00
Sebastian Zagrodzki
0a7fc9fb53 Merge branch 'master' of https://github.com/kylelemons/gousb into libusb_wrappers_tests 2017-03-26 17:46:12 +02:00
Sebastian Zagrodzki
1f977a94aa Update the comment - there's no way to create a new pointer to struct
libusb_device, since the struct is not defined in libusb headers (only
name is declared), as such the compiler doesn't know the size of the
struct to allocate.
2017-03-26 17:44:25 +02:00
Sebastian Zagrodzki
4c5589cffb Moar comments. 2017-03-23 18:07:55 +01:00
Sebastian Zagrodzki
fc41761879 Remove the alloc test that used real libusb allocation. 2017-03-10 09:25:57 -05:00
Sebastian Zagrodzki
81f2998055 Merge branch 'coverage' into libusb_wrappers_tests 2017-03-10 08:55:45 -05:00
Sebastian Zagrodzki
389ae4e2b3 EndpointInfo tests 2017-03-10 08:48:21 -05:00
Sebastian Zagrodzki
a221bef905 ensure the vid/pid match 2017-03-10 08:36:00 -05:00
Sebastian Zagrodzki
ff7995c159 Add endpoint open test 2017-03-10 08:35:50 -05:00
Sebastian Zagrodzki
991e1b6cc6 completed interface, no more references to real usb from fake. 2017-03-10 08:33:14 -05:00
Sebastian Zagrodzki
4add66ae0e move things around, to keep list of the devices at the beginning. 2017-03-10 07:39:51 -05:00
Sebastian Zagrodzki
d392ad305d Tests for OpenVidPid 2017-03-10 07:38:54 -05:00
Sebastian Zagrodzki
4b17678362 remove a call to libusb_open_device_with_vid_pid, as it's just a
convenience wrapper. Reimplement the same trivial wrapper in Go.
2017-03-10 07:22:04 -05:00
Sebastian Zagrodzki
5608fa49e7 remove superfluous imports 2017-03-10 07:09:12 -05:00
Sebastian Zagrodzki
a787d0a1d1 Modify the test for device list, drop noop/multiple contexts. 2017-03-10 07:08:35 -05:00
Sebastian Zagrodzki
c918a7e503 Skip the test, until rewritten. 2017-03-10 07:08:00 -05:00
Sebastian Zagrodzki
8af7ddc71b add two device descriptors 2017-03-10 07:07:44 -05:00
Sebastian Zagrodzki
c2776f302f Merge branch 'master' into libusb_wrappers_tests 2017-03-10 07:01:29 -05:00
zagrodzki
b5abadf3f0 Merge pull request #39 from kylelemons/libusb_wrappers
Libusb wrappers
2017-03-10 06:52:56 -05:00
Sebastian Zagrodzki
3b0b2f1a6b consistent skip message 2017-03-09 12:56:46 -05:00
Sebastian Zagrodzki
aaec52a9c3 more tests failing on travis 2017-03-09 12:43:08 -05:00
Sebastian Zagrodzki
a675c1b487 more tests failing on travis 2017-03-09 12:41:25 -05:00
Sebastian Zagrodzki
76721213eb Skip descriptor test on Travis. 2017-03-09 12:34:49 -05:00
Sebastian Zagrodzki
0099228bc3 started adding fakelibusb functions for testing device.go 2017-03-06 11:38:03 +01:00
Sebastian Zagrodzki
bed02e9838 A benchmark on the trivial cgo call, to assess overhead of different
ways of calling out to cgo.
2017-03-01 10:51:17 +01:00
Sebastian Zagrodzki
2d51a51ec5 newEndpoint no longer references *Device, but receives individual values
extracted from the device. Makes testing easier.
2017-02-26 21:47:47 +01:00
Sebastian Zagrodzki
d0859b8c47 Pass all required info to newEndpoint. 2017-02-26 21:44:15 +01:00
Sebastian Zagrodzki
676cb78cae unwrap the nested ifs 2017-02-26 21:43:56 +01:00
Sebastian Zagrodzki
c0d81e08a8 use a shared fakelibusb for mocking 2017-02-26 21:14:04 +01:00
Sebastian Zagrodzki
8addfb562f updated submit interface and added data() method. 2017-02-26 21:13:31 +01:00
Sebastian Zagrodzki
9eebb871cb Use fake libusb. Add testcase descriptions. 2017-02-26 21:13:09 +01:00
Sebastian Zagrodzki
6caeb9d701 remove transferIntf, instead rely on transfer.go "usbTransfer", but with
a fake libusb xfer underneath.
2017-02-26 21:12:18 +01:00
Sebastian Zagrodzki
c2167157be Move transfer_fakelibusb to fakelibusb, used in other tests too.
Change the interface a bit.
2017-02-26 21:08:08 +01:00
Sebastian Zagrodzki
00dbfd23dd done channel is now initialized on submit.
add a data() method, to avoid reaching into any xfer fields.
2017-02-26 21:02:29 +01:00
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