summaryrefslogtreecommitdiff
path: root/ao-tools/lib/cc-usbdev.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-04-22 17:20:51 -0500
committerKeith Packard <keithp@keithp.com>2013-04-22 17:20:51 -0500
commit33c3b2c57d0d4285b75d4dcf7ca67ad19da08c86 (patch)
treea9ff47afab29fe141dcd1da0ca276b367f911cb6 /ao-tools/lib/cc-usbdev.c
parent1a84db819a359be39be51c9105039ab28c9fc894 (diff)
parent90b0db1ae53182c94bf12d661446fc369d916366 (diff)
Merge branch 'master' into stm-flash
Conflicts: ao-tools/ao-stmload/ao-stmload.c
Diffstat (limited to 'ao-tools/lib/cc-usbdev.c')
-rw-r--r--ao-tools/lib/cc-usbdev.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/ao-tools/lib/cc-usbdev.c b/ao-tools/lib/cc-usbdev.c
index a19e231c..95bfa244 100644
--- a/ao-tools/lib/cc-usbdev.c
+++ b/ao-tools/lib/cc-usbdev.c
@@ -132,13 +132,25 @@ usb_tty(char *sys)
/* Check for tty/ttyACMx style names
*/
tty_dir = cc_fullname(endpoint_full, "tty");
- free(endpoint_full);
ntty = scandir(tty_dir, &namelist,
dir_filter_tty,
alphasort);
free (tty_dir);
if (ntty > 0) {
tty = cc_fullname("/dev", namelist[0]->d_name);
+ free(endpoint_full);
+ free(namelist);
+ return tty;
+ }
+
+ /* Check for ttyACMx style names
+ */
+ ntty = scandir(endpoint_full, &namelist,
+ dir_filter_tty,
+ alphasort);
+ free(endpoint_full);
+ if (ntty > 0) {
+ tty = cc_fullname("/dev", namelist[0]->d_name);
free(namelist);
return tty;
}
@@ -197,6 +209,15 @@ dir_filter_dev(const struct dirent *d)
return 1;
}
+static int
+is_am(int idVendor, int idProduct) {
+ if (idVendor == 0xfffe)
+ return 1;
+ if (idVendor == 0x0403 && idProduct == 0x6015)
+ return 1;
+ return 0;
+}
+
struct cc_usbdevs *
cc_usbdevs_scan(void)
{
@@ -220,7 +241,7 @@ cc_usbdevs_scan(void)
dir = cc_fullname(USB_DEVICES, ents[e]->d_name);
dev = usb_scan_device(dir);
free(dir);
- if (dev->idVendor == 0xfffe && dev->tty) {
+ if (is_am(dev->idVendor, dev->idProduct) && dev->tty) {
if (devs->dev)
devs->dev = realloc(devs->dev,
(devs->ndev + 1) * sizeof (struct usbdev *));