/* $Id: drv_Trefon.c,v 1.2 2005/04/24 05:27:09 reinelt Exp $ * * driver for TREFON USB LCD displays * * Copyright (C) 2005 Michael Reinelt * Copyright (C) 2005 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_Trefon.c,v $ * Revision 1.2 2005/04/24 05:27:09 reinelt * Trefon Backlight added * * Revision 1.1 2005/04/24 04:33:46 reinelt * driver for TREFON USB LCD's added * */ /* * * exported fuctions: * * struct DRIVER drv_Trefon * */ #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 0xfff0 #define LCD_USB_DEVICE 0xfffe #define PKT_START 0x02 #define PKT_BACKLIGHT 0x01 #define PKT_DATA 0x02 #define PKT_CTRL 0x06 #define PKT_END 0xff static char Name[]="TREFON"; static usb_dev_handle *lcd; static int interface; extern int usb_debug; extern int got_signal; /****************************************/ /*** hardware dependant functions ***/ /****************************************/ static int drv_TF_open (void) { struct usb_bus *busses, *bus; struct usb_device *dev; lcd = NULL; info ("%s: scanning USB for TREFON 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) { if ((dev->descriptor.idVendor == LCD_USB_VENDOR) && (dev->descriptor.idProduct == LCD_USB_DEVICE)) { info ("%s: found TREFON USB LCD on bus %s device %s", Name, bus->dirname, dev->filename); lcd = usb_open(dev); if (usb_set_configuration(lcd, 1) < 0) { error ("%s: usb_set_configuration() failed!", Name); return -1; } interface = 0; if (usb_claim_interface(lcd, interface) < 0) { error ("%s: usb_claim_interface() failed!", Name); return -1; } return 0; } } } return -1; } static int drv_TF_close (void) { usb_release_interface(lcd, interface); usb_close(lcd); return 0; } static void drv_TF_send (char *data, int size) { char buffer[64]; /* the controller always wants a 64-byte packet */ memset (buffer, 0, 64); memcpy (buffer, data, size); // Endpoint hardcoded to 2 usb_bulk_write(lcd, 2, buffer, 64, 2000); } static void drv_TF_command (const unsigned char cmd) { char buffer[4] = { PKT_START, PKT_CTRL, 0, PKT_END }; buffer[2] = cmd; drv_TF_send(buffer, 4); } static void drv_TF_clear (void) { drv_TF_command (0x01); } static void drv_TF_write (const int row, const int col, const char *data, const int len) { char buffer[64]; char *p; int pos; /* 16x4 Displays use a slightly different layout */ if (DCOLS==16 && DROWS==4) { pos = (row%2)*64+(row/2)*16+col; } else { pos = (row%2)*64+(row/2)*20+col; } /* I'd like to combine the GOTO and the data into one packet, * unfortunately the Trefon doesn't like it :-( */ drv_TF_command (0x80|pos); p = buffer; *p++ = PKT_START; *p++ = PKT_DATA; *p++ = (char) len; for (pos = 0; pos < len; pos++) { *p++ = *data++; } *p++ = PKT_END; drv_TF_send(buffer, len+3); } static void drv_TF_defchar (const int ascii, const unsigned char *matrix) { char buffer[14] = "\002\006x\002x01234567\377"; char *p; int i; p = buffer; *p++ = PKT_START; *p++ = PKT_CTRL; *p++ = 0x40|8*ascii; *p++ = PKT_DATA; *p++ = 8; /* data length */ for (i = 0; i < 8; i++) { *p++ = *matrix++ & 0x1f; } *p++ = PKT_END; drv_TF_send(buffer, 14); } static int drv_TF_backlight (int backlight) { char buffer[4] = { PKT_START, PKT_BACKLIGHT, 0, PKT_END }; if (backlight < 0) backlight = 0; if (backlight > 1) backlight = 1; buffer[2] = backlight; drv_TF_send(buffer, 4); return backlight; } static int drv_TF_start (const char *section, const int quiet) { int backlight; int rows=-1, cols=-1; char *s; s=cfg_get(section, "Size", NULL); if (s==NULL || *s=='\0') { error ("%s: no '%s.Size' entry from %s", Name, section, cfg_source()); return -1; } if (sscanf(s,"%dx%d",&cols,&rows)!=2 || rows<1 || cols<1) { error ("%s: bad %s.Size '%s' from %s", Name, section, s, cfg_source()); free (s); return -1; } DROWS = rows; DCOLS = cols; if (drv_TF_open() < 0
# COMMON
common.product.name = Multiproxy Switch
common.proxy.none = None
common.buttons.cancel = Cancel
common.buttons.load = Load
common.label.proxy = Proxy:

# TOOLBAR
toolbar.proxy.label = Proxy:
toolbar.status = Status:
toolbar.loading = Loading...
toolbar.using = Using
toolbar.using.none = Using No Proxy
toolbar.clickApply = Click apply to use this proxy
toolbar.notApplied = Proxy not applied, switching back to last used proxy

# CONFIRMATIONS
confirm.remove = Are you sure you want to delete this proxy?

# UPGRADE
upgrade.none = No upgrades currently exist
upgrade.install = An upgrade exists.\nWould you like to install it now?


# ERRORS
error.unknown = An unknown error occurred
error.proxy.load = Could not load
error.cookie = Could not clear cookies

error.remove = Could not remove proxy
error.remove.forbidden = You cannot remove this entry.

error.add.empty = The Proxy Label field cannot be empty
error.add.invalid = The Proxy Label field contains invalid characters
error.add.duplicate = That Proxy Label already exists

error.edit.select = Select a proxy to edit
error.edit.forbidden = You cannot edit this entry.

error.update = Could not upgrade

error.prefs.display = You cannot hide both the context menu and toolbar.\nPlease select one

# ANONYMOUS
add.anon.validate.label = You must enter a Proxy Label
add.anon.validate.rotation = You must enter a rotation interval
add.anon.validate.rotation.type = The rotation interval must be a number
add.anon.validate.remove = Please select an item to remove
add.anon.validate.empty = Enter a proxy into the field
add.anon.validate.duplicate = This proxy already exists in your list
add.anon.validate.domain = This is an invalid IP or domain name
add.anon.import.file.validate.empty = This file did not list any valid proxies
add.anon.import.url.validate.empty = This url did not list any valid proxies
add.anon.import.validate.old = No new proxies were found

anon.config.empty = No Proxies have been added to this anonymous configuration.