From a221bef9052ddc6e3fd4046ea561e6335a17ffc3 Mon Sep 17 00:00:00 2001 From: Sebastian Zagrodzki Date: Fri, 10 Mar 2017 08:36:00 -0500 Subject: [PATCH] ensure the vid/pid match --- usb/usb_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usb/usb_test.go b/usb/usb_test.go index 5245119..cad8646 100644 --- a/usb/usb_test.go +++ b/usb/usb_test.go @@ -78,6 +78,9 @@ func TestOpenDeviceWithVidPid(t *testing.T) { t.Errorf("OpenDeviceWithVidPid(%s/%s): got error %v, want nil", ID(d.vid), ID(d.pid), err) } if dev != nil { + if dev.Descriptor.Vendor != ID(d.vid) || dev.Descriptor.Product != ID(d.pid) { + t.Errorf("OpenDeviceWithVidPid(%s/%s): the device returned has VID/PID %s/%s, different from specified in the arguments", ID(d.vid), ID(d.pid), dev.Descriptor.Vendor, dev.Descriptor.Product) + } dev.Close() } }