/* 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 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)
{
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 *));
+ (devs->ndev + 1) * sizeof (struct usbdev *));
else
devs->dev = malloc (sizeof (struct usbdev *));
devs->dev[devs->ndev++] = dev;
return NULL;
for (i = 0; i < devs->ndev; i++) {
dev = devs->dev[i];
- if (product && strcmp (product, dev->product) != 0)
+ if (product && strncmp (product, dev->product, strlen(product)) != 0)
continue;
if (serial && serial != dev->serial)
continue;