1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-18 08:02:48 +00:00

Update to post 2.0.24 release.

This commit is contained in:
Alex Dupre 2018-10-03 10:58:17 +00:00
parent 8070fa5da7
commit 8c9412983d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=481156
4 changed files with 44 additions and 58 deletions

View File

@ -2,8 +2,9 @@
# $FreeBSD$
PORTNAME= trezord
PORTVERSION= 2.0.23
DISTVERSIONPREFIX= v
DISTVERSION= 2.0.24-5
DISTVERSIONSUFFIX= -gf593bf3
CATEGORIES= security
MAINTAINER= ale@FreeBSD.org
@ -18,14 +19,13 @@ USE_GITHUB= yes
GH_ACCOUNT= trezor
GH_PROJECT= ${PORTNAME}-go
GO_PKGNAME= github.com/${GH_ACCOUNT}/${GH_PROJECT}
GH_TAGNAME= 0e82873
PLIST_FILES= bin/${GH_PROJECT}
.include <bsd.port.pre.mk>
.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1102000
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-usb_webusb.go
EXTRA_PATCHES+= ${FILESDIR}/extra-patch-usb_libusb.go
.endif
.include <bsd.port.post.mk>

View File

@ -1,3 +1,3 @@
TIMESTAMP = 1537790982
SHA256 (trezor-trezord-go-v2.0.23-0e82873_GH0.tar.gz) = 87f359982952429d4f8303966ce750985fb1be484e3ee22ed636594b0dcc4345
SIZE (trezor-trezord-go-v2.0.23-0e82873_GH0.tar.gz) = 954886
TIMESTAMP = 1538563785
SHA256 (trezor-trezord-go-v2.0.24-5-gf593bf3_GH0.tar.gz) = c246624c7456e313e9900fb304fc427608c43352f0c5622adb1be32f97912b81
SIZE (trezor-trezord-go-v2.0.24-5-gf593bf3_GH0.tar.gz) = 955195

View File

@ -0,0 +1,38 @@
--- usb/libusb.go.orig 2018-10-01 19:43:54 UTC
+++ usb/libusb.go
@@ -3,6 +3,7 @@ package usb
import (
"encoding/hex"
"fmt"
+ "runtime"
"strings"
"sync"
"sync/atomic"
@@ -311,13 +312,21 @@ func (b *LibUSB) matchVidPid(vid uint16,
}
func (b *LibUSB) identify(dev lowlevel.Device) string {
- var ports [8]byte
- p, err := lowlevel.Get_Port_Numbers(dev, ports[:])
- if err != nil {
- b.mw.Println(fmt.Sprintf("libusb - identify - error getting port numbers %s", err.Error()))
- return ""
+ var path string
+ if runtime.GOOS != "freebsd" {
+ var ports [8]byte
+ p, err := lowlevel.Get_Port_Numbers(dev, ports[:])
+ if err != nil {
+ b.mw.Println(fmt.Sprintf("webusb - identify - error getting port numbers %s", err.Error()))
+ return ""
+ }
+ path = hex.EncodeToString(p)
+ } else {
+ bn := lowlevel.Get_Bus_Number(dev)
+ da := lowlevel.Get_Device_Address(dev)
+ path = fmt.Sprintf("%02x%02x", bn, da)
}
- return libusbPrefix + hex.EncodeToString(p)
+ return libusbPrefix + path
}
type WUD struct {

View File

@ -1,52 +0,0 @@
--- 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 {
- var ports [8]byte
- p, err := lowlevel.Get_Port_Numbers(dev, ports[:])
- if err != nil {
- b.mw.Println(fmt.Sprintf("webusb - identify - error getting port numbers %s", err.Error()))
- return ""
+ var path string
+ if runtime.GOOS != "freebsd" {
+ var ports [8]byte
+ p, err := lowlevel.Get_Port_Numbers(dev, ports[:])
+ if err != nil {
+ b.mw.Println(fmt.Sprintf("webusb - identify - error getting port numbers %s", err.Error()))
+ return ""
+ }
+ path = hex.EncodeToString(p)
+ } else {
+ bn := lowlevel.Get_Bus_Number(dev)
+ da := lowlevel.Get_Device_Address(dev)
+ path = fmt.Sprintf("%02x%02x", bn, da)
}
- return webusbPrefix + hex.EncodeToString(p)
+ return webusbPrefix + path
}
type WUD struct {
@@ -331,6 +339,12 @@ func (d *WUD) finishReadQueue() {
}
func (d *WUD) readWrite(buf []byte, endpoint uint8) (int, error) {
+ var timeout uint
+ if runtime.GOOS != "freebsd" {
+ timeout = usbTimeout
+ } else {
+ timeout = 0
+ }
d.mw.Println("webusb - rw - start")
for {
d.mw.Println("webusb - rw - checking closed")
@@ -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")
- p, err := lowlevel.Interrupt_Transfer(d.dev, endpoint, buf, usbTimeout)
+ p, err := lowlevel.Interrupt_Transfer(d.dev, endpoint, buf, timeout)
d.transferMutex.Unlock()
d.mw.Println("webusb - rw - single transfer done")