X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=libaltos%2Flibaltos_common.c;h=a2f257358ab973b11dca67e01fdc1413b6e90842;hb=8d53868e67b51d8908e55c6a2e7a3b687529957d;hp=713a775c6f70c9acee6011705b5aa6256cd06bc2;hpb=ee79a205e118ea8730a02cc327d8fb79cc5f74ff;p=fw%2Faltos diff --git a/libaltos/libaltos_common.c b/libaltos/libaltos_common.c index 713a775c..a2f25735 100644 --- a/libaltos/libaltos_common.c +++ b/libaltos/libaltos_common.c @@ -49,12 +49,17 @@ PUBLIC int altos_getchar(struct altos_file *file, int timeout) { int ret; + + file->busy = 1; while (file->in_read == file->in_used) { ret = altos_fill(file, timeout); if (ret) - return ret; + goto done; } - return file->in_data[file->in_read++]; + ret = file->in_data[file->in_read++]; +done: + file->busy = 0; + return ret; } PUBLIC int @@ -84,10 +89,10 @@ static const struct bt_vendor_map altos_bt_vendor_map[] = { { .vendor = "00:12:6f:", 1 }, /* Rayson */ { .vendor = "8c:de:52:", 6 }, /* ISSC */ { .vendor = "d8:80:39:", 6 }, /* Microchip */ + { .vendor = "04:91:62:", 6 }, /* New Microchip */ }; #define NUM_BT_VENDOR_MAP (sizeof altos_bt_vendor_map / sizeof altos_bt_vendor_map[0]) -#define BT_PORT_DEFAULT 1 static inline int ao_tolower(int c) { @@ -109,12 +114,15 @@ int altos_bt_port(struct altos_bt_device *device) { break; } } - return BT_PORT_DEFAULT; + return 0; } PUBLIC void altos_free(struct altos_file *file) { + int i; altos_close(file); + for (i = 0; i < 10 && file->busy; i++) + altos_pause_one_second(); free(file); }