usb-gotemp: USB thermometer emulation
v2 cover usb-gotemp: USB thermometer emulation
Rebased on top of the master branch of git://git.savannah.nongnu.org/qemu.git since last posting. Any advice on how to get these reviewed and merged or rejected greatly appreciated!
Greg Kroah-Hartman has been giving a talk titled "Write a Real, Working, Linux Driver" for the past four years at various conferences. This patch series enables qemu to emulate the Vernier Go!Temp USB thermometer used in that talk.
This was motivated by experience from the FreedomHEC Taipei 2009 conference, where students complained that the gadget was too expensive while professional developers complained the limited number of devices Greg brought sold out too quickly.
The emulation is complete enough for gregkh's sample driver and using the vendor supplied SDK through the in-kernel 'ldusb' module under Linux. No testing have yet been done with the vendor's fancier Windows software.
Video, slides and code from gregkh's talk:
http://www.kernel.org/pub/media/talks/gregkh/2008_driver_writing_tutorial_gregkh.avi
http://www.archive.org/download/LinuxDriverTutorialFreedomhecTaipei2009_215/06-linux-driver-tutorial.ogg
http://freedomhectaipei.pbworks.com/f/gregkh-driver-tutorial-freedomhectaipei.pdf
http://freedomhectaipei.pbworks.com/f/usb_tutorial.tar.gz
PATCH v2 1/3 usb: move HID request defines to hw/usb.h
Move USB HID request constants from hw/usb-hid.c to hw/usb.h to allow other modules to use them.
--- hw/usb-hid.c | 20 ++++++-------------- hw/usb.h | 8 ++++++++ 2 files changed, 14 insertions(+), 14 deletions(-)
hw/usb-hid.c +6 -14
@@ -26,14 +26,6 @@#include "console.h" #include "usb.h" -/* HID interface requests */ -#define GET_REPORT 0xa101 -#define GET_IDLE 0xa102 -#define GET_PROTOCOL 0xa103 -#define SET_REPORT 0x2109 -#define SET_IDLE 0x210a -#define SET_PROTOCOL 0x210b -/* HID descriptor types */ #define USB_DT_HID 0x21#define USB_DT_REPORT 0x22
@@ -763,7 +755,7 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value, goto fail; }break ; -case GET_REPORT : +case USB_REQ_HID_GET_REPORT :if (s->kind ==USB_MOUSE ) ret =usb_mouse_poll (s, data, length);else if (s->kind ==USB_TABLET )
@@ -771,29 +763,29 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,else if (s->kind ==USB_KEYBOARD ) ret =usb_keyboard_poll (&s->kbd, data, length);break ; -case SET_REPORT : +case USB_REQ_HID_SET_REPORT :if (s->kind ==USB_KEYBOARD ) ret =usb_keyboard_write (&s->kbd, data, length);else goto fail;break ; -case GET_PROTOCOL : +case USB_REQ_HID_GET_PROTOCOL :if (s->kind !=USB_KEYBOARD ) goto fail; ret =1 ; data[0 ] = s->protocol;break ; -case SET_PROTOCOL : +case USB_REQ_HID_SET_PROTOCOL :if (s->kind !=USB_KEYBOARD ) goto fail; ret =0 ; s->protocol = value;break ; -case GET_IDLE : +case USB_REQ_HID_GET_IDLE : ret =1 ; data[0 ] = s->idle;break ; -case SET_IDLE : +case USB_REQ_HID_SET_IDLE : s->idle = (uint8_t ) (value >>8 ); ret =0 ;break ;
hw/usb.h +8 -0
@@ -104,6 +104,14 @@#define USB_REQ_SET_INTERFACE 0x0B#define USB_REQ_SYNCH_FRAME 0x0C +/* HID interface requests */ +#define USB_REQ_HID_GET_REPORT 0xa101 +#define USB_REQ_HID_GET_IDLE 0xa102 +#define USB_REQ_HID_GET_PROTOCOL 0xa103 +#define USB_REQ_HID_SET_REPORT 0x2109 +#define USB_REQ_HID_SET_IDLE 0x210a +#define USB_REQ_HID_SET_PROTOCOL 0x210b +#define USB_DEVICE_SELF_POWERED 0#define USB_DEVICE_REMOTE_WAKEUP 1
Signature · 1 line
1.6.5.2
PATCH v2 2/3 usb-gotemp: new module emulating a USB thermometer
Emulate the Vernier Go!Temp USB thermometer
(see: http://www.vernier.com/go/gotemp.html)
used in Greg Kroah-Hartman's "Write a Real, Working, Linux Driver" talk.
The emulation is complete enough for gregkh's sample driver and using the vendor supplied SDK through the in-kernel 'ldusb' module under Linux. No testing have yet been done with the vendor's fancier Windows software.
--- Makefile | 2 +- hw/usb-gotemp.c | 710 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 711 insertions(+), 1 deletions(-) create mode 100644 hw/usb-gotemp.c
Makefile +1 -1
@@ -124,7 +124,7 @@ obj-y += i2c.o smbus.o smbus_eeprom.o obj-y += eeprom93xx.o obj-y += scsi-disk.o cdrom.o obj-y += scsi-generic.o scsi-bus.o -obj-y += usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o +obj-y += usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o usb-gotemp.o obj-y += usb-serial.o usb-net.o usb-bus.o obj-$(CONFIG_SSI) += ssi.o obj-$(CONFIG_SSI_SD) += ssi-sd.o
hw/usb-gotemp.c new file +710 -0
710 lines not on this page · raw message
Signature · 1 line
1.6.5.2
PATCH v2 3/3 Documentation: -usbdevice thermometer option
Adds documentation for the '-usbdevice thermometer' option.
--- qemu-options.hx | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
qemu-options.hx +3 -0
@@ -396,6 +396,9 @@ or fake device. @item net:@var{options} Network adapter that supports CDC ethernet and RNDIS protocols. +@item thermometer +Vernier Go!Temp compatible thermometer. + @end table ETEXI
Signature · 1 line
1.6.5.2
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
In reply to Scott TsaiQuoted 10 lines · Scott Tsai
Emulate the Vernier Go!Temp USB thermometer
(see: http://www.vernier.com/go/gotemp.html)
used in Greg Kroah-Hartman's "Write a Real, Working, Linux Driver" talk.The emulation is complete enough for gregkh's sample driver and using the vendor supplied SDK through the in-kernel 'ldusb' module under Linux. No testing have yet been done with the vendor's fancier Windows software.
+ s->temperature++;
You're going to overheat very quickly.
Apart from making the driver work, is this actually useful?
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
Quoted 4 lines
Quoted 2 lines
+ s->temperature++;
You're going to overheat very quickly.
Apart from making the driver work, is this actually useful?
I wanted the temperature to change with time to give a sense of "something is happening" ^_^
The main user I had in mind was someone new to USB and Linux driver development following gregkh's driver tutorial:
http://www.kroah.com/linux/talks/ols_2005_driver_tutorial/
My thinking was that if the temperature never changes, all the USB packets generated in the 'read_int_callback"
part of the driver would seem like a waste of effort.
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
Quoted 8 lines · Scott Tsai
Quoted 4 lines
Quoted 2 lines
+ s->temperature++;
You're going to overheat very quickly.
Apart from making the driver work, is this actually useful?I wanted the temperature to change with time to give a sense of "something is happening" ^_^
Quoted 6 lines
The main user I had in mind was someone new to USB and Linux driver development following gregkh's driver tutorial:
http://www.kroah.com/linux/talks/ols_2005_driver_tutorial/
My thinking was that if the temperature never changes, all the USB packets generated in the 'read_int_callback"
part of the driver would seem like a waste of effort.
How about having a monitor command to change the temperature, leveraging a "common interface"?
That way in the future real host temperature measurements could maybe get forwarded there too. At least for battery I've had several people ask already if it's possible to read the host battery status (incl. AC status) from inside the VM.
Alex
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
Quoted 6 lines · Alexander Graf
How about having a monitor command to change the temperature, leveraging a "common interface"?
That way in the future real host temperature measurements could maybe get forwarded there too. At least for battery I've had several people ask already if it's possible to read the host battery status (incl. AC status) from inside the VM.
I'd certainly like to make this code useful for something other than developer training.
How about a new monitor command "thermometer_set" that works like "mouse_move"? "thermometer_set" would just set the temperature of the "first" thermometer device it finds.
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
Quoted 8 lines · On Tue, 10 Nov 2009 23:55:10 +0800 Scott Tsai <[email protected]> wrote:
Quoted 6 lines · Alexander Graf
How about having a monitor command to change the temperature, leveraging a "common interface"?
That way in the future real host temperature measurements could maybe get forwarded there too. At least for battery I've had several people ask already if it's possible to read the host battery status (incl. AC status) from inside the VM.
Quoted 5 lines
I'd certainly like to make this code useful for something other than developer training.
How about a new monitor command "thermometer_set" that works like "mouse_move"? "thermometer_set" would just set the temperature of the "first" thermometer device it finds.
Couldn't the device be a parameter?
And I'd suggest usb_therm_set for the name.
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
Quoted 11 lines · Luiz Capitulino
Quoted 6 lines
I'd certainly like to make this code useful for something other than developer training.
How about a new monitor command "thermometer_set" that works like "mouse_move"? "thermometer_set" would just set the temperature of the "first" thermometer device it finds.Couldn't the device be a parameter?
And I'd suggest
usb_therm_setfor the name.
Looking at the existing "mouse_set" and "mouse_move" monitor commands, they work on USB, PS/2 and other kinds of mice with "mouse_set" selecting the mouse device affected by "mouse_move".
So how about a new command "therm_set" which selects the thermometer affected by "therm_temp" ?
On a separate note, I understand that if a piece of code is not useful enough we don't want to merge it to add to the maintenance burden.
I still propose 'usb-gotemp' for merging because the fact that gregkh could give his
driver tutorial several years in a roll to sizable audiences shows that there are people out there
interested in getting into Linux driver development.
With this code merged, people could follow the video and slides of his talk without special hardware and this potentially grows the Linux developer pool.
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
Quoted 10 lines · On Wed, 11 Nov 2009 01:52:12 +0800 Scott Tsai <[email protected]> wrote:
Quoted 9 lines · Luiz Capitulino
Quoted 6 lines
I'd certainly like to make this code useful for something other than developer training.
How about a new monitor command "thermometer_set" that works like "mouse_move"? "thermometer_set" would just set the temperature of the "first" thermometer device it finds.Couldn't the device be a parameter?
Quoted 8 lines
Quoted 2 lines
And I'd suggest
usb_therm_setfor the name.Looking at the existing "
mouse_set" and "mouse_move" monitor commands, they work on USB, PS/2 and other kinds of mice with "mouse_set" selecting the mouse device affected by "mouse_move".
So how about a new command "therm_set" which selects the thermometer affected by "therm_temp" ?
This mouse command also selects the current mouse, right?
I think your case is simpler, you just want to say which thermometer
should get the new temp.
Quoted 2 lines
On a separate note, I understand that if a piece of code is not useful enough we don't want to merge it to add to the maintenance burden.
Alex has given a good reason to merge it, I think.
PATCH v3 2/3 usb-gotemp: reworked to add monitor commands
I reworked the patch to add generic monitor commands to change the temperature reported from thermometers. Thermometer devices can now include "sendor.h" and call 'qemu_add_therm_temp_handler' to register themselves.
I went with separate 'therm_set DEVICE_INDEX' and 'therm_temp TEMPERATURE' commands since a 'therm_temp' command that only requires one argument seems easier
to use on the monitor command line and doesn't require searching the
list of thermometers repeatedly.
To cater to my original "driver tutorial" use case,
by default the temperature would still automatically increment unless the 'controlled_by_monitor' qdev property is set.
Even when auto incrementing the temperature is now always bounded between 25C ~ 40C. (previously the temperature would increment until int16_t overflows)
# START OF PATCH
Emulate the Vernier Go!Temp USB thermometer
(see: http://www.vernier.com/go/gotemp.html)
used in Greg Kroah-Hartman's "Write a Real, Working, Linux Driver" talk.
The emulation is complete enough for gregkh's sample driver and using the vendor supplied SDK through the in-kernel 'ldusb' module under Linux. No testing have yet been done with the vendor's fancier Windows software.
If the qdev property 'controlled_by_monitor' is _NOT_ set on the thermometer, such as through the command line option '-usbdevice thermometer:controlled_by_monitor', the temperature would increment on each report but is bound between 25C
~ 40C.
Added new monitor commands:
info thermometers
therm_set DEVICE_INDEX
therm_temp TEMPERATURE
modeled after 'info mice', 'mouse_set' and 'mouse_move'.
--- Makefile | 2 +- hw/usb-gotemp.c | 762 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ monitor.c | 94 +++++++ qemu-monitor.hx | 35 +++ sensor.h | 20 ++ 5 files changed, 912 insertions(+), 1 deletions(-) create mode 100644 hw/usb-gotemp.c create mode 100644 sensor.h
Makefile +1 -1
@@ -124,7 +124,7 @@ obj-y += i2c.o smbus.o smbus_eeprom.o obj-y += eeprom93xx.o obj-y += scsi-disk.o cdrom.o obj-y += scsi-generic.o scsi-bus.o -obj-y += usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o +obj-y += usb.o usb-hub.o usb-$(HOST_USB).o usb-hid.o usb-msd.o usb-wacom.o usb-gotemp.o obj-y += usb-serial.o usb-net.o usb-bus.o obj-$(CONFIG_SSI) += ssi.o obj-$(CONFIG_SSI_SD) += ssi-sd.o
hw/usb-gotemp.c new file +762 -0
762 lines not on this page · raw message
monitor.c +94 -0
112 lines not on this page · raw message
qemu-monitor.hx +35 -0
@@ -111,6 +111,8 @@ show migration status show balloon information @item info qtree show device tree +@item info thermometers +show available thermometers @end table ETEXI
@@ -1040,6 +1042,39 @@ Close the file descriptor previously assigned to @var{fdname} using the used by another monitor command. ETEXI + { + .name = "therm_set", + .args_type = "index:i", + .params = "index", + .help = "set which thermometer device is affected by therm_temp", + .mhandler.cmd_new = do_therm_set, + }, + +STEXI +@item therm_set @var{index} +Set which thermometer device is affected by @code{therm_temp}, index +can be obtained with +@example +info thermometer +@end example +ETEXI + + { + .name = "therm_temp", + .args_type = "temperature_str:s", + .params = "temperature", + .help = "set thermometer temperature", + .mhandler.cmd_new = do_therm_temp, + }, + +STEXI +@item therm_temp @var{temperature} +Set the temperature of the thermometer selected with @code{therm_set}. +@example +therm_temp 0F +therm_temp -17.8c +@end example +ETEXI STEXI @end table ETEXI
sensor.h new file +20 -0
@@ -0,0 +1,20 @@ +#ifndef SENSOR_H +#define SENSOR_H + +#include "qemu-queue.h" + +/* thermometers */ +typedef void (ThermTempHandler )(void *opaque,double temperature_celsius); + +struct ThermTempEntry { +ThermTempHandler *cb; +void *opaque; +char *name; +QCIRCLEQ_ENTRY (ThermTempEntry) entries; +}; +typedef struct ThermTempEntry ThermTempEntry ; + +ThermTempEntry *qemu_add_therm_temp_handler (ThermTempHandler *cb,void *opaque,const char *name); +void qemu_del_therm_temp_handler (ThermTempEntry *e); + +#endif
Signature · 1 line
1.6.5.2
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
In reply to Scott TsaiQuoted 20 lines · Scott Tsai
Quoted 11 lines · Luiz Capitulino
Quoted 6 lines
I'd certainly like to make this code useful for something other than developer training.
How about a new monitor command "thermometer_set" that works like "mouse_move"? "thermometer_set" would just set the temperature of the "first" thermometer device it finds.Couldn't the device be a parameter?
And I'd suggest
usb_therm_setfor the name.Looking at the existing "
mouse_set" and "mouse_move" monitor commands, they work on USB, PS/2 and other kinds of mice with "mouse_set" selecting the mouse device affected by "mouse_move".
So how about a new command "therm_set" which selects the thermometer affected by "therm_temp" ?
Quoted 10 lines
On a separate note, I understand that if a piece of code is not useful enough we don't want to merge it to add to the maintenance burden.
I still propose 'usb-gotemp' for merging because the fact that gregkh could give his
driver tutorial several years in a roll to sizable audiences shows that there are people out there
interested in getting into Linux driver development.
With this code merged, people could follow the video and slides of his talk without special hardware and this potentially grows the Linux developer pool.
And if Greg decides to change the device he uses for the tutorial, then in a few years it's not so useful anymore?
That said, if we position this as an example device, I think that makes sense. But that suggests that we should document the heck out of it and make it a learning experience for QEMU too. It could be an example of how to write a simple QEMU device emulation.
That would be interesting independent of Greg's tutorial.
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
Quoted 33 lines · Anthony Liguori
Quoted 21 lines · Scott Tsai
On Wed, Nov 11, 2009 at 1:06 AM, Luiz Capitulino <[email protected]
Quoted 8 lines
Quoted 6 lines · wrote:
I'd certainly like to make this code useful for something other than developer training.
How about a new monitor command "thermometer_set" that works like "mouse_move"? "thermometer_set" would just set the temperature of the "first" thermometer device it finds.Quoted 5 lines
Couldn't the device be a parameter?
And I'd suggest
usb_therm_setfor the name.Looking at the existing "
mouse_set" and "mouse_move" monitor commands, they work on USB, PS/2 and other kinds of mice with "mouse_set" selecting the mouse device affected by "mouse_move".
So how about a new command "therm_set" which selects the thermometer affected by "therm_temp" ?Quoted 10 lines
On a separate note, I understand that if a piece of code is not useful enough we don't want to merge it to add to the maintenance burden.
I still propose 'usb-gotemp' for merging because the fact that gregkh could give his
driver tutorial several years in a roll to sizable audiences shows that there are people out there
interested in getting into Linux driver development.
With this code merged, people could follow the video and slides of his talk without special hardware and this potentially grows the Linux developer pool.
Quoted 1 line
And if Greg decides to change the device he uses for the tutorial, then in a few years it's not so useful anymore?
Well, why don't we ask him?
Quoted 1 line
That said, if we position this as an example device, I think that makes sense.
I personally don't think it should be a requirement for inclusion in qemu that it's useful for years on for everyone using it. If there's a big enough group of people using a feature it seems worthwhile. And if Scott went through the trouble of implementing it, I'm pretty sure there is enough of an audience around.
Quoted 2 lines
But that suggests that we should document the heck out of it and
make it a learning experience for QEMU too. It could be an example of how to write a simple QEMU device emulation.
That'd be beneficial nevertheless. I'm doubtful a USB device is the proper target here though.
Alex
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
Quoted 10 lines · Alexander Graf
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Scott Tsai
On Wed, Nov 11, 2009 at 1:06 AM, Luiz Capitulino <[email protected]
Quoted 5 lines
Quoted 3 lines · wrote:
I'd certainly like to make this code useful for something other than
developer training.
What code? Where is it at?
Quoted 33 lines
Quoted 33 lines
Quoted 32 lines
Quoted 10 lines
Quoted 5 lines
How about a new monitor command "
thermometer_set" that works like "mouse_move"?
"thermometer_set" would just set the temperature of the "first" thermometer device it finds.Couldn't the device be a parameter?
And I'd suggest
usb_therm_setfor the name.Looking at the existing "
mouse_set" and "mouse_move" monitor commands,
they work on USB, PS/2 and other kinds of mice with "mouse_set" selecting
the mouse device affected by "mouse_move".
So how about a new command "therm_set" which selects the thermometer affected by "therm_temp" ?On a separate note, I understand that if a piece of code is not useful enough
we don't want to merge it to add to the maintenance burden. I still propose 'usb-gotemp' for merging because the fact that gregkh could give his
driver tutorial several years in a roll to sizable audiences shows that there are people out there
interested in getting into Linux driver development.
With this code merged, people could follow the video and slides of his talk
without special hardware and this potentially grows the Linux developer pool.
Quoted 4 lines
Quoted 2 lines
And if Greg decides to change the device he uses for the tutorial, then in a few years it's not so useful anymore?
Well, why don't we ask him?
I don't understand the context here.
There is already an in-kernel driver for the gotemp usb device, that has been there for many many years. Why would you want to write a different one instead?
Yes, I do use a different one for my "write a driver" tutorial, but when I give that class, I note the differences between the userspace interface for that driver, and the one that is already in the kernel.
Quoted 8 lines
Quoted 2 lines
That said, if we position this as an example device, I think that makes sense.
I personally don't think it should be a requirement for inclusion in qemu that it's useful for years on for everyone using it. If there's a big enough group of people using a feature it seems worthwhile. And if Scott went through the trouble of implementing it, I'm pretty sure there is enough of an audience around.
Implementing something I wrote 4 years ago? :)
thanks,
greg k-h
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
Quoted 5 lines · Greg KH
Quoted 4 lines · Alexander Graf
Quoted 1 line · Anthony Liguori
Scott Tsai wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
On Wed, Nov 11, 2009 at 1:06 AM, Luiz Capitulino <[email protected]
Quoted 5 lines
Quoted 3 lines · wrote:
I'd certainly like to make this code useful for something other than
developer training.What code? Where is it at?
It's in this mail thread. It seems like gmane is behind a bit, but it's basically about:
http://thread.gmane.org/gmane.comp.emulators.qemu/55877
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Quoted 32 lines
Quoted 10 lines
Quoted 5 lines
How about a new monitor command "
thermometer_set" that works like "mouse_move"?
"thermometer_set" would just set the temperature of the "first" thermometer device it finds.Couldn't the device be a parameter?
And I'd suggest
usb_therm_setfor the name.Looking at the existing "
mouse_set" and "mouse_move" monitor commands,
they work on USB, PS/2 and other kinds of mice with "mouse_set" selecting
the mouse device affected by "mouse_move".
So how about a new command "therm_set" which selects the thermometer affected by "therm_temp" ?On a separate note, I understand that if a piece of code is not useful enough
we don't want to merge it to add to the maintenance burden. I still propose 'usb-gotemp' for merging because the fact that gregkh could give his
driver tutorial several years in a roll to sizable audiences shows that there are people out there
interested in getting into Linux driver development.
With this code merged, people could follow the video and slides of his talk
without special hardware and this potentially grows the Linux developer pool.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
And if Greg decides to change the device he uses for the tutorial, then in a few years it's not so useful anymore?
Well, why don't we ask him?
I don't understand the context here.
Scott implemented a qemu device emulator for the usb thermal device you're using in your presentation, so people could learn writing usb drivers with qemu.
Alex
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
In reply to Greg KHQuoted 2 lines · Greg KH
What code? Where is it at?
http://patchwork.ozlabs.org/patch/38118/
This code emulates a Vernier Go!Temp device in qemu.
I wrote this to enable people to follow your driver tutorial without buying the gadget.
(I implemented functionality not exercised in your tutorial code like the LED and NV_MEM commands as well)
The current discussion is about whether this code is useful enough to be worth to maintenance burden if merged into qemu.
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
Quoted 6 lines · Scott Tsai
Quoted 2 lines · Greg KH
What code? ??Where is it at?
Quoted 8 lines
This code emulates a Vernier Go!Temp device in qemu.
I wrote this to enable people to follow your driver tutorial without buying the gadget.
(I implemented functionality not exercised in your tutorial code like the LED andNV_MEMcommands as well)The current discussion is about whether this code is useful enough to be worth to maintenance burden if merged into qemu.
Ah, ok, nevermind then, that sounds fine to me. If someone wants to maintain it, go ahead :)
thanks,
greg k-h
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
In reply to Anthony LiguoriQuoted 6 lines · Anthony Liguori
That said, if we position this as an example device, I think that makes sense. But that suggests that we should document the heck out of it and make it a learning experience for QEMU too. It could be an example of how to write a simple QEMU device emulation.
That would be interesting independent of Greg's tutorial.
Thinking about how to document the 'usb-gotemp' code better:
I could improve the comments describing the packet format used by the device.
While writing the code, I remember thinking the methods in USBDeviceInfo are fairly straight forward and getting into USB device development through QEMU is much more pleasant then writing firmware for memory constrained PIC and AVR microcontrollers.
I'll go off to run some errands now, I'm very willing to make any suggested changes.
Re: [Qemu-devel] [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
In reply to Alexander GrafQuoted 2 lines · Alexander Graf
How about having a monitor command to change the temperature, leveraging a "common interface"?
That way in the future real host temperature measurements could maybe get forwarded there too. At least for battery I've had several people ask already if it's possible to read the host battery status (incl. AC status) from inside the VM.
More ACPI functionality, so we can forward ACPI events from the host to the guest, would be welcome indeed.
Signature · 1 line
error compiling committee.c: too many arguments to function
[Qemu-devel] Re: [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
In reply to Scott TsaiQuoted 8 lines · Scott Tsai
Quoted 4 lines
Quoted 2 lines
+ s->temperature++;
You're going to overheat very quickly.
Apart from making the driver work, is this actually useful?I wanted the temperature to change with time to give a sense of "something is happening" ^_^
Quoted 6 lines
The main user I had in mind was someone new to USB and Linux driver development following gregkh's driver tutorial:
http://www.kroah.com/linux/talks/ols_2005_driver_tutorial/
My thinking was that if the temperature never changes, all the USB packets generated in the 'read_int_callback"
part of the driver would seem like a waste of effort.
Change them in the middle of one interval? once then arrived same limit, 40° or so go back to 20°?
Later, JUan.
[Qemu-devel] Re: [PATCH V2 2/3] usb-gotemp: new module emulating a USB thermometer
Quoted 2 lines · Juan Quintela
Change them in the middle of one interval? once then arrived same limit, 40° or so go back to 20°?
I can do this.