summaryrefslogtreecommitdiff
path: root/usbredirhost/usbredirhost.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-03-06 11:21:49 +0100
committerHans de Goede <hdegoede@redhat.com>2012-03-06 11:37:05 +0100
commit4d9242ded6e0d89e17399979e0c42608252abdcb (patch)
treec73a4cb6d0e95731675d4b8e99a86d92f0ae8aa7 /usbredirhost/usbredirhost.c
parentc55d959fd3f0f52a6a2f4624fd058e9a307d455c (diff)
usbredirhost: Replace rejected flag with a read_status variable
So that the same mechanism can be used to return other errors too. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'usbredirhost/usbredirhost.c')
-rw-r--r--usbredirhost/usbredirhost.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
index 5be1730..9a601dc 100644
--- a/usbredirhost/usbredirhost.c
+++ b/usbredirhost/usbredirhost.c
@@ -113,7 +113,7 @@ struct usbredirhost {
int active_config;
int claimed;
int disconnected;
- int rejected;
+ int read_status;
int cancels_pending;
int wait_disconnect;
int connect_pending;
@@ -213,9 +213,10 @@ static int usbredirhost_read(void *priv, uint8_t *data, int count)
{
struct usbredirhost *host = priv;
- if (host->rejected) {
- host->rejected = 0;
- return usbredirhost_read_device_rejected;
+ if (host->read_status) {
+ int ret = host->read_status;
+ host->read_status = 0;
+ return ret;
}
return host->read_func(host->func_priv, data, count);
@@ -1692,7 +1693,7 @@ static void usbredirhost_filter_reject(void *priv)
return;
INFO("device rejected");
- host->rejected = 1;
+ host->read_status = usbredirhost_read_device_rejected;
}
static void usbredirhost_filter_filter(void *priv,