diff options
author | ale <ale@FreeBSD.org> | 2018-09-24 20:15:09 +0800 |
---|---|---|
committer | ale <ale@FreeBSD.org> | 2018-09-24 20:15:09 +0800 |
commit | b5e00f8305c58077141e6a3cb401a416646db2dd (patch) | |
tree | beb22750a091788cfa88b32e6632ecd5e2785891 /security/trezord/files | |
parent | 25abc905c9c98db6a95df77e777c425205b99a36 (diff) | |
download | freebsd-ports-gnome-b5e00f8305c58077141e6a3cb401a416646db2dd.tar.gz freebsd-ports-gnome-b5e00f8305c58077141e6a3cb401a416646db2dd.tar.zst freebsd-ports-gnome-b5e00f8305c58077141e6a3cb401a416646db2dd.zip |
Update to 2.0.23 release.
Diffstat (limited to 'security/trezord/files')
-rw-r--r-- | security/trezord/files/extra-patch-usb_webusb.go | 12 | ||||
-rw-r--r-- | security/trezord/files/patch-freebsd | 192 |
2 files changed, 5 insertions, 199 deletions
diff --git a/security/trezord/files/extra-patch-usb_webusb.go b/security/trezord/files/extra-patch-usb_webusb.go index d934907da9f5..ac3f2ae34e10 100644 --- a/security/trezord/files/extra-patch-usb_webusb.go +++ b/security/trezord/files/extra-patch-usb_webusb.go @@ -1,8 +1,6 @@ -diff --git a/usb/webusb.go b/usb/webusb.go -index eb8cadd..1366074 100644 ---- a/usb/webusb.go -+++ b/usb/webusb.go -@@ -226,13 +232,21 @@ func (b *WebUSB) matchVidPid(vid uint16, pid uint16) bool { +--- usb/webusb.go.orig 2018-09-21 13:31:27 UTC ++++ usb/webusb.go +@@ -274,13 +274,21 @@ func (b *WebUSB) matchVidPid(vid uint16, } func (b *WebUSB) identify(dev lowlevel.Device) string { @@ -30,7 +28,7 @@ index eb8cadd..1366074 100644 } type WUD struct { -@@ -279,6 +293,12 @@ func (d *WUD) finishReadQueue() { +@@ -331,6 +339,12 @@ func (d *WUD) finishReadQueue() { } func (d *WUD) readWrite(buf []byte, endpoint uint8) (int, error) { @@ -43,7 +41,7 @@ index eb8cadd..1366074 100644 d.mw.Println("webusb - rw - start") for { d.mw.Println("webusb - rw - checking closed") -@@ -291,7 +311,7 @@ func (d *WUD) readWrite(buf []byte, endpoint uint8) (int, error) { +@@ -343,7 +357,7 @@ func (d *WUD) readWrite(buf []byte, endp d.mw.Println("webusb - rw - lock transfer mutex") d.transferMutex.Lock() d.mw.Println("webusb - rw - actual interrupt transport") diff --git a/security/trezord/files/patch-freebsd b/security/trezord/files/patch-freebsd deleted file mode 100644 index 3b4ed3420101..000000000000 --- a/security/trezord/files/patch-freebsd +++ /dev/null @@ -1,192 +0,0 @@ -diff --git a/trezord.go b/trezord.go -index 91fb4b9..f8c545e 100644 ---- a/trezord.go -+++ b/trezord.go -@@ -6,6 +6,7 @@ import ( - "io" - "log" - "os" -+ "runtime" - "strconv" - - "github.com/trezor/trezord-go/core" -@@ -83,7 +84,11 @@ func main() { - if err != nil { - stderrLogger.Fatalf("hidapi: %s", err) - } -- bus = append(bus, w, h) -+ if runtime.GOOS != "freebsd" { -+ bus = append(bus, w, h) -+ } else { -+ bus = append(bus, w) -+ } - } - - longMemoryWriter.Println(fmt.Sprintf("UDP port count - %d", len(ports))) -diff --git a/usb/lowlevel/hid.go b/usb/lowlevel/hid.go -index 32ad167..c847c73 100644 ---- a/usb/lowlevel/hid.go -+++ b/usb/lowlevel/hid.go -@@ -6,7 +6,7 @@ - - // Package hid provides an interface for USB HID devices. - --// +build linux,cgo darwin,!ios,cgo windows,cgo -+// +build linux,cgo freebsd,cgo darwin,!ios,cgo windows,cgo - - package lowlevel - -@@ -21,6 +21,8 @@ extern void goLog(const char *s); - - #cgo linux CFLAGS: -DDEFAULT_VISIBILITY="" -DOS_LINUX -D_GNU_SOURCE -DPOLL_NFDS_TYPE=int - #cgo linux,!android LDFLAGS: -lrt -+#cgo freebsd CFLAGS: -DOS_FREEBSD -+#cgo freebsd LDFLAGS: -lusb - #cgo darwin CFLAGS: -DOS_DARWIN -DDEFAULT_VISIBILITY="" -DPOLL_NFDS_TYPE="unsigned int" - #cgo darwin LDFLAGS: -framework CoreFoundation -framework IOKit -lobjc - #cgo windows CFLAGS: -DOS_WINDOWS -DDEFAULT_VISIBILITY="" -DPOLL_NFDS_TYPE="unsigned int" -@@ -34,6 +36,8 @@ extern void goLog(const char *s); - #include "os/poll_posix.c" - #include "os/linux_usbfs.c" - #include "os/linux_netlink.c" -+#elif OS_FREEBSD -+ #include <stdlib.h> - #elif OS_DARWIN - #include <sys/poll.h> - -@@ -50,15 +54,21 @@ extern void goLog(const char *s); - #include "os/threads_windows.c" - #endif - --#include "core.c" --#include "descriptor.c" --#include "hotplug.c" --#include "io.c" --#include "strerror.c" --#include "sync.c" -+#ifndef OS_FREEBSD -+ #include "core.c" -+ #include "descriptor.c" -+ #include "hotplug.c" -+ #include "io.c" -+ #include "strerror.c" -+ #include "sync.c" -+#else -+ #include <libusb.h> -+#endif - - #ifdef OS_LINUX - #include "linux/hid.c" -+#elif OS_FREEBSD -+ #include "linux/hid.c" - #elif OS_DARWIN - #include "mac/hid.c" - #elif OS_WINDOWS -diff --git a/usb/lowlevel/libusb.go b/usb/lowlevel/libusb.go -index 454c95c..acda2c6 100644 ---- a/usb/lowlevel/libusb.go -+++ b/usb/lowlevel/libusb.go -@@ -1,4 +1,4 @@ --// +build linux,cgo darwin,!ios,cgo windows,cgo -+// +build linux,cgo freebsd,cgo darwin,!ios,cgo windows,cgo - - //----------------------------------------------------------------------------- - /* -@@ -14,7 +14,13 @@ Copyright (c) 2017 Jason T. Harris - package lowlevel - - /* -+#cgo freebsd LDFLAGS: -lusb -+ -+#ifndef __FreeBSD__ - #include "./c/libusb/libusb.h" -+#else -+#include <libusb.h> -+#endif - - // When a C struct ends with a zero-sized field, but the struct itself is not zero-sized, - // Go code can no longer refer to the zero-sized field. Any such references will have to be rewritten. -@@ -921,9 +927,11 @@ func Get_Port_Numbers(dev Device, ports []byte) ([]byte, error) { - return ports[:rc], nil - } - -+/* - func Get_Parent(dev Device) Device { - return C.libusb_get_parent(dev) - } -+*/ - - func Get_Device_Address(dev Device) uint8 { - return uint8(C.libusb_get_device_address(dev)) -@@ -1066,10 +1074,12 @@ func Set_Auto_Detach_Kernel_Driver(hdl Device_Handle, enable bool) error { - //----------------------------------------------------------------------------- - // Miscellaneous - -+/* - func Has_Capability(capability uint32) bool { - rc := int(C.libusb_has_capability((C.uint32_t)(capability))) - return rc != 0 - } -+*/ - - func Error_Name(code int) string { - return C.GoString(C.libusb_error_name(C.int(code))) -@@ -1084,6 +1094,7 @@ func CPU_To_LE16(x uint16) uint16 { - return uint16(C.libusb_cpu_to_le16((C.uint16_t)(x))) - } - -+/* - func Setlocale(locale string) error { - cstr := C.CString(locale) - rc := int(C.libusb_setlocale(cstr)) -@@ -1092,6 +1103,7 @@ func Setlocale(locale string) error { - } - return nil - } -+*/ - - func Strerror(errcode int) string { - return C.GoString(C.libusb_strerror(int32(errcode))) -diff --git a/usb/lowlevel/wchar.go b/usb/lowlevel/wchar.go -index a85a143..8448510 100644 ---- a/usb/lowlevel/wchar.go -+++ b/usb/lowlevel/wchar.go -@@ -7,7 +7,7 @@ - // https://github.com/orofarne/gowchar/blob/master/LICENSE - - // +build !ios --// +build linux darwin windows -+// +build linux freebsd darwin windows - - package lowlevel - -diff --git a/usb/webusb.go b/usb/webusb.go -index eb8cadd..1366074 100644 ---- a/usb/webusb.go -+++ b/usb/webusb.go -@@ -3,6 +3,7 @@ package usb - import ( - "encoding/hex" - "fmt" -+ "runtime" - "strings" - "sync" - "sync/atomic" -@@ -214,9 +215,14 @@ func (b *WebUSB) match(dev lowlevel.Device) bool { - b.mw.Println("webusb - match - error getting config descriptor " + err.Error()) - return false - } -- return (c.BNumInterfaces > webIfaceNum && -- c.Interface[webIfaceNum].Num_altsetting > webAltSetting && -- c.Interface[webIfaceNum].Altsetting[webAltSetting].BInterfaceClass == lowlevel.CLASS_VENDOR_SPEC) -+ if runtime.GOOS != "freebsd" { -+ return (c.BNumInterfaces > webIfaceNum && -+ c.Interface[webIfaceNum].Num_altsetting > webAltSetting && -+ c.Interface[webIfaceNum].Altsetting[webAltSetting].BInterfaceClass == lowlevel.CLASS_VENDOR_SPEC) -+ } else { -+ return (c.BNumInterfaces > webIfaceNum && -+ c.Interface[webIfaceNum].Num_altsetting > webAltSetting) -+ } - } - - func (b *WebUSB) matchVidPid(vid uint16, pid uint16) bool { |