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