X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2Flibaltos%2Flibaltos.c;h=f2c8bd8d51eec9705b91a7965835660e5f8d0cf2;hp=c5bcf90070682a6f1974300ef916eeef941fc508;hb=313d740b5284b24f1cc7a1ba5779136b55d49ebe;hpb=44fb71ca3e5bccd5f601fc5a2d5da7292050b1d6 diff --git a/altosui/libaltos/libaltos.c b/altosui/libaltos/libaltos.c index c5bcf900..f2c8bd8d 100644 --- a/altosui/libaltos/libaltos.c +++ b/altosui/libaltos/libaltos.c @@ -20,6 +20,22 @@ #include #include +#define USB_VENDOR_FSF 0xfffe +#define USB_VENDOR_ALTUSMETRUM USB_VENDOR_FSF +#define USB_PRODUCT_ALTUSMETRUM 0x000a +#define USB_PRODUCT_TELEMETRUM 0x000b +#define USB_PRODUCT_TELEDONGLE 0x000c +#define USB_PRODUCT_TELETERRA 0x000d +#define USB_PRODUCT_TELEBT 0x000e +#define USB_PRODUCT_ALTUSMETRUM_MIN 0x000a +#define USB_PRODUCT_ALTUSMETRUM_MAX 0x0013 + +#define USB_IS_ALTUSMETRUM(v,p) ((v) == USB_VENDOR_ALTUSMETRUM && \ + (USB_PRODUCT_ALTUSMETRUM_MIN <= (p) && \ + (p) <= USB_PRODUCT_ALTUSMETRUM_MAX)) + +#define BLUETOOTH_PRODUCT_TELEBT "TeleBT" + #define USE_POLL PUBLIC int @@ -543,7 +559,7 @@ altos_list_start(void) if (USB_IS_ALTUSMETRUM(dev->idVendor, dev->idProduct)) { 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; @@ -582,6 +598,7 @@ altos_list_finish(struct altos_list *usbdevs) free(usbdevs); } +#if HAS_BLUETOOTH struct altos_bt_list { inquiry_info *ii; int sock; @@ -698,7 +715,7 @@ altos_bt_open(struct altos_bt_device *device) perror("connect"); goto no_link; } - sleep(2); + sleep(1); #ifdef USE_POLL pipe(file->pipe); @@ -713,6 +730,7 @@ no_sock: no_file: return NULL; } +#endif /* HAS_BLUETOOTH */ #endif