Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2f9ed92cb8 | ||
![]() |
5514912016 |
2
.github/test-coverage.sh
vendored
2
.github/test-coverage.sh
vendored
@@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
echo 'mode: count' > coverage.merged &&\
|
echo 'mode: count' > coverage.merged &&\
|
||||||
go list -f '{{.Dir}}' ./... | xargs -n1 -I'{}' sh -c ': > coverage.tmp; go test -v -covermode=count -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> coverage.merged' &&\
|
go list -f '{{.Dir}}' ./... | xargs -I'{}' sh -c ': > coverage.tmp; go test -v -covermode=count -coverprofile=coverage.tmp {} && tail -n +2 coverage.tmp >> coverage.merged' &&\
|
||||||
rm coverage.tmp
|
rm coverage.tmp
|
||||||
|
8
.github/workflows/build-and-test.yaml
vendored
8
.github/workflows/build-and-test.yaml
vendored
@@ -1,13 +1,13 @@
|
|||||||
name: build-and-test
|
name: build-and-test
|
||||||
on: [pull_request, push]
|
on: [pull_request, push, workflow_dispatch]
|
||||||
jobs:
|
jobs:
|
||||||
linux:
|
linux:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-22.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.17
|
go-version: 1.22
|
||||||
- run: DIFF="$( find . -name '*.go' -print0 | xargs -0 gofmt -l )"; if [ -n "$DIFF" ]; then echo "Files not formatted, run gofmt:"; echo "$DIFF"; exit 1; fi
|
- run: DIFF="$( find . -name '*.go' -print0 | xargs -0 gofmt -l )"; if [ -n "$DIFF" ]; then echo "Files not formatted, run gofmt:"; echo "$DIFF"; exit 1; fi
|
||||||
- run: sudo apt-get install libusb-1.0-0-dev
|
- run: sudo apt-get install libusb-1.0-0-dev
|
||||||
- run: go install golang.org/x/tools/cmd/cover@latest
|
- run: go install golang.org/x/tools/cmd/cover@latest
|
||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-go@v2
|
- uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: 1.17
|
go-version: 1.22
|
||||||
- uses: msys2/setup-msys2@v2
|
- uses: msys2/setup-msys2@v2
|
||||||
with:
|
with:
|
||||||
install: |-
|
install: |-
|
||||||
|
@@ -188,7 +188,10 @@ func (libusbImpl) handleEvents(c *libusbContext, done <-chan struct{}) {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
if errno := C.libusb_handle_events_timeout_completed((*C.libusb_context)(c), &tv, nil); errno < 0 {
|
if errno := C.libusb_handle_events_timeout_completed((*C.libusb_context)(c), &tv, nil); errno < 0 {
|
||||||
log.Printf("handle_events: error: %s", Error(errno))
|
// handler can be interrupted by a signal and this doesn't indicate an error, we'll retry on the next loop iteration
|
||||||
|
if Error(errno) != ErrorInterrupted {
|
||||||
|
log.Printf("handle_events: error: %s", Error(errno))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
usb.go
5
usb.go
@@ -16,7 +16,7 @@
|
|||||||
/*
|
/*
|
||||||
Package gousb provides an low-level interface to attached USB devices.
|
Package gousb provides an low-level interface to attached USB devices.
|
||||||
|
|
||||||
A Short Tutorial
|
# A Short Tutorial
|
||||||
|
|
||||||
A Context manages all resources necessary for communicating with USB
|
A Context manages all resources necessary for communicating with USB
|
||||||
devices.
|
devices.
|
||||||
@@ -117,11 +117,10 @@ standard for control commands though, and many devices implement their custom co
|
|||||||
|
|
||||||
Control commands can be issued through Device.Control().
|
Control commands can be issued through Device.Control().
|
||||||
|
|
||||||
See Also
|
# See Also
|
||||||
|
|
||||||
For more information about USB protocol and handling USB devices,
|
For more information about USB protocol and handling USB devices,
|
||||||
see the excellent "USB in a nutshell" guide: http://www.beyondlogic.org/usbnutshell/
|
see the excellent "USB in a nutshell" guide: http://www.beyondlogic.org/usbnutshell/
|
||||||
|
|
||||||
*/
|
*/
|
||||||
package gousb
|
package gousb
|
||||||
|
|
||||||
|
@@ -20,8 +20,9 @@
|
|||||||
// a reader.
|
// a reader.
|
||||||
//
|
//
|
||||||
// The bread and butter of this package are the following two functions:
|
// The bread and butter of this package are the following two functions:
|
||||||
// Describe - Pretty-print the vendor and product of a device descriptor
|
//
|
||||||
// Classify - Pretty-print the class/protocol info for a device/interface
|
// Describe - Pretty-print the vendor and product of a device descriptor
|
||||||
|
// Classify - Pretty-print the class/protocol info for a device/interface
|
||||||
package usbid
|
package usbid
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@@ -20,7 +20,8 @@ import "time"
|
|||||||
// LastUpdate stores the latest time that the library was updated.
|
// LastUpdate stores the latest time that the library was updated.
|
||||||
//
|
//
|
||||||
// The baked-in data was last generated:
|
// The baked-in data was last generated:
|
||||||
// 2017-03-10 09:09:14.940548227 -0500 EST
|
//
|
||||||
|
// 2017-03-10 09:09:14.940548227 -0500 EST
|
||||||
var LastUpdate = time.Unix(0, 1489154954940548227)
|
var LastUpdate = time.Unix(0, 1489154954940548227)
|
||||||
|
|
||||||
const usbIDListData = `#
|
const usbIDListData = `#
|
||||||
|
Reference in New Issue
Block a user