mirror of
https://github.com/linux-msm/cdba.git
synced 2026-02-25 13:11:56 -08:00
cdba-server: Change watch timers to ms
In order to sleep for fractions of a second in alpaca, change the timeout from seconds to milliseconds. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
@@ -276,9 +276,9 @@ void watch_add_readfd(int fd, int (*cb)(int, void*), void *data)
|
||||
list_add(&read_watches, &w->node);
|
||||
}
|
||||
|
||||
void watch_timer_add(int timeout, void (*cb)(void *), void *data)
|
||||
void watch_timer_add(int timeout_ms, void (*cb)(void *), void *data)
|
||||
{
|
||||
struct timeval tv_timeout = { timeout, };
|
||||
struct timeval tv_timeout;
|
||||
struct timeval now;
|
||||
struct timer *t;
|
||||
|
||||
@@ -286,6 +286,9 @@ void watch_timer_add(int timeout, void (*cb)(void *), void *data)
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
|
||||
tv_timeout.tv_sec = timeout_ms / 1000;
|
||||
tv_timeout.tv_usec = (timeout_ms % 1000) * 1000;
|
||||
|
||||
t->cb = cb;
|
||||
t->data = data;
|
||||
timeradd(&now, &tv_timeout, &t->tv);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
void watch_add_readfd(int fd, int (*cb)(int, void*), void *data);
|
||||
int watch_add_quit(int (*cb)(int, void*), void *data);
|
||||
void watch_timer_add(int timeout, void (*cb)(void *), void *data);
|
||||
void watch_timer_add(int timeout_ms, void (*cb)(void *), void *data);
|
||||
void watch_quit(void);
|
||||
int watch_run(void);
|
||||
|
||||
|
||||
2
device.c
2
device.c
@@ -128,7 +128,7 @@ int device_power_on(struct device *device)
|
||||
device->power_on(device);
|
||||
|
||||
if (device->fastboot_key_timeout)
|
||||
watch_timer_add(device->fastboot_key_timeout, device_release_fastboot_key, device);
|
||||
watch_timer_add(device->fastboot_key_timeout * 1000, device_release_fastboot_key, device);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user