/* $Id: drv_LCDLinux.c 773 2007-02-25 12:39:09Z michael $ * $URL: https://ssl.bulix.org/svn/lcd4linux/branches/0.10.1/drv_LCDLinux.c $ * * driver for the LCD-Linux HD44780 kernel driver * http://lcd-linux.sourceforge.net * * 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. * */ /* * * exported fuctions: * * struct DRIVER drv_LCDLinux * */ #include "config.h" #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_LINUX_MAIN #include #include static char Name[] = "LCD-Linux"; static char Device[] = "/dev/lcd"; static int lcdlinux_fd = -1; /****************************************/ /*** hardware dependant functions ***/ /****************************************/ static void drv_LL_send(const char *string, const int len) { int run, ret; for (run = 0; run < 10; run++) { ret = write(lcdlinux_fd, string, len); if (ret >= 0 || errno != EAGAIN) break; if (run > 0) info("%s: write(%s): EAGAIN #%d", Name, Device, run); usleep(1000); } if (ret < 0) { error("%s: write(%s) failed: %s", Name, Device, strerror(errno)); } else if (ret != len) { error("%s: partial write(%s): len=%d ret=%d", Name, Device, len, ret); } return; } static void drv_LL_clear(void) { /* No return value check since this ioctl cannot fail */ ioctl(lcdlinux_fd, LCDL_CLEAR_DISP); } static void drv_LL_write(const int row, const int col, const char *data, int len) { int pos = row * DCOLS + col; if (lseek(lcdlinux_fd, pos, SEEK_SET) == (off_t) - 1) { error("%s: lseek(%s) failed: %s", Name, Device, strerror(errno)); } drv_LL_send(data, len); } static void drv_LL_defchar(const int ascii, const unsigned char *matrix) { char buf[9]; int i; buf[0] = ascii; for (i = 1; i < 9; i++) { buf[i] = *matrix++ & 0x1f; } if (ioctl(lcdlinux_fd, LCDL_SET_CGRAM_CHAR, &buf) != 0) { error("%s: ioctl(LCDL_SET_CGRAM_CHAR) failed: %s", Name, strerror(errno)); } } static int drv_LL_start(const char *section, const int quiet) { char *s; int rows = -1, cols = -1; int use_busy = 0, bus4bits = 0, commit = 0; struct lcd_parameters buf; /* emi
Source: lcd4linux
Section: utils
Priority: extra
Maintainer: Samuel Mimram <samuel.mimram@ens-lyon.org>
Build-Depends: debhelper (>= 4.0.0), xlibs-dev
Standards-Version: 3.6.0

Package: lcd4linux
Architecture: any
Depends: xlibs, ${shlibs:Depends}
Description: Display informations on an external liquid crystal display
 Grab informations from the kernel and some subsystems and display it on an
 external liquid crystal display.
 .
 The use of special sequences (tokens) gives you full control of the layout,
 and therefore lcd4linux is completely independent from the display size.