Commit Graph

27 Commits

Author SHA1 Message Date
Sebastian Zagrodzki
b9dabf4da9 Add a method to return a fake allocated transfer. 2017-04-27 03:12:06 +02:00
Sebastian Zagrodzki
93355e7490 replace uint32 in MaxPacketSize with int 2017-04-26 22:27:12 +02:00
Sebastian Zagrodzki
83276566fc Replace uint8 with Go-idiomatic int, where it makes sense. 2017-04-26 22:22:07 +02:00
Sebastian Zagrodzki
550fe8d1f2 Introduce xferMap, avoid passing Go pointer into the C code.
Weirdness with memory barriers.
2017-04-26 21:32:49 +02:00
Sebastian Zagrodzki
5150242633 Set slice length, since we don't use append. 2017-04-10 01:41:12 +02:00
Sebastian Zagrodzki
aaef575b06 rename Setups to AltSettings 2017-04-09 20:45:35 +02:00
Sebastian Zagrodzki
56162d0105 Remove BCD.Int, add BCD.Major/Minor. Remove USB spec versions
- I don't expect them to get much use, and reuse of BCD for USB spec
version and device revision makes it somewhat confusing.
2017-04-09 20:25:16 +02:00
Sebastian Zagrodzki
a5c4de3a29 more comments. Rename USBError to just Error. 2017-04-09 19:41:44 +02:00
Sebastian Zagrodzki
87c7a873e9 Go naming for error codes. Export USBError type. 2017-04-09 19:27:33 +02:00
Sebastian Zagrodzki
f668df87df OpenEndpoint for now takes an address - a device can have two endpoints
with the same number...
2017-04-09 19:08:42 +02:00
Sebastian Zagrodzki
f58798160d make addr() part of EndpointInfo 2017-04-09 18:55:41 +02:00
Sebastian Zagrodzki
13f4e95f2f Unexport bitmasks, they are only used internally. All values present
in exported structs are meaningful and the users should not need to use
bitmasks.
2017-04-09 18:53:49 +02:00
Sebastian Zagrodzki
3d62929e05 Replace EndpointDirection with a bool 2017-04-09 18:51:51 +02:00
Sebastian Zagrodzki
168b501d53 Rename IfClass/IfSubClass/IfProtocol to Class/SubClass/Protocol, these
fields occur within an interface descriptor.
2017-04-09 18:44:32 +02:00
Sebastian Zagrodzki
f91d53931a Use Protocol type for USB interface protocol. 2017-04-09 18:42:04 +02:00
Sebastian Zagrodzki
d3428d9b35 Use Class for classes in usbid. 2017-04-09 18:29:16 +02:00
Sebastian Zagrodzki
3e59eeac6c replace class/subclass with Class type 2017-04-09 16:41:38 +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
36241e869e more constants 2017-03-27 22:29:24 +02: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
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
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
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