vendor: update github.com/karalabe/hid (#18213)

Fixes #15101 because hidapi is no longer being called from an
init function.
This commit is contained in:
Felix Lange 2018-11-30 10:22:53 +01:00 committed by Péter Szilágyi
parent 7e7781ffaa
commit ef8ced4151
4 changed files with 12 additions and 12 deletions

@ -22,8 +22,8 @@ environment:
install:
- rmdir C:\go /s /q
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.8.windows-%GOARCH%.zip
- 7z x go1.8.windows-%GOARCH%.zip -y -oC:\ > NUL
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.10.1.windows-%GOARCH%.zip
- 7z x go1.10.1.windows-%GOARCH%.zip -y -oC:\ > NUL
- go version
- gcc --version

@ -36,7 +36,7 @@ func (info DeviceInfo) Open() (*Device, error) {
// Close releases the HID USB device handle. On platforms that this file implements
// the method is just a noop.
func (dev *Device) Close() {}
func (dev *Device) Close() error { return nil }
// Write sends an output report to a HID device. On platforms that this file
// implements the method just returns an error.

@ -41,6 +41,7 @@ package hid
#endif
*/
import "C"
import (
"errors"
"runtime"
@ -57,11 +58,6 @@ import (
// > "subsequent calls will cause the hid manager to release previously enumerated devices"
var enumerateLock sync.Mutex
func init() {
// Initialize the HIDAPI library
C.hid_init()
}
// Supported returns whether this platform is supported by the HID library or not.
// The goal of this method is to allow programatically handling platforms that do
// not support USB HID and not having to fall back to build constraints.
@ -113,6 +109,9 @@ func Enumerate(vendorID uint16, productID uint16) []DeviceInfo {
// Open connects to an HID device by its path name.
func (info DeviceInfo) Open() (*Device, error) {
enumerateLock.Lock()
defer enumerateLock.Unlock()
path := C.CString(info.Path)
defer C.free(unsafe.Pointer(path))
@ -135,7 +134,7 @@ type Device struct {
}
// Close releases the HID USB device handle.
func (dev *Device) Close() {
func (dev *Device) Close() error {
dev.lock.Lock()
defer dev.lock.Unlock()
@ -143,6 +142,7 @@ func (dev *Device) Close() {
C.hid_close(dev.device)
dev.device = nil
}
return nil
}
// Write sends an output report to a HID device.

6
vendor/vendor.json vendored

@ -267,10 +267,10 @@
"revisionTime": "2017-04-30T22:20:11Z"
},
{
"checksumSHA1": "UpjhOUZ1+0zNt+iIvdtECSHXmTs=",
"checksumSHA1": "6XsjAARQFvlW6dS15al0ibTFPOQ=",
"path": "github.com/karalabe/hid",
"revision": "f00545f9f3748e591590be3732d913c77525b10f",
"revisionTime": "2017-08-21T10:38:37Z",
"revision": "d815e0c1a2e2082a287a2806bc90bc8fc7b276a9",
"revisionTime": "2018-11-28T19:21:57Z",
"tree": true
},
{