Seems like my hardware has issues, which turned up a bug in the usb device
scanner, Here's the -l 4 output:

sigrok-cli --scan -d hantek-6xxx -l 4
sr: [00:00.000001] log: libsigrok loglevel set to 4.
sr: [00:00.000021] backend: libsigrok 0.5.0-git-4386875/3:0:0 (rt:
0.5.0-git-4386875/3:0:0).
sr: [00:00.000034] backend: Libs: glib 2.46.2 (rt: 2.46.2/4602:2), libzip
1.1.2, libserialport 0.1.1/1:0:1 (rt: 0.1.1/1:0:1), libusb-1.0 , libftdi
1.1.
sr: [00:00.000042] backend: Host: amd64-unknown-freebsd10.3, little-endian.
sr: [00:00.000048] backend: SCPI backends: TCP, RPC, serial, USBTMC.
sr: [00:00.000336] hantek-6xxx: Found a (null) (null).
sr: [00:00.000347] ezusb: uploading firmware to device on 1.1
sr: [00:00.000376] ezusb: failed to detach kernel driver: LIBUSB_ERROR_OTHER
sr: [00:00.000380] hantek-6xxx: Firmware upload failed.

"Found a (nul) (null)"? Seems like it's checking against the terminal value
of ALL_ZERO, and finding this:

ugen1.1: <XHCI root HUB 0x1b21> at usbus1, cfg=0 md=HOST spd=SUPER
(5.0Gbps) pwr=SAVE (0mA)

  bLength = 0x0012
  bDescriptorType = 0x0001
  bcdUSB = 0x0300
  bDeviceClass = 0x0009  <HUB>
  bDeviceSubClass = 0x0000
  bDeviceProtocol = 0x0003
  bMaxPacketSize0 = 0x0009
  idVendor = 0x0000
  idProduct = 0x0000
  bcdDevice = 0x0100
  iManufacturer = 0x0001  <0x1b21>
  iProduct = 0x0002  <XHCI root HUB>
  iSerialNumber = 0x0000  <no string>
  bNumConfigurations = 0x0001

Actually, it finds all four hubs in my desktop. Arguably, they shouldn't
have zero vendor/device id's, but it's still pretty clear that the driver
shouldn't be scanning them.

The relevant code in hantek-6xxx/api.c is:

static const struct hantek_6xxx_profile dev_profiles[] = {
{
0x04b4, 0x6022, 0x04b5, 0x6022,
"Hantek", "6022BE", "hantek-6022be.fw",
},
{
0x8102, 0x8102, 0x1D50, 0x608E,
"Sainsmart", "DDS120", "sainsmart-dds120.fw",
},
ALL_ZERO
};


and

for (j = 0; dev_profiles[j].orig_vid; j++) {

Using a flag value and testing by array size is a code smell. Either
deleting the flag value so the array has the right size, or the test shold
just be for dev_profiles[j].orig_vid (as done in hantek_dso/api.c).

I did the latter, and sure enough it quit finding those oscilloscopes.

Doesn't prevent me from wishing they had been real!
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to