--- drivers/usb/misc/Kconfig | 10 +++ drivers/usb/misc/Makefile | 3 drivers/usb/misc/gotemp.c | 146 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 158 insertions(+), 1 deletion(-) --- gregkh-2.6.orig/drivers/usb/misc/Kconfig 2005-06-28 16:56:16.000000000 -0700 +++ gregkh-2.6/drivers/usb/misc/Kconfig 2005-06-28 16:56:22.000000000 -0700 @@ -101,6 +101,16 @@ To compile this driver as a module, choose M here: the module will be called cytherm. +config USB_GOTEMP + tristate "GoTemp USB thermometer driver support" + depends on USB + help + Say Y here if you want to connect a GoTemp USB thermometer + device to your computer's USB port. + + To compile this driver as a module, choose M here: the + module will be called gotemp. + config USB_PHIDGETKIT tristate "USB PhidgetKit support" depends on USB --- gregkh-2.6.orig/drivers/usb/misc/Makefile 2005-06-28 16:56:16.000000000 -0700 +++ gregkh-2.6/drivers/usb/misc/Makefile 2005-06-28 16:56:22.000000000 -0700 @@ -7,6 +7,7 @@ obj-$(CONFIG_USB_CYTHERM) += cytherm.o obj-$(CONFIG_USB_EMI26) += emi26.o obj-$(CONFIG_USB_EMI62) += emi62.o +obj-$(CONFIG_USB_GOTEMP) += gotemp.o obj-$(CONFIG_USB_IDMOUSE) += idmouse.o obj-$(CONFIG_USB_LCD) += usblcd.o obj-$(CONFIG_USB_LD) += ldusb.o @@ -18,4 +19,4 @@ obj-$(CONFIG_USB_TEST) += usbtest.o obj-$(CONFIG_USB_USS720) += uss720.o -obj-$(CONFIG_USB_SISUSBVGA) += sisusbvga/ \ No newline at end of file +obj-$(CONFIG_USB_SISUSBVGA) += sisusbvga/ --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ gregkh-2.6/drivers/usb/misc/gotemp.c 2005-06-28 16:56:22.000000000 -0700 @@ -0,0 +1,146 @@ +/* + * USB GoTemp driver + * + * Copyright (C) 2005 Greg Kroah-Hartman (greg@kroah.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation, version 2. + * + */ + +#include +#ifdef CONFIG_USB_DEBUG + #define DEBUG 1 +#endif +#include +#include +#include +#include +#include +#include + + +#define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com" +#define DRIVER_DESC "USB GoTemp driver" + +#define VENDOR_ID 0x08f7 +#define PRODUCT_ID 0x0002 + +/* table of devices that work with this driver */ +static struct usb_device_id id_table [] = { + { USB_DEVICE(VENDOR_ID, PRODUCT_ID) }, + { }, +}; +MODULE_DEVICE_TABLE (usb, id_table); + +struct gotemp { + struct usb_device *udev; + int temperature; +}; + +#define CMD_ID_GET_STATUS 0x10 +#define CMD_ID_WRITE_LOCAL_NV_MEM_1BYTE 0x11 +#define CMD_ID_WRITE_LOCAL_NV_MEM_2BYTES 0x12 +#define CMD_ID_WRITE_LOCAL_NV_MEM_3BYTES 0x13 +#define CMD_ID_WRITE_LOCAL_NV_MEM_4BYTES 0x14 +#define CMD_ID_WRITE_LOCAL_NV_MEM_5BYTES 0x15 +#define CMD_ID_WRITE_LOCAL_NV_MEM_6BYTES 0x16 +#define CMD_ID_READ_LOCAL_NV_MEM 0x17 +#define CMD_ID_START_MEASUREMENTS 0x18 +#define CMD_ID_STOP_MEASUREMENTS 0x19 +#define CMD_ID_INIT 0x1A +#define CMD_ID_SET_MEASUREMENT_PERIOD 0x1B +#define CMD_ID_GET_MEASUREMENT_PERIOD 0x1C +#define CMD_ID_SET_LED_STATE 0x1D +#define CMD_ID_GET_LED_STATE 0x1E +#define CMD_ID_GET_SERIAL_NUMBER 0x20 + + +static void init_dev(struct gotemp *dev) +{ + +} + +static ssize_t show_temp(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct usb_interface *intf = to_usb_interface(dev); + struct gotemp *gotemp = usb_get_intfdata(intf); + + return sprintf(buf, "%d\n", gotemp->temperature); +} + +static DEVICE_ATTR(temp, S_IRUGO, show_temp, NULL); + +static int gotemp_probe(struct usb_interface *interface, const struct usb_device_id *id) +{ + struct usb_device *udev = interface_to_usbdev(interface); + struct gotemp *dev = NULL; + int retval = -ENOMEM; + + dev = kmalloc(sizeof(struct gotemp), GFP_KERNEL); + if (dev == NULL) { + dev_err(&interface->dev, "Out of memory\n"); + goto error; + } + memset (dev, 0x00, sizeof (*dev)); + + dev->udev = usb_get_dev(udev); + + usb_set_intfdata (interface, dev); + +// device_create_file(&interface->dev, &dev_attr_temp); + + dev_info(&interface->dev, "USB GoTemp device now attached\n"); + return 0; + +error: + kfree(dev); + return retval; +} + +static void gotemp_disconnect(struct usb_interface *interface) +{ + struct gotemp *dev; + + dev = usb_get_intfdata (interface); + usb_set_intfdata (interface, NULL); + +// device_remove_file(&interface->dev, &dev_attr_temp); + + usb_put_dev(dev->udev); + + kfree(dev); + + dev_info(&interface->dev, "USB GoTemp now disconnected\n"); +} + +static struct usb_driver gotemp_driver = { + .owner = THIS_MODULE, + .name = "gotemp", + .probe = gotemp_probe, + .disconnect = gotemp_disconnect, + .id_table = id_table, +}; + +static int __init gotemp_init(void) +{ + int retval = 0; + + retval = usb_register(&gotemp_driver); + if (retval) + err("usb_register failed. Error number %d", retval); + return retval; +} + +static void __exit gotemp_exit(void) +{ + usb_deregister(&gotemp_driver); +} + +module_init (gotemp_init); +module_exit (gotemp_exit); + +MODULE_AUTHOR(DRIVER_AUTHOR); +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_LICENSE("GPL");