aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2019-06-06 17:50:03 +0800
committerGitHub <noreply@github.com>2019-06-06 17:50:03 +0800
commitf01f3f266c7761e6bc4936d2e1c4e5972acac596 (patch)
treeeffaed5c50269743e9d76be95ed43fd5be367121
parent2823ce0086736e01cdb7b715d567d5ada445e3e4 (diff)
parentc52390d0780163c5633fc768130b66965412a558 (diff)
downloadgo-tangerine-f01f3f266c7761e6bc4936d2e1c4e5972acac596.tar
go-tangerine-f01f3f266c7761e6bc4936d2e1c4e5972acac596.tar.gz
go-tangerine-f01f3f266c7761e6bc4936d2e1c4e5972acac596.tar.bz2
go-tangerine-f01f3f266c7761e6bc4936d2e1c4e5972acac596.tar.lz
go-tangerine-f01f3f266c7761e6bc4936d2e1c4e5972acac596.tar.xz
go-tangerine-f01f3f266c7761e6bc4936d2e1c4e5972acac596.tar.zst
go-tangerine-f01f3f266c7761e6bc4936d2e1c4e5972acac596.zip
Merge pull request #19674 from karalabe/usb-ios-fixup
vendor: pull fixed usb library for nocgo builds
-rw-r--r--vendor/github.com/karalabe/usb/AUTHORS1
-rw-r--r--vendor/github.com/karalabe/usb/appveyor.yml3
-rw-r--r--vendor/github.com/karalabe/usb/hidapi/hidapi/hidapi.h3
-rw-r--r--vendor/github.com/karalabe/usb/hidapi/windows/hid.c38
-rw-r--r--vendor/github.com/karalabe/usb/usb_disabled.go8
-rw-r--r--vendor/vendor.json6
6 files changed, 31 insertions, 28 deletions
diff --git a/vendor/github.com/karalabe/usb/AUTHORS b/vendor/github.com/karalabe/usb/AUTHORS
index 4112a92f3..bae45b3ec 100644
--- a/vendor/github.com/karalabe/usb/AUTHORS
+++ b/vendor/github.com/karalabe/usb/AUTHORS
@@ -1,6 +1,7 @@
Felix Lange <fjl@twurst.com>
Guillaume Ballet <gballet@gmail.com>
Jakob Weisblat <jakobw@yubico.com>
+Martin Holst Swende <martin@swende.se>
Mateusz Mikołajczyk <mikolajczyk.mateusz@gmail.com>
Péter Szilágyi <peterke@gmail.com>
Rosen Penev <rosenp@gmail.com>
diff --git a/vendor/github.com/karalabe/usb/appveyor.yml b/vendor/github.com/karalabe/usb/appveyor.yml
index 8d2d3da55..1f94b3733 100644
--- a/vendor/github.com/karalabe/usb/appveyor.yml
+++ b/vendor/github.com/karalabe/usb/appveyor.yml
@@ -30,3 +30,6 @@ install:
build_script:
- go install ./...
- go test -v ./...
+ - set CGO_ENABLED=0
+ - go install ./...
+ - go test -v ./...
diff --git a/vendor/github.com/karalabe/usb/hidapi/hidapi/hidapi.h b/vendor/github.com/karalabe/usb/hidapi/hidapi/hidapi.h
index e5bc2dc40..166f3509a 100644
--- a/vendor/github.com/karalabe/usb/hidapi/hidapi/hidapi.h
+++ b/vendor/github.com/karalabe/usb/hidapi/hidapi/hidapi.h
@@ -87,7 +87,7 @@ extern "C" {
needed. This function should be called at the beginning of
execution however, if there is a chance of HIDAPI handles
being opened by different threads simultaneously.
-
+
@ingroup API
@returns
@@ -388,4 +388,3 @@ extern "C" {
#endif
#endif
-
diff --git a/vendor/github.com/karalabe/usb/hidapi/windows/hid.c b/vendor/github.com/karalabe/usb/hidapi/windows/hid.c
index 86810d7e5..4e92cc8bc 100644
--- a/vendor/github.com/karalabe/usb/hidapi/windows/hid.c
+++ b/vendor/github.com/karalabe/usb/hidapi/windows/hid.c
@@ -8,7 +8,7 @@
8/22/2009
Copyright 2009, All Rights Reserved.
-
+
At the discretion of the user of this library,
this software may be licensed under the terms of the
GNU General Public License v3, a BSD-Style license, or the
@@ -181,7 +181,7 @@ static void register_error(hid_device *device, const char *op)
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPVOID)&msg, 0/*sz*/,
NULL);
-
+
/* Get rid of the CR and LF that FormatMessage() sticks at the
end of the message. Thanks Microsoft! */
ptr = msg;
@@ -292,9 +292,9 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
/* Get information for all the devices belonging to the HID class. */
device_info_set = SetupDiGetClassDevsA(&InterfaceClassGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
-
+
/* Iterate over each device in the HID class, looking for the right one. */
-
+
for (;;) {
HANDLE write_handle = INVALID_HANDLE_VALUE;
DWORD required_size = 0;
@@ -305,7 +305,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
&InterfaceClassGuid,
device_index,
&device_interface_data);
-
+
if (!res) {
/* A return of FALSE from this function means that
there are no more devices. */
@@ -377,7 +377,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
/* Unable to open the device. */
//register_error(dev, "CreateFile");
goto cont_close;
- }
+ }
/* Get the Vendor ID and Product ID for this device. */
@@ -421,14 +421,14 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
HidD_FreePreparsedData(pp_data);
}
-
+
/* Fill out the record */
cur_dev->next = NULL;
str = device_interface_detail_data->DevicePath;
if (str) {
len = strlen(str);
cur_dev->path = (char*) calloc(len+1, sizeof(char));
- strncpy(cur_dev->path, str, len+1);
+ strncpy(cur_dev->path, str, sizeof(cur_dev->path));
cur_dev->path[len] = '\0';
}
else
@@ -521,7 +521,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsi
struct hid_device_info *devs, *cur_dev;
const char *path_to_open = NULL;
hid_device *handle = NULL;
-
+
devs = hid_enumerate(vendor_id, product_id);
cur_dev = devs;
while (cur_dev) {
@@ -547,7 +547,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsi
}
hid_free_enumeration(devs);
-
+
return handle;
}
@@ -590,7 +590,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path)
}
nt_res = HidP_GetCaps(pp_data, &caps);
if (nt_res != HIDP_STATUS_SUCCESS) {
- register_error(dev, "HidP_GetCaps");
+ register_error(dev, "HidP_GetCaps");
goto err_pp_data;
}
dev->output_report_length = caps.OutputReportByteLength;
@@ -603,7 +603,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path)
err_pp_data:
HidD_FreePreparsedData(pp_data);
-err:
+err:
free_hid_device(dev);
return NULL;
}
@@ -636,7 +636,7 @@ int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *
}
res = WriteFile(dev->device_handle, buf, length, NULL, &ol);
-
+
if (!res) {
if (GetLastError() != ERROR_IO_PENDING) {
/* WriteFile() failed. Return error. */
@@ -679,7 +679,7 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
memset(dev->read_buf, 0, dev->input_report_length);
ResetEvent(ev);
res = ReadFile(dev->device_handle, dev->read_buf, dev->input_report_length, &bytes_read, &dev->ol);
-
+
if (!res) {
if (GetLastError() != ERROR_IO_PENDING) {
/* ReadFile() has failed.
@@ -705,7 +705,7 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
we are in non-blocking mode. Get the number of bytes read. The actual
data has been copied to the data[] array which was passed to ReadFile(). */
res = GetOverlappedResult(dev->device_handle, &dev->ol, &bytes_read, TRUE/*wait*/);
-
+
/* Set pending back to false, even if GetOverlappedResult() returned error. */
dev->read_pending = FALSE;
@@ -725,13 +725,13 @@ int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char
memcpy(data, dev->read_buf, copy_len);
}
}
-
+
end_of_function:
if (!res) {
register_error(dev, "GetOverlappedResult");
return -1;
}
-
+
return copy_len;
}
@@ -876,7 +876,7 @@ HID_API_EXPORT const wchar_t * HID_API_CALL hid_error(hid_device *dev)
/*#define PICPGM*/
/*#define S11*/
#define P32
-#ifdef S11
+#ifdef S11
unsigned short VendorID = 0xa0a0;
unsigned short ProductID = 0x0001;
#endif
@@ -906,7 +906,7 @@ int __cdecl main(int argc, char* argv[])
memset(buf,0x00,sizeof(buf));
buf[0] = 0;
buf[1] = 0x81;
-
+
/* Open the device. */
int handle = open(VendorID, ProductID, L"12345");
diff --git a/vendor/github.com/karalabe/usb/usb_disabled.go b/vendor/github.com/karalabe/usb/usb_disabled.go
index 39259856e..f7f42a4cf 100644
--- a/vendor/github.com/karalabe/usb/usb_disabled.go
+++ b/vendor/github.com/karalabe/usb/usb_disabled.go
@@ -27,20 +27,20 @@ func Supported() bool {
// Enumerate returns a list of all the USB devices attached to the system which
// match the vendor and product id. On platforms that this file implements the
// function is a noop and returns an empty list always.
-func Enumerate(vendorID uint16, productID uint16) []DeviceInfo {
- return nil
+func Enumerate(vendorID uint16, productID uint16) ([]DeviceInfo, error) {
+ return nil, nil
}
// EnumerateRaw returns a list of all the USB devices attached to the system which
// match the vendor and product id. On platforms that this file implements the
// function is a noop and returns an empty list always.
func EnumerateRaw(vendorID uint16, productID uint16) ([]DeviceInfo, error) {
- return nil
+ return nil, nil
}
// EnumerateHid returns a list of all the HID devices attached to the system which
// match the vendor and product id. On platforms that this file implements the
// function is a noop and returns an empty list always.
func EnumerateHid(vendorID uint16, productID uint16) ([]DeviceInfo, error) {
- return nil
+ return nil, nil
}
diff --git a/vendor/vendor.json b/vendor/vendor.json
index 6e1624306..946508a33 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -267,10 +267,10 @@
"revisionTime": "2017-04-30T22:20:11Z"
},
{
- "checksumSHA1": "3v8Z4/daUVp9PCcFzEGYVkPadG8=",
+ "checksumSHA1": "0ixnoiChdbeva2xNe3z/vYzqcL4=",
"path": "github.com/karalabe/usb",
- "revision": "c012609e094b8a96375fee53cc11f1bcd5cf3aa2",
- "revisionTime": "2019-06-04T10:57:36Z",
+ "revision": "0efdeddd92369dc00d4fb1b9cd56a442bdb61f82",
+ "revisionTime": "2019-06-06T09:23:27Z",
"tree": true
},
{