tcg: Add tcg_gen_mulsu2_{i32,i64,tl}
[qemu/ar7.git] / hw / usb / quirks.c
blob38a9c5634ad24c4ffed50e0655f8962a8ce1db76
1 /*
2 * USB quirk handling
4 * Copyright (c) 2012 Red Hat, Inc.
6 * Red Hat Authors:
7 * Hans de Goede <hdegoede@redhat.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
15 #include "qemu/osdep.h"
16 #include "quirks.h"
17 #include "hw/usb.h"
19 static bool usb_id_match(const struct usb_device_id *ids,
20 uint16_t vendor_id, uint16_t product_id,
21 uint8_t interface_class, uint8_t interface_subclass,
22 uint8_t interface_protocol) {
23 int i;
25 for (i = 0; ids[i].vendor_id != -1; i++) {
26 if (ids[i].vendor_id == vendor_id &&
27 ids[i].product_id == product_id &&
28 (ids[i].interface_class == -1 ||
29 (ids[i].interface_class == interface_class &&
30 ids[i].interface_subclass == interface_subclass &&
31 ids[i].interface_protocol == interface_protocol))) {
32 return true;
35 return false;
38 int usb_get_quirks(uint16_t vendor_id, uint16_t product_id,
39 uint8_t interface_class, uint8_t interface_subclass,
40 uint8_t interface_protocol)
42 int quirks = 0;
44 if (usb_id_match(usbredir_raw_serial_ids, vendor_id, product_id,
45 interface_class, interface_subclass, interface_protocol)) {
46 quirks |= USB_QUIRK_BUFFER_BULK_IN;
48 if (usb_id_match(usbredir_ftdi_serial_ids, vendor_id, product_id,
49 interface_class, interface_subclass, interface_protocol)) {
50 quirks |= USB_QUIRK_BUFFER_BULK_IN | USB_QUIRK_IS_FTDI;
53 return quirks;