[Spice-devel] [PATCH spice-gtk 07/44] fixup! usb-redir: define interfaces to support emulated devices

Frediano Ziglio fziglio at redhat.com
Tue Jul 30 12:02:56 UTC 2019


Remove useless device_type, name is misleading and used only
to understand if is emulated.
This can be checked verifying bus number.
bus number is 16 bits so use G_MAXUINT16 instead of 255
---
 src/usb-backend.c | 1 -
 src/usb-backend.h | 5 ++---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/usb-backend.c b/src/usb-backend.c
index eb228e88..0a830dfb 100644
--- a/src/usb-backend.c
+++ b/src/usb-backend.c
@@ -922,7 +922,6 @@ gboolean spice_usb_backend_create_device(SpiceUsbBackend *be,
     dev = g_new0(SpiceUsbBackendDevice, 1);
     dev->device_info.bus = BUS_NUMBER_FOR_EMULATED_USB;
     dev->device_info.address = address;
-    dev->device_info.device_type = dev_type;
     dev->ref_count = 1;
 
     if (be->dev_init[dev_type](be, dev, param, &edev)) {
diff --git a/src/usb-backend.h b/src/usb-backend.h
index 76c552f5..e898d68a 100644
--- a/src/usb-backend.h
+++ b/src/usb-backend.h
@@ -38,6 +38,8 @@ typedef enum
     USB_DEV_TYPE_MAX
 } UsbEmulatedDeviceType;
 
+#define BUS_NUMBER_FOR_EMULATED_USB G_MAXUINT16
+
 typedef struct UsbDeviceInformation
 {
     uint16_t bus;
@@ -48,7 +50,6 @@ typedef struct UsbDeviceInformation
     uint8_t class;
     uint8_t subclass;
     uint8_t protocol;
-    uint8_t device_type; /* UsbEmulatedDeviceType */
 } UsbDeviceInformation;
 
 typedef void(*usb_hot_plug_callback)(void *user_data, SpiceUsbBackendDevice *dev, gboolean added);
@@ -97,8 +98,6 @@ void spice_usb_backend_channel_get_guest_filter(SpiceUsbBackendChannel *ch,
                                                 int *count);
 void spice_usb_backend_return_write_data(SpiceUsbBackendChannel *ch, void *data);
 
-#define BUS_NUMBER_FOR_EMULATED_USB         255
-
 typedef struct UsbCreateDeviceParameters
 {
     GError *error;
-- 
2.20.1



More information about the Spice-devel mailing list