From owner-svn-ports-all@freebsd.org Tue Aug 28 08:39:39 2018 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3655C1084667; Tue, 28 Aug 2018 08:39:39 +0000 (UTC) (envelope-from ale@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3D9779B85; Tue, 28 Aug 2018 08:39:38 +0000 (UTC) (envelope-from ale@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 976442349; Tue, 28 Aug 2018 08:39:38 +0000 (UTC) (envelope-from ale@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w7S8dcCH090897; Tue, 28 Aug 2018 08:39:38 GMT (envelope-from ale@FreeBSD.org) Received: (from ale@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7S8dblW090894; Tue, 28 Aug 2018 08:39:37 GMT (envelope-from ale@FreeBSD.org) Message-Id: <201808280839.w7S8dblW090894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ale set sender to ale@FreeBSD.org using -f From: Alex Dupre Date: Tue, 28 Aug 2018 08:39:37 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r478292 - in head/security/trezord: . files X-SVN-Group: ports-head X-SVN-Commit-Author: ale X-SVN-Commit-Paths: in head/security/trezord: . files X-SVN-Commit-Revision: 478292 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2018 08:39:39 -0000 Author: ale Date: Tue Aug 28 08:39:37 2018 New Revision: 478292 URL: https://svnweb.freebsd.org/changeset/ports/478292 Log: Update to 2.0.21 release. Added: head/security/trezord/files/extra-patch-usb_webusb.go (contents, props changed) Modified: head/security/trezord/Makefile head/security/trezord/distinfo head/security/trezord/files/patch-freebsd Modified: head/security/trezord/Makefile ============================================================================== --- head/security/trezord/Makefile Tue Aug 28 08:15:05 2018 (r478291) +++ head/security/trezord/Makefile Tue Aug 28 08:39:37 2018 (r478292) @@ -2,7 +2,7 @@ # $FreeBSD$ PORTNAME= trezord -PORTVERSION= 2.0.20 +PORTVERSION= 2.0.21 DISTVERSIONPREFIX= v CATEGORIES= security @@ -23,4 +23,10 @@ PATCH_STRIP= -p1 PLIST_FILES= bin/${GH_PROJECT} -.include +.include + +.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1102000 +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-usb_webusb.go +.endif + +.include Modified: head/security/trezord/distinfo ============================================================================== --- head/security/trezord/distinfo Tue Aug 28 08:15:05 2018 (r478291) +++ head/security/trezord/distinfo Tue Aug 28 08:39:37 2018 (r478292) @@ -1,3 +1,3 @@ -TIMESTAMP = 1532522034 -SHA256 (trezor-trezord-go-v2.0.20_GH0.tar.gz) = ec1a033c828e6c657a36645c5a1feaff14e6f8bf74d5cba6feed00295716fe1c -SIZE (trezor-trezord-go-v2.0.20_GH0.tar.gz) = 953083 +TIMESTAMP = 1535444563 +SHA256 (trezor-trezord-go-v2.0.21_GH0.tar.gz) = e8987e2f998555d354297d0c00a79f0f3eb8343cff8e96241646638d7350f52a +SIZE (trezor-trezord-go-v2.0.21_GH0.tar.gz) = 953365 Added: head/security/trezord/files/extra-patch-usb_webusb.go ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/security/trezord/files/extra-patch-usb_webusb.go Tue Aug 28 08:39:37 2018 (r478292) @@ -0,0 +1,54 @@ +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 { + } + + 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 { +@@ -279,6 +293,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") +@@ -291,7 +311,7 @@ func (d *WUD) readWrite(buf []byte, endpoint uint8) (int, error) { + 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") + Modified: head/security/trezord/files/patch-freebsd ============================================================================== --- head/security/trezord/files/patch-freebsd Tue Aug 28 08:15:05 2018 (r478291) +++ head/security/trezord/files/patch-freebsd Tue Aug 28 08:39:37 2018 (r478292) @@ -161,7 +161,7 @@ index a85a143..8448510 100644 package lowlevel diff --git a/usb/webusb.go b/usb/webusb.go -index eb8cadd..ff42885 100644 +index eb8cadd..1366074 100644 --- a/usb/webusb.go +++ b/usb/webusb.go @@ -3,6 +3,7 @@ package usb @@ -172,60 +172,21 @@ index eb8cadd..ff42885 100644 "strings" "sync" "sync/atomic" -@@ -216,7 +217,7 @@ func (b *WebUSB) match(dev lowlevel.Device) bool { +@@ -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 && +- return (c.BNumInterfaces > webIfaceNum && +- c.Interface[webIfaceNum].Num_altsetting > webAltSetting && - c.Interface[webIfaceNum].Altsetting[webAltSetting].BInterfaceClass == lowlevel.CLASS_VENDOR_SPEC) -+ (c.Interface[webIfaceNum].Altsetting[webAltSetting].BInterfaceClass == lowlevel.CLASS_VENDOR_SPEC || runtime.GOOS == "freebsd")) - } - - func (b *WebUSB) matchVidPid(vid uint16, pid uint16) bool { -@@ -226,13 +227,19 @@ func (b *WebUSB) matchVidPid(vid uint16, pid uint16) bool { - } - - 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 "" + 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 "" -+ } -+ return webusbPrefix + hex.EncodeToString(p) ++ return (c.BNumInterfaces > webIfaceNum && ++ c.Interface[webIfaceNum].Num_altsetting > webAltSetting && ++ c.Interface[webIfaceNum].Altsetting[webAltSetting].BInterfaceClass == lowlevel.CLASS_VENDOR_SPEC) + } else { -+ bn := lowlevel.Get_Bus_Number(dev) -+ da := lowlevel.Get_Device_Address(dev) -+ return fmt.Sprintf("%s%02x%02x", webusbPrefix, bn, da) - } -- return webusbPrefix + hex.EncodeToString(p) ++ return (c.BNumInterfaces > webIfaceNum && ++ c.Interface[webIfaceNum].Num_altsetting > webAltSetting) ++ } } - type WUD struct { -@@ -279,6 +286,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") -@@ -291,7 +304,7 @@ func (d *WUD) readWrite(buf []byte, endpoint uint8) (int, error) { - 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") - + func (b *WebUSB) matchVidPid(vid uint16, pid uint16) bool {