uni-t-ut32x: don't provide a default conn= spec in the driver source

This undoes the essence of commit bf700f679a, which introduced the
default conn= spec. Which improved usability: Users just select the
device and need not specify the connection. But also resulted in the
UT32x thermometer driver's probe to "succeed" as soon as the WCH CH9325
chip was found, no data check was involved in the scan. Unfortunately
this chip is also used in the popular UT-D04 cable, and thus there were
many false positives.
This commit is contained in:
Gerhard Sittig 2019-06-09 18:28:48 +02:00
parent 97c8fa70da
commit a89884c16c
1 changed files with 9 additions and 1 deletions

View File

@ -65,7 +65,13 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
struct dev_context *devc;
size_t i;
conn = "hid/ch9325";
/*
* Implementor's note: Do _not_ add a default conn value here,
* always expect users to specify the connection. Otherwise the
* UT32x driver's scan routine results in false positives, will
* match _any_ UT-D04 cable which uses the same USB HID chip.
*/
conn = NULL;
serialcomm = "2400/8n1";
for (l = options; l; l = l->next) {
src = l->data;
@ -78,6 +84,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
break;
}
}
if (!conn)
return NULL;
devices = NULL;
serial = sr_serial_dev_inst_new(conn, serialcomm);