* [Qemu-devel] [PATCH] Add bootindex support to usb-host and usb-redir
@ 2012-03-22 9:52 Gerd Hoffmann
2012-03-22 10:33 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Gerd Hoffmann @ 2012-03-22 9:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
When passing through a usb pendrive seabios will present it in the F12
boot menu and will happily boot from it.
This patch adds bootorder support so you can even make it the default
boot device.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/host-linux.c | 3 +++
hw/usb/redirect.c | 3 +++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c
index 72f0306..f3d5a62 100644
--- a/hw/usb/host-linux.c
+++ b/hw/usb/host-linux.c
@@ -117,6 +117,7 @@ typedef struct USBHostDevice {
int addr;
char port[MAX_PORTLEN];
struct USBAutoFilter match;
+ int32_t bootindex;
int seen, errcount;
QTAILQ_ENTRY(USBHostDevice) next;
@@ -1420,6 +1421,7 @@ static int usb_host_initfn(USBDevice *dev)
if (s->match.bus_num != 0 && s->match.port != NULL) {
usb_host_claim_port(s);
}
+ add_boot_device_path(s->bootindex, &dev->qdev, NULL);
return 0;
}
@@ -1435,6 +1437,7 @@ static Property usb_host_dev_properties[] = {
DEFINE_PROP_HEX32("vendorid", USBHostDevice, match.vendor_id, 0),
DEFINE_PROP_HEX32("productid", USBHostDevice, match.product_id, 0),
DEFINE_PROP_UINT32("isobufs", USBHostDevice, iso_urb_count, 4),
+ DEFINE_PROP_INT32("bootindex", USBHostDevice, bootindex, -1),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 8e9f175..4288324 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -74,6 +74,7 @@ struct USBRedirDevice {
CharDriverState *cs;
uint8_t debug;
char *filter_str;
+ int32_t bootindex;
/* Data passed from chardev the fd_read cb to the usbredirparser read cb */
const uint8_t *read_buf;
int read_buf_size;
@@ -923,6 +924,7 @@ static int usbredir_initfn(USBDevice *udev)
qemu_chr_add_handlers(dev->cs, usbredir_chardev_can_read,
usbredir_chardev_read, usbredir_chardev_event, dev);
+ add_boot_device_path(dev->bootindex, &udev->qdev, NULL);
return 0;
}
@@ -1452,6 +1454,7 @@ static Property usbredir_properties[] = {
DEFINE_PROP_CHR("chardev", USBRedirDevice, cs),
DEFINE_PROP_UINT8("debug", USBRedirDevice, debug, 0),
DEFINE_PROP_STRING("filter", USBRedirDevice, filter_str),
+ DEFINE_PROP_INT32("bootindex", USBRedirDevice, bootindex, -1),
DEFINE_PROP_END_OF_LIST(),
};
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] Add bootindex support to usb-host and usb-redir
2012-03-22 9:52 [Qemu-devel] [PATCH] Add bootindex support to usb-host and usb-redir Gerd Hoffmann
@ 2012-03-22 10:33 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2012-03-22 10:33 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
Il 22/03/2012 10:52, Gerd Hoffmann ha scritto:
> When passing through a usb pendrive seabios will present it in the F12
> boot menu and will happily boot from it.
>
> This patch adds bootorder support so you can even make it the default
> boot device.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> hw/usb/host-linux.c | 3 +++
> hw/usb/redirect.c | 3 +++
> 2 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c
> index 72f0306..f3d5a62 100644
> --- a/hw/usb/host-linux.c
> +++ b/hw/usb/host-linux.c
> @@ -117,6 +117,7 @@ typedef struct USBHostDevice {
> int addr;
> char port[MAX_PORTLEN];
> struct USBAutoFilter match;
> + int32_t bootindex;
> int seen, errcount;
>
> QTAILQ_ENTRY(USBHostDevice) next;
> @@ -1420,6 +1421,7 @@ static int usb_host_initfn(USBDevice *dev)
> if (s->match.bus_num != 0 && s->match.port != NULL) {
> usb_host_claim_port(s);
> }
> + add_boot_device_path(s->bootindex, &dev->qdev, NULL);
> return 0;
> }
>
> @@ -1435,6 +1437,7 @@ static Property usb_host_dev_properties[] = {
> DEFINE_PROP_HEX32("vendorid", USBHostDevice, match.vendor_id, 0),
> DEFINE_PROP_HEX32("productid", USBHostDevice, match.product_id, 0),
> DEFINE_PROP_UINT32("isobufs", USBHostDevice, iso_urb_count, 4),
> + DEFINE_PROP_INT32("bootindex", USBHostDevice, bootindex, -1),
> DEFINE_PROP_END_OF_LIST(),
> };
>
> diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> index 8e9f175..4288324 100644
> --- a/hw/usb/redirect.c
> +++ b/hw/usb/redirect.c
> @@ -74,6 +74,7 @@ struct USBRedirDevice {
> CharDriverState *cs;
> uint8_t debug;
> char *filter_str;
> + int32_t bootindex;
> /* Data passed from chardev the fd_read cb to the usbredirparser read cb */
> const uint8_t *read_buf;
> int read_buf_size;
> @@ -923,6 +924,7 @@ static int usbredir_initfn(USBDevice *udev)
> qemu_chr_add_handlers(dev->cs, usbredir_chardev_can_read,
> usbredir_chardev_read, usbredir_chardev_event, dev);
>
> + add_boot_device_path(dev->bootindex, &udev->qdev, NULL);
> return 0;
> }
>
> @@ -1452,6 +1454,7 @@ static Property usbredir_properties[] = {
> DEFINE_PROP_CHR("chardev", USBRedirDevice, cs),
> DEFINE_PROP_UINT8("debug", USBRedirDevice, debug, 0),
> DEFINE_PROP_STRING("filter", USBRedirDevice, filter_str),
> + DEFINE_PROP_INT32("bootindex", USBRedirDevice, bootindex, -1),
> DEFINE_PROP_END_OF_LIST(),
> };
>
That was fast. :) Looks good, thanks!
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-22 10:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 9:52 [Qemu-devel] [PATCH] Add bootindex support to usb-host and usb-redir Gerd Hoffmann
2012-03-22 10:33 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).