2012-12-16 23:27:22 +00:00
|
|
|
From b9d21224a0186b5b6664d28a06729e0a5dadb853 Mon Sep 17 00:00:00 2001
|
2012-09-07 15:20:05 +00:00
|
|
|
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
Date: Mon, 3 Sep 2012 11:53:28 +0200
|
2012-10-28 18:05:07 +00:00
|
|
|
Subject: [PATCH] usb-redir: Add a usbredir_reject_device helper function
|
2012-09-07 15:20:05 +00:00
|
|
|
|
|
|
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
|
---
|
|
|
|
hw/usb/redirect.c | 21 +++++++++++----------
|
|
|
|
1 file changed, 11 insertions(+), 10 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
|
2012-10-28 18:05:07 +00:00
|
|
|
index b9a3633..a590cb2 100644
|
2012-09-07 15:20:05 +00:00
|
|
|
--- a/hw/usb/redirect.c
|
|
|
|
+++ b/hw/usb/redirect.c
|
2012-10-28 18:05:07 +00:00
|
|
|
@@ -820,16 +820,21 @@ static void usbredir_chardev_open(USBRedirDevice *dev)
|
2012-09-07 15:20:05 +00:00
|
|
|
usbredirparser_do_write(dev->parser);
|
|
|
|
}
|
|
|
|
|
|
|
|
+static void usbredir_reject_device(USBRedirDevice *dev)
|
|
|
|
+{
|
|
|
|
+ usbredir_device_disconnect(dev);
|
|
|
|
+ if (usbredirparser_peer_has_cap(dev->parser, usb_redir_cap_filter)) {
|
|
|
|
+ usbredirparser_send_filter_reject(dev->parser);
|
|
|
|
+ usbredirparser_do_write(dev->parser);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
static void usbredir_do_attach(void *opaque)
|
|
|
|
{
|
|
|
|
USBRedirDevice *dev = opaque;
|
|
|
|
|
|
|
|
if (usb_device_attach(&dev->dev) != 0) {
|
|
|
|
- usbredir_device_disconnect(dev);
|
|
|
|
- if (usbredirparser_peer_has_cap(dev->parser, usb_redir_cap_filter)) {
|
|
|
|
- usbredirparser_send_filter_reject(dev->parser);
|
|
|
|
- usbredirparser_do_write(dev->parser);
|
|
|
|
- }
|
|
|
|
+ usbredir_reject_device(dev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-28 18:05:07 +00:00
|
|
|
@@ -1008,11 +1013,7 @@ static int usbredir_check_filter(USBRedirDevice *dev)
|
2012-09-07 15:20:05 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
|
|
|
- usbredir_device_disconnect(dev);
|
|
|
|
- if (usbredirparser_peer_has_cap(dev->parser, usb_redir_cap_filter)) {
|
|
|
|
- usbredirparser_send_filter_reject(dev->parser);
|
|
|
|
- usbredirparser_do_write(dev->parser);
|
|
|
|
- }
|
|
|
|
+ usbredir_reject_device(dev);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
2012-12-16 23:27:22 +00:00
|
|
|
1.8.0.2
|
2012-09-07 15:20:05 +00:00
|
|
|
|