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.
This commit is contained in:
zagrodzki
2017-09-04 16:55:47 +02:00
committed by GitHub
parent f9aba6fab5
commit c113a5e0de
15 changed files with 159 additions and 120 deletions

View File

@@ -120,12 +120,12 @@ func (c *Config) Interface(num, alt int) (*Interface, error) {
}
// Claim the interface
if err := libusb.claim(c.dev.handle, uint8(num)); err != nil {
if err := c.dev.ctx.libusb.claim(c.dev.handle, uint8(num)); err != nil {
return nil, fmt.Errorf("failed to claim interface %d on %s: %v", num, c, err)
}
if err := libusb.setAlt(c.dev.handle, uint8(num), uint8(alt)); err != nil {
libusb.release(c.dev.handle, uint8(num))
if err := c.dev.ctx.libusb.setAlt(c.dev.handle, uint8(num), uint8(alt)); err != nil {
c.dev.ctx.libusb.release(c.dev.handle, uint8(num))
return nil, fmt.Errorf("failed to set alternate config %d on interface %d of %s: %v", alt, num, c, err)
}