qdev: Rename USBDevice member devname to product_desc

It's not a device name, it's the USB product description string.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Markus Armbruster 2009-12-09 17:07:51 +01:00 committed by Anthony Liguori
parent ba32edab7f
commit 0fe6d12e0b
6 changed files with 13 additions and 12 deletions

View File

@ -552,7 +552,7 @@ static struct bt_device_s *bt_hid_init(struct bt_scatternet_s *net,
BT_HID_MTU, bt_hid_new_interrupt_ch); BT_HID_MTU, bt_hid_new_interrupt_ch);
s->usbdev = dev; s->usbdev = dev;
s->btdev.device.lmp_name = s->usbdev->devname; s->btdev.device.lmp_name = s->usbdev->product_desc;
usb_hid_datain_cb(s->usbdev, s, bt_hid_datain); usb_hid_datain_cb(s->usbdev, s, bt_hid_datain);
s->btdev.device.handle_destroy = bt_hid_destroy; s->btdev.device.handle_destroy = bt_hid_destroy;

View File

@ -43,7 +43,7 @@ static int usb_qdev_init(DeviceState *qdev, DeviceInfo *base)
USBDeviceInfo *info = DO_UPCAST(USBDeviceInfo, qdev, base); USBDeviceInfo *info = DO_UPCAST(USBDeviceInfo, qdev, base);
int rc; int rc;
pstrcpy(dev->devname, sizeof(dev->devname), qdev->info->name); pstrcpy(dev->product_desc, sizeof(dev->product_desc), qdev->info->name);
dev->info = info; dev->info = info;
dev->auto_attach = 1; dev->auto_attach = 1;
rc = dev->info->init(dev); rc = dev->info->init(dev);
@ -131,7 +131,7 @@ static void do_attach(USBDevice *dev)
if (dev->attached) { if (dev->attached) {
fprintf(stderr, "Warning: tried to attach usb device %s twice\n", fprintf(stderr, "Warning: tried to attach usb device %s twice\n",
dev->devname); dev->product_desc);
return; return;
} }
dev->attached++; dev->attached++;
@ -166,7 +166,7 @@ int usb_device_detach(USBDevice *dev)
if (!dev->attached) { if (!dev->attached) {
fprintf(stderr, "Warning: tried to detach unattached usb device %s\n", fprintf(stderr, "Warning: tried to detach unattached usb device %s\n",
dev->devname); dev->product_desc);
return -1; return -1;
} }
dev->attached--; dev->attached--;
@ -228,7 +228,7 @@ static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent)
monitor_printf(mon, "%*saddr %d.%d, speed %s, name %s%s\n", monitor_printf(mon, "%*saddr %d.%d, speed %s, name %s%s\n",
indent, "", bus->busnr, dev->addr, indent, "", bus->busnr, dev->addr,
usb_speed(dev->speed), dev->devname, usb_speed(dev->speed), dev->product_desc,
dev->attached ? ", attached" : ""); dev->attached ? ", attached" : "");
} }
@ -249,7 +249,8 @@ void usb_info(Monitor *mon)
if (!dev) if (!dev)
continue; continue;
monitor_printf(mon, " Device %d.%d, Speed %s Mb/s, Product %s\n", monitor_printf(mon, " Device %d.%d, Speed %s Mb/s, Product %s\n",
bus->busnr, dev->addr, usb_speed(dev->speed), dev->devname); bus->busnr, dev->addr, usb_speed(dev->speed),
dev->product_desc);
} }
} }
} }

View File

@ -701,7 +701,7 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,
break; break;
case 2: case 2:
/* product description */ /* product description */
ret = set_usb_string(data, s->dev.devname); ret = set_usb_string(data, s->dev.product_desc);
break; break;
case 3: case 3:
/* vendor description */ /* vendor description */

View File

@ -132,7 +132,7 @@ struct USBDevice {
int speed; int speed;
uint8_t addr; uint8_t addr;
char devname[32]; char product_desc[32];
int auto_attach; int auto_attach;
int attached; int attached;

View File

@ -370,10 +370,10 @@ USBDevice *usb_host_device_open(const char *devname)
dev->dev.speed = USB_SPEED_FULL - 1; dev->dev.speed = USB_SPEED_FULL - 1;
if (strncmp(dev_info.udi_product, "product", 7) != 0) if (strncmp(dev_info.udi_product, "product", 7) != 0)
pstrcpy(dev->dev.devname, sizeof(dev->dev.devname), pstrcpy(dev->dev.product_desc, sizeof(dev->dev.product_desc),
dev_info.udi_product); dev_info.udi_product);
else else
snprintf(dev->dev.devname, sizeof(dev->dev.devname), snprintf(dev->dev.product_desc, sizeof(dev->dev.product_desc),
"host:%s", devname); "host:%s", devname);
pstrcpy(dev->devpath, sizeof(dev->devpath), "/dev/"); pstrcpy(dev->devpath, sizeof(dev->devpath), "/dev/");

View File

@ -933,10 +933,10 @@ static int usb_host_open(USBHostDevice *dev, int bus_num,
dev->dev.speed = USB_SPEED_HIGH; dev->dev.speed = USB_SPEED_HIGH;
if (!prod_name || prod_name[0] == '\0') if (!prod_name || prod_name[0] == '\0')
snprintf(dev->dev.devname, sizeof(dev->dev.devname), snprintf(dev->dev.product_desc, sizeof(dev->dev.product_desc),
"host:%d.%d", bus_num, addr); "host:%d.%d", bus_num, addr);
else else
pstrcpy(dev->dev.devname, sizeof(dev->dev.devname), pstrcpy(dev->dev.product_desc, sizeof(dev->dev.product_desc),
prod_name); prod_name);
/* USB devio uses 'write' flag to check for async completions */ /* USB devio uses 'write' flag to check for async completions */