summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
017e7ed)
Just spins for a while waiting for reading thread to wake up and
return.
Signed-off-by: Keith Packard <keithp@keithp.com>
altos_getchar(struct altos_file *file, int timeout)
{
int ret;
altos_getchar(struct altos_file *file, int timeout)
{
int ret;
while (file->in_read == file->in_used) {
ret = altos_fill(file, timeout);
if (ret)
while (file->in_read == file->in_used) {
ret = altos_fill(file, timeout);
if (ret)
- return file->in_data[file->in_read++];
+ ret = file->in_data[file->in_read++];
+done:
+ file->busy = 0;
+ return ret;
return BT_PORT_DEFAULT;
}
return BT_PORT_DEFAULT;
}
PUBLIC void
altos_free(struct altos_file *file)
{
PUBLIC void
altos_free(struct altos_file *file)
{
+ for (i = 0; i < 10 && file->busy; i++) {
+ struct timespec delay = { .tv_sec = 1, .tv_nsec = 0 };
+ nanosleep(&delay, NULL);
+ }
unsigned char in_data[USB_BUF_SIZE];
int in_used;
int in_read;
unsigned char in_data[USB_BUF_SIZE];
int in_used;
int in_read;