allow usage of older libusb which didn't define LIBUSB_LOG_LEVEL_WARNING
PATCH 1/1 allow usage of older libusb which didn't define LIBUSB_LOG_LEVEL_WARNING
Older libusb does not have any LIBUSB_LOG_LEVEL_* definitions. Since we expose these values as integers anyway, just use the right define if the constant isn't defined.
Signed-off-by Michael Tokarev <[email protected]>
--- hw/usb/host-libusb.c | 3 +++ 1 file changed, 3 insertions(+)
hw/usb/host-libusb.c +3 -0
@@ -1251,6 +1251,9 @@ static Property usb_host_dev_properties[] = {DEFINE_PROP_UINT32 ("isobufs" , USBHostDevice, iso_urb_count,4 ),DEFINE_PROP_UINT32 ("isobsize" , USBHostDevice, iso_urb_frames,32 ),DEFINE_PROP_INT32 ("bootindex" , USBHostDevice, bootindex,-1 ), +#ifndef LIBUSB_LOG_LEVEL_WARNING /* older libusb didn't define these */ +#define LIBUSB_LOG_LEVEL_WARNING 2 +#endif DEFINE_PROP_UINT32 ("loglevel" , USBHostDevice, loglevel,LIBUSB_LOG_LEVEL_WARNING ), DEFINE_PROP_BIT("pipeline", USBHostDevice, options,
Signature · 1 line
1.7.10.4
hw/usb/host-libusb.c static Property usb_host_dev_properties[] = { · line 1256
Quoted 11 lines · Michael Tokarev
hw/usb/host-libusb.c +3
-0@@ -1251,6 +1251,9 @@ static Property usb_host_dev_properties[] = {DEFINE_PROP_UINT32 ("isobufs" , USBHostDevice, iso_urb_count,4 ),DEFINE_PROP_UINT32 ("isobsize" , USBHostDevice, iso_urb_frames,32 ),DEFINE_PROP_INT32 ("bootindex" , USBHostDevice, bootindex,-1 ), +#ifndef LIBUSB_LOG_LEVEL_WARNING /* older libusb didn't define these */ +#define LIBUSB_LOG_LEVEL_WARNING 2 +#endif
Can we put this up near the top of the file rather than in the middle of the Property list definition, please?
thanks
-- PMM
hw/usb/host-libusb.c static Property usb_host_dev_properties[] = { · line 1256
Quoted 3 lines · Michael Tokarev
hw/usb/host-libusb.c +3
-0+#ifndef LIBUSB_LOG_LEVEL_WARNING /* older libusb didn't define these */ +#define LIBUSB_LOG_LEVEL_WARNING 2 +#endif
By the way, where these are provided by the header, they're provided as an enum, not #defined constants. So we'll always #define the define (which will work, but I don't know if you did this deliberately).
-- PMM