/* $Id: drv_BWCT.c,v 1.6 2006/01/30 06:25:48 reinelt Exp $ * * new style driver for BWCT USB LCD displays * * Copyright (C) 2003 Michael Reinelt * Copyright (C) 2004 The LCD4Linux Team * * This file is part of LCD4Linux. * * LCD4Linux 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; either version 2, or (at your option) * any later version. * * LCD4Linux is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * $Log: drv_BWCT.c,v $ * Revision 1.6 2006/01/30 06:25:48 reinelt * added CVS Revision * * Revision 1.5 2006/01/05 15:53:45 nicowallmeier * fixed compatility with gcc 2.95 * * Revision 1.4 2005/12/11 14:55:28 reinelt * contrast range for BWCT is 0..255, not 0..100 * * Revision 1.3 2005/05/08 04:32:43 reinelt * CodingStyle added and applied * * Revision 1.2 2005/01/18 06:30:22 reinelt * added (C) to all copyright statements * * Revision 1.1 2004/09/24 21:41:00 reinelt * new driver for the BWCT USB LCD interface board. * */ /* * * exported fuctions: * * struct DRIVER drv_BWCT * */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include "debug.h" #include "cfg.h" #include "qprintf.h" #include "plugin.h" #include "widget.h" #include "widget_text.h" #include "widget_icon.h" #include "widget_bar.h" #include "drv.h" #include "drv_generic_text.h" #define LCD_USB_VENDOR 0x03da #define LCD_USB_DEVICE 0x0002 #define LCD_RESET 1 #define LCD_CMD 2 #define LCD_DATA 3 #define LCD_CONTRAST 4 static char Name[] = "BWCT"; static usb_dev_handle *lcd; static int interface; extern int usb_debug; extern int got_signal; /****************************************/ /*** hardware dependant functions ***/ /****************************************/ static int drv_BW_open(void) { struct usb_bus *busses, *bus; struct usb_device *dev; lcd = NULL; info("%s: scanning USB for BWCT LCD...", Name); usb_debug = 0; usb_init(); usb_find_busses(); usb_find_devices(); busses = usb_get_busses(); for (bus = busses; bus; bus = bus->next) { for (dev = bus->devices; dev; dev = dev->next) { int c; if (dev->descriptor.idVendor != LCD_USB_VENDOR) continue; /* Loop through all of the configurations */ for (c = 0; c < dev->descriptor.bNumConfigurations; c++) { int i; for (i = 0; i < dev->config[c].bNumInterfaces; i++) { int a; for (a = 0; a < dev->config[c].interface[i].num_altsetting; a++) { if ((dev->descriptor.idProduct == LCD_USB_DEVICE) || ((dev->config[c].interface[i].altsetting[a].bInterfaceClass == 0xff) && (dev->config[c].interface[i].altsetting[a].bInterfaceSubClass == 0x01))) { info("%s: found BWCT USB LCD on bus %s device %s", Name, bus->dirname, dev->filename); interface = i; lcd = usb_open(dev); if (usb_claim_interface(lcd, interface) < 0) { error("%s: usb_claim_interface() failed!", Name); return -1; } return 0; } } } } } } return -1; } static int drv_BW_close(void) { usb_release_interface(lcd, interface); usb_close(lcd); return 0; } static int drv_BW_
/* $Id$
 * $URL$
 *
 * generic driver helper for keypads
 *
 * Copyright (C) 2006 Chris Maj <cmaj@freedomcorpse.com>
 * Copyright (C) 2006 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
 *
 * 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; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

#ifndef _DRV_GENERIC_KEYPAD_H_
#define _DRV_GENERIC_KEYPAD_H_

#include "widget.h"

/* these functions must be implemented by the real driver */
extern int (*drv_generic_keypad_real_press) (const int num);

/* generic functions and widget callbacks */
int drv_generic_keypad_init(const char *section, const char *driver);
int drv_generic_keypad_press(const int num);
int drv_generic_keypad_quit(void);

#endif