new driver mx5000 for Logitech MX5000 keyboards (Christian Jodar)
This commit is contained in:
@@ -242,6 +242,9 @@ Thomas Jarosch
|
||||
- HD44780 connection type for a USB connection via a FTDI FT2232D chip
|
||||
- i2500vfd driver
|
||||
|
||||
Christian Jodar
|
||||
- mx5000 driver
|
||||
|
||||
|
||||
|
||||
Further developers in the sourceforge lcdproc team:
|
||||
|
||||
@@ -46,6 +46,7 @@ v.0.5dev (ongoing development)
|
||||
* hd44780 driver: more complete initialization (idea by Pierre Ossman)
|
||||
* hd44780 driver: "euro" character mapping table (Markus Dolze)
|
||||
* CwLnx driver: support for CW12832
|
||||
+ new driver mx5000 for Logitech MX5000 keyboards (Christian Jodar)
|
||||
|
||||
v.0.5.2
|
||||
* fix switching on/off the Load screen in lcdproc client using the menu
|
||||
|
||||
@@ -47,7 +47,7 @@ DriverPath=server/drivers/
|
||||
# bayrad, CFontz, CFontz633, CFontzPacket, curses, CwLnx, ea65,
|
||||
# EyeboxOne, g15, glcdlib, glk, hd44780, icp_a106, imon, IOWarrior,
|
||||
# irman, joy, lb216, lcdm001, lcterm, lirc, MD8800, ms6931, mtc_s16209x,
|
||||
# MtxOrb, NoritakeVFD, picolcd, pyramid, sed1330, sed1520, serialPOS,
|
||||
# MtxOrb, mx5000, NoritakeVFD, picolcd, pyramid, sed1330, sed1520, serialPOS,
|
||||
# serialVFD, shuttleVFD, sli, stv5730, svga, t6963, text, tyan, ula200,
|
||||
# xosd
|
||||
Driver=curses
|
||||
@@ -734,6 +734,16 @@ keypad_test_mode=no
|
||||
|
||||
|
||||
|
||||
## mx5000 driver for LCD display on the Logitech MX5000 keyboard ##
|
||||
[mx5000]
|
||||
|
||||
# Select the output device to use [default: /dev/hiddev0]
|
||||
Device = /dev/hiddev0
|
||||
# Time to wait in ms after the refresh screen has been sent [default: 1000]
|
||||
WaitAfterRefresh = 1000
|
||||
|
||||
|
||||
|
||||
## Noritake VFD driver ##
|
||||
[NoritakeVFD]
|
||||
# device where the VFD is. Usual values are /dev/ttyS0 and /dev/ttyS1 [default: /dev/lcd]
|
||||
|
||||
+18
-2
@@ -11,7 +11,7 @@ AC_ARG_ENABLE(drivers,
|
||||
[ bayrad,CFontz,CFontz633,CFontzPacket,curses,CwLnx,ea65,]
|
||||
[ EyeboxOne,g15,glcdlib,glk,hd44780,icp_a106,imon,IOWarrior,]
|
||||
[ irman,joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,ms6931,]
|
||||
[ mtc_s16209x,MtxOrb,NoritakeVFD,picolcd,pyramid,sed1330,]
|
||||
[ mtc_s16209x,MtxOrb,mx5000,NoritakeVFD,picolcd,pyramid,sed1330,]
|
||||
[ sed1520,serialPOS,serialVFD,shuttleVFD,sli,stv5730,svga,]
|
||||
[ t6963,text,tyan,ula200,xosd,i2500vfd]
|
||||
[ 'all' compiles all drivers;]
|
||||
@@ -19,7 +19,7 @@ AC_ARG_ENABLE(drivers,
|
||||
drivers="$enableval",
|
||||
drivers=[bayrad,CFontz,CFontz633,curses,CwLnx,glk,lb216,lcdm001,MtxOrb,pyramid,text])
|
||||
|
||||
allDrivers=[bayrad,CFontz,CFontz633,CFontzPacket,curses,CwLnx,ea65,EyeboxOne,g15,glcdlib,glk,hd44780,icp_a106,imon,IOWarrior,irman,joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,ms6931,mtc_s16209x,MtxOrb,NoritakeVFD,picolcd,pyramid,sed1330,sed1520,serialPOS,serialVFD,shuttleVFD,sli,stv5730,svga,t6963,text,tyan,ula200,xosd,i2500vfd]
|
||||
allDrivers=[bayrad,CFontz,CFontz633,CFontzPacket,curses,CwLnx,ea65,EyeboxOne,g15,glcdlib,glk,hd44780,icp_a106,imon,IOWarrior,irman,joy,lb216,lcdm001,lcterm,lirc,lis,MD8800,ms6931,mtc_s16209x,MtxOrb,mx5000,NoritakeVFD,picolcd,pyramid,sed1330,sed1520,serialPOS,serialVFD,shuttleVFD,sli,stv5730,svga,t6963,text,tyan,ula200,xosd,i2500vfd]
|
||||
|
||||
drivers=`echo $drivers | sed -e 's/,/ /g'`
|
||||
|
||||
@@ -308,6 +308,21 @@ dnl else
|
||||
DRIVERS="$DRIVERS MtxOrb${SO}"
|
||||
actdrivers=["$actdrivers MtxOrb"]
|
||||
;;
|
||||
mx5000)
|
||||
AC_CHECK_HEADERS([libmx5000/mx5000.h],[
|
||||
AC_CHECK_LIB(mx5000, mx5000_sc_new_static,[
|
||||
LIBMX5000="-lmx5000"
|
||||
DRIVERS="$DRIVERS mx5000${SO}"
|
||||
actdrivers=["$actdrivers mx5000"]
|
||||
],[
|
||||
dnl else
|
||||
AC_MSG_WARN([The mx5000 driver needs the mx5000tools library])
|
||||
])
|
||||
],[
|
||||
dnl else
|
||||
AC_MSG_WARN([The mx5000 driver needs libmx5000/mx5000.h])
|
||||
])
|
||||
;;
|
||||
NoritakeVFD)
|
||||
DRIVERS="$DRIVERS NoritakeVFD${SO}"
|
||||
actdrivers=["$actdrivers NoritakeVFD"]
|
||||
@@ -454,6 +469,7 @@ AC_SUBST(LIBGLCD)
|
||||
AC_SUBST(LIBFTDI)
|
||||
AC_SUBST(LIBXOSD)
|
||||
AC_SUBST(LIBPTHREAD_LIBS)
|
||||
AC_SUBST(LIBMX5000)
|
||||
])
|
||||
|
||||
|
||||
|
||||
@@ -210,6 +210,9 @@ MTC_S16209x LCD displays by Microtips Technology Inc
|
||||
.B MtxOrb
|
||||
Matrix Orbital displays (except Matrix Orbital GLK displays)
|
||||
.TP
|
||||
.B mx5000
|
||||
LCD display on the Logitech MX5000 keyboard
|
||||
.TP
|
||||
.B NoritakeVFD
|
||||
Noritake VFD Device CU20045SCPB-T28A
|
||||
.TP
|
||||
|
||||
@@ -33,6 +33,7 @@ well as the configuration of LCDd.
|
||||
&ms6931;
|
||||
&mtc_s16209x;
|
||||
&MtxOrb;
|
||||
&mx5000;
|
||||
&NoritakeVFD;
|
||||
&picolcd;
|
||||
&pylcd;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<sect1 id="mx5000-howto">
|
||||
<title>The MX5000 Driver</title>
|
||||
|
||||
<para>
|
||||
This section talks about using LCDproc with LCD displays on Logitech MX5000
|
||||
keyboards.
|
||||
</para>
|
||||
|
||||
<sect2 id="mx5000-features">
|
||||
<title>Features</title>
|
||||
|
||||
<para>
|
||||
This drivers uses the library from mx5000tools.
|
||||
</para>
|
||||
|
||||
</sect2>
|
||||
|
||||
<sect2 id="mx5000-config">
|
||||
<title>Configuration in LCDd.conf</title>
|
||||
|
||||
<sect3 id="mx5000-config-section">
|
||||
<title>[mx5000]</title>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>Device</command> =
|
||||
<arg choice="plain"><replaceable>DEVICE</replaceable></arg>
|
||||
</term>
|
||||
<listitem><para>
|
||||
Select the output device to use [default: <filename>/dev/hiddev0</filename>]
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<command>WaitAfterRefresh</command> =
|
||||
<arg choice="plain"><replaceable>MS</replaceable></arg>
|
||||
</arg>
|
||||
</term>
|
||||
<listitem><para>
|
||||
Set the time (in ms) to wait after each screen sent to the keyboard.
|
||||
Default is 1000ms.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
</sect3>
|
||||
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
<!ENTITY ms6931 SYSTEM "drivers/ms6931.docbook">
|
||||
<!ENTITY mtc_s16209x SYSTEM "drivers/mtc_s16209x.docbook">
|
||||
<!ENTITY MtxOrb SYSTEM "drivers/mtxorb.docbook">
|
||||
<!ENTITY mx5000 SYSTEM "drivers/mx5000.docbook">
|
||||
<!ENTITY NoritakeVFD SYSTEM "drivers/NoritakeVFD.docbook">
|
||||
<!ENTITY picolcd SYSTEM "drivers/picolcd.docbook">
|
||||
<!ENTITY pylcd SYSTEM "drivers/pylcd.docbook">
|
||||
|
||||
@@ -19,7 +19,7 @@ AM_LDFLAGS = @LDSHARED@
|
||||
#LIBS =
|
||||
|
||||
pkglib_PROGRAMS = @DRIVERS@
|
||||
EXTRA_PROGRAMS = bayrad CFontz CFontz633 CFontzPacket curses CwLnx ea65 EyeboxOne g15 glcdlib glk hd44780 icp_a106 imon IOWarrior irman joy lb216 lcdm001 lcterm lirc lis MD8800 ms6931 mtc_s16209x MtxOrb NoritakeVFD picolcd pyramid sed1330 sed1520 serialPOS serialVFD shuttleVFD stv5730 svga t6963 text tyan sli ula200 xosd i2500vfd
|
||||
EXTRA_PROGRAMS = bayrad CFontz CFontz633 CFontzPacket curses CwLnx ea65 EyeboxOne g15 glcdlib glk hd44780 icp_a106 imon IOWarrior irman joy lb216 lcdm001 lcterm lirc lis MD8800 ms6931 mtc_s16209x MtxOrb mx5000 NoritakeVFD picolcd pyramid sed1330 sed1520 serialPOS serialVFD shuttleVFD stv5730 svga t6963 text tyan sli ula200 xosd i2500vfd
|
||||
noinst_LIBRARIES = libLCD.a libbignum.a
|
||||
|
||||
IOWarrior_CFLAGS = @LIBUSB_CFLAGS@ $(AM_CFLAGS)
|
||||
@@ -50,6 +50,7 @@ lis_LDADD = libLCD.a @LIBFTDI_LIBS@ @LIBUSB_LIBS@ @LIBPTHREAD_LIBS@ lib
|
||||
MD8800_LDADD = libLCD.a
|
||||
mtc_s16209x_LDADD = libLCD.a
|
||||
MtxOrb_LDADD = libLCD.a libbignum.a
|
||||
mx5000_LDADD = libLCD.a @LIBMX5000@
|
||||
NoritakeVFD_LDADD = libLCD.a libbignum.a
|
||||
picolcd_LDADD = @LIBUSB_LIBS@ libLCD.a libbignum.a
|
||||
pyramid_LDADD = libLCD.a
|
||||
@@ -95,6 +96,7 @@ MD8800_SOURCES = lcd.h lcd_lib.h MD8800.c MD8800.h report.h
|
||||
ms6931_SOURCES = lcd.h lcd_lib.h ms6931.h ms6931.c report.h
|
||||
mtc_s16209x_SOURCES = lcd.h lcd_lib.h mtc_s16209x.c mtc_s16209x.h report.h
|
||||
MtxOrb_SOURCES = lcd.h lcd_lib.h MtxOrb.c MtxOrb.h report.h adv_bignum.h
|
||||
mx5000_SOURCES = lcd.h mx5000.c mx5000.h report.h
|
||||
NoritakeVFD_SOURCES = lcd.h lcd_lib.h NoritakeVFD.c NoritakeVFD.h report.h adv_bignum.h
|
||||
picolcd_SOURCES = lcd.h picolcd.h picolcd.c report.h
|
||||
pyramid_SOURCES = lcd.h pylcd.c pylcd.h
|
||||
|
||||
@@ -0,0 +1,404 @@
|
||||
/* This is the LCDproc driver header for the Logitech MX5000 keyboard
|
||||
|
||||
Author: Christian Jodar (tian@gcstar.org)
|
||||
|
||||
Copyright (C) 2008 Christian Jodar
|
||||
|
||||
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 of the License, or
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 */
|
||||
|
||||
/* Based on mx5000 tools http://home.gna.org/mx5000tools/ */
|
||||
|
||||
/*
|
||||
* Driver status
|
||||
* 02/01/2008: First test version
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <libmx5000/mx5000.h>
|
||||
#include <libmx5000/mx5000screencontent.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "lcd.h"
|
||||
#include "mx5000.h"
|
||||
#include "report.h"
|
||||
#include "lcd_lib.h"
|
||||
|
||||
|
||||
/* Internal functions */
|
||||
|
||||
/*
|
||||
* Prepare a static screen
|
||||
*/
|
||||
MODULE_EXPORT int
|
||||
mx5000_init (Driver *drvthis, char *args)
|
||||
{
|
||||
PrivateData *p;
|
||||
|
||||
/* Allocate and store private data */
|
||||
p = (PrivateData *) calloc(1, sizeof(PrivateData));
|
||||
if (p == NULL)
|
||||
return -1;
|
||||
if (drvthis->store_private_ptr(drvthis, p))
|
||||
return -1;
|
||||
|
||||
/* initialize private data */
|
||||
p->fd = -1;
|
||||
p->sc = NULL;
|
||||
|
||||
debug(RPT_INFO, "mx5000: init(%p,%s)", drvthis, args);
|
||||
|
||||
/* Read config file */
|
||||
/* Which hiddev device should be used */
|
||||
strncpy(p->device, drvthis->config_get_string(drvthis->name, "Device", 0, DEFAULT_DEVICE), sizeof(p->device));
|
||||
p->device[sizeof(p->device)-1] = '\0';
|
||||
debug(RPT_INFO,"%s: using Device %s", drvthis->name, p->device);
|
||||
|
||||
p->wait = drvthis->config_get_int(drvthis->name, "WaitAfterRefresh", 0, DEFAULT_WAIT);
|
||||
|
||||
p->fd = mx5000_open_path(p->device);
|
||||
if (p->fd == -1)
|
||||
{
|
||||
report(RPT_ERR, "%s: open(%s) failed (%s)",
|
||||
drvthis->name, p->device, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
p->sc = mx5000_sc_new_static();
|
||||
if (! p->sc)
|
||||
{
|
||||
report(RPT_ERR, "%s: creation of screen failed (%s)",
|
||||
drvthis->name, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
report(RPT_DEBUG, "%s: init() done", drvthis->name);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Clean-up
|
||||
*/
|
||||
MODULE_EXPORT void
|
||||
mx5000_close (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
|
||||
if (p != NULL)
|
||||
{
|
||||
// Just to be sure we flushed current command
|
||||
sleep(1);
|
||||
mx5000_reset(p->fd);
|
||||
if (p->sc)
|
||||
{
|
||||
mx5000_sc_free(p->sc);
|
||||
}
|
||||
if (p->fd >= 0)
|
||||
{
|
||||
close(p->fd);
|
||||
}
|
||||
free(p);
|
||||
}
|
||||
drvthis->store_private_ptr(drvthis, NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the display width
|
||||
*/
|
||||
MODULE_EXPORT int
|
||||
mx5000_width (Driver *drvthis)
|
||||
{
|
||||
return SCREEN_WIDTH;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the display height
|
||||
*/
|
||||
MODULE_EXPORT int
|
||||
mx5000_height (Driver *drvthis)
|
||||
{
|
||||
return SCREEN_HEIGHT;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the display's character cell width
|
||||
*/
|
||||
MODULE_EXPORT int
|
||||
mx5000_cellwidth(Driver *drvthis)
|
||||
{
|
||||
return CELL_WIDTH;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Returns the display's character cell height
|
||||
*/
|
||||
MODULE_EXPORT int
|
||||
mx5000_cellheight(Driver *drvthis)
|
||||
{
|
||||
return CELL_HEIGHT;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Flushes all output to the lcd...
|
||||
*/
|
||||
MODULE_EXPORT void
|
||||
mx5000_flush (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
|
||||
/*
|
||||
We could only update the needed part. But it would be hard to really
|
||||
figure out what has been changed
|
||||
*/
|
||||
|
||||
if (p->changed)
|
||||
{
|
||||
mx5000_sc_send(p->sc, p->fd);
|
||||
p->changed = 0;
|
||||
// The screen seems to be unable to react quickly
|
||||
usleep(1000 * p->wait);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Prints a character on the lcd display, at position (x,y).
|
||||
* The upper-left is (1,1), and the lower right should be (16,4).
|
||||
*/
|
||||
MODULE_EXPORT void
|
||||
mx5000_chr (Driver *drvthis, int x, int y, char c)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
char str[2];
|
||||
// The position should be given in pixels
|
||||
int px, py;
|
||||
|
||||
if ((x <= 0) || (y <= 0) || (x > SCREEN_WIDTH) || (y > SCREEN_HEIGHT))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
px = (x - 1) * CELL_WIDTH;
|
||||
py = y * CELL_HEIGHT;
|
||||
|
||||
str[0] = c;
|
||||
str[1] = 0;
|
||||
mx5000_sc_add_text(p->sc, str, -1, STATIC, py, px);
|
||||
p->changed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prints a string on the lcd display, at position (x,y). The
|
||||
* upper-left is (1,1), and the lower right should be (16,4).
|
||||
*/
|
||||
MODULE_EXPORT void
|
||||
mx5000_string (Driver *drvthis, int x, int y, const char string[])
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
int actual_len;
|
||||
// The position should be given in pixels
|
||||
int px, py;
|
||||
|
||||
if ((x <= 0) || (y <= 0) || (x > SCREEN_WIDTH) || (y > SCREEN_HEIGHT))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
actual_len = strlen(string);
|
||||
// If the string is too long, it is cut
|
||||
if ((actual_len + x - 1) > SCREEN_WIDTH)
|
||||
{
|
||||
actual_len = SCREEN_WIDTH - x + 1;
|
||||
}
|
||||
|
||||
px = (x - 1) * CELL_WIDTH;
|
||||
py = y * CELL_HEIGHT;
|
||||
|
||||
mx5000_sc_add_text(p->sc, string, actual_len, STATIC, py, px);
|
||||
p->changed = 1;
|
||||
//printf("Added %s on %d,%d\n",string,x,y);
|
||||
}
|
||||
|
||||
/*
|
||||
* Sets the backlight on or off.
|
||||
* Not supported
|
||||
*/
|
||||
MODULE_EXPORT void
|
||||
mx5000_backlight (Driver *drvthis, int on)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Draws a horizontal bar to the right.
|
||||
*/
|
||||
MODULE_EXPORT void
|
||||
mx5000_hbar (Driver *drvthis, int x, int y, int len, int promille, int options)
|
||||
{
|
||||
/* x and y are the start position of the bar.
|
||||
* The bar by default grows in the 'right' direction
|
||||
* (other direction not yet implemented).
|
||||
* len is the number of characters that the bar is long at 100%
|
||||
* promille is the number of promilles (0..1000) that the bar should be filled.
|
||||
*/
|
||||
PrivateData *p = drvthis->private_data;
|
||||
// The position should be given in pixels
|
||||
int px, py;
|
||||
//printf("Bar : %d, %d, %d, %d, %d\n", x, y, len, promille, options);
|
||||
px = (x - 1) * CELL_WIDTH;
|
||||
py = y * CELL_HEIGHT;
|
||||
|
||||
mx5000_sc_add_progress_bar(p->sc,
|
||||
promille * len / 1000,
|
||||
len,
|
||||
STATIC,
|
||||
py,
|
||||
px);
|
||||
p->changed = 1;
|
||||
}
|
||||
|
||||
MODULE_EXPORT void
|
||||
mx5000_num (Driver *drvthis, int x, int num)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
int px, py;
|
||||
char text[10];
|
||||
px = (x - 1) * CELL_WIDTH;
|
||||
py = 33;
|
||||
|
||||
if (num < 10)
|
||||
{
|
||||
sprintf(text, "%d", num);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(text, ":");
|
||||
px -= CELL_WIDTH;
|
||||
}
|
||||
|
||||
//printf("Display %s on %d, %d\n", text, px, py);
|
||||
|
||||
mx5000_sc_add_text(p->sc, text, -1, STATICHUGE, py, px);
|
||||
}
|
||||
|
||||
MODULE_EXPORT int
|
||||
mx5000_icon(Driver *drvthis, int x, int y, int icon)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
int px, py;
|
||||
enum display_icon mx5000_icon = 0;
|
||||
|
||||
px = (x - 1) * CELL_WIDTH;
|
||||
py = y * CELL_HEIGHT;
|
||||
|
||||
switch (icon)
|
||||
{
|
||||
case ICON_ARROW_UP:
|
||||
mx5000_icon = ARROW_UP;
|
||||
break;
|
||||
case ICON_ARROW_DOWN:
|
||||
mx5000_icon = ARROW_DOWN;
|
||||
break;
|
||||
case ICON_ARROW_LEFT:
|
||||
mx5000_icon = TRIANGLE_LEFT;
|
||||
break;
|
||||
case ICON_ARROW_RIGHT:
|
||||
mx5000_icon = TRIANGLE_RIGHT;
|
||||
break;
|
||||
case ICON_PAUSE:
|
||||
mx5000_icon = PAUSE1;
|
||||
break;
|
||||
case ICON_PLAY:
|
||||
mx5000_icon = TRIANGLE_RIGHT;
|
||||
break;
|
||||
case ICON_NEXT:
|
||||
mx5000_icon = NEXTTRACK1;
|
||||
break;
|
||||
case ICON_REC:
|
||||
mx5000_icon = CIRCLE;
|
||||
break;
|
||||
}
|
||||
if (mx5000_icon)
|
||||
{
|
||||
mx5000_sc_add_icon(p->sc, mx5000_icon, STATIC, py, px);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return -1; /* Let the core do other icons */
|
||||
}
|
||||
}
|
||||
|
||||
MODULE_EXPORT void
|
||||
mx5000_heartbeat(Driver *drvthis, int state)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets number of custom chars (always NUM_CCs)
|
||||
*/
|
||||
MODULE_EXPORT int
|
||||
mx5000_get_free_chars(Driver *drvthis)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Clears the LCD screen
|
||||
*/
|
||||
MODULE_EXPORT void
|
||||
mx5000_clear (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
|
||||
// No way yet (as of 0.1.1) to clear the screen in libmx5000
|
||||
if (p->sc)
|
||||
{
|
||||
mx5000_sc_free(p->sc);
|
||||
}
|
||||
p->sc = mx5000_sc_new_static();
|
||||
if (! p->sc)
|
||||
{
|
||||
report(RPT_ERR, "%s: creation of screen failed (%s)",
|
||||
drvthis->name, strerror(errno));
|
||||
}
|
||||
p->changed = 1;
|
||||
}
|
||||
|
||||
|
||||
MODULE_EXPORT const char *
|
||||
mx5000_get_info (Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = drvthis->private_data;
|
||||
|
||||
memset(p->info, '\0', sizeof(p->info));
|
||||
strcpy(p->info, "Logitech MX 5000 Driver");
|
||||
|
||||
return p->info;
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/* This is the LCDproc driver header for the Logitech MX5000 keyboard
|
||||
|
||||
Author: Christian Jodar (tian@gcstar.org)
|
||||
|
||||
Copyright (C) 2008 Christian Jodar
|
||||
|
||||
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 of the License, or
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 */
|
||||
|
||||
#ifndef LCD_MX5000_H
|
||||
#define LCD_MX5000_H
|
||||
|
||||
#include "lcd.h"
|
||||
|
||||
#define SCREEN_WIDTH 17
|
||||
#define SCREEN_HEIGHT 4
|
||||
#define CELL_WIDTH 6
|
||||
#define CELL_HEIGHT 10
|
||||
#define DEFAULT_DEVICE "/dev/hiddev0"
|
||||
#define DEFAULT_WAIT 1000
|
||||
|
||||
typedef struct driver_private_data {
|
||||
char device[200];
|
||||
int wait;
|
||||
int fd;
|
||||
struct MX5000ScreenContent *sc;
|
||||
char info[255];
|
||||
char changed;
|
||||
} PrivateData;
|
||||
|
||||
|
||||
/* API: variables for the server core */
|
||||
MODULE_EXPORT char *api_version = API_VERSION;
|
||||
MODULE_EXPORT int stay_in_foreground = 0;
|
||||
MODULE_EXPORT int supports_multiple = 0;
|
||||
MODULE_EXPORT char *symbol_prefix = "mx5000_";
|
||||
|
||||
/* API: functions for the server core */
|
||||
MODULE_EXPORT int mx5000_init (Driver *drvthis, char *device);
|
||||
MODULE_EXPORT void mx5000_close (Driver *drvthis);
|
||||
MODULE_EXPORT int mx5000_width (Driver *drvthis);
|
||||
MODULE_EXPORT int mx5000_height (Driver *drvthis);
|
||||
MODULE_EXPORT int mx5000_cellwidth (Driver *drvthis);
|
||||
MODULE_EXPORT int mx5000_cellheight (Driver *drvthis);
|
||||
MODULE_EXPORT void mx5000_clear (Driver *drvthis);
|
||||
MODULE_EXPORT void mx5000_flush (Driver *drvthis);
|
||||
MODULE_EXPORT void mx5000_string (Driver *drvthis, int x, int y, const char string[]);
|
||||
MODULE_EXPORT void mx5000_chr (Driver *drvthis, int x, int y, char c);
|
||||
MODULE_EXPORT void mx5000_hbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||
MODULE_EXPORT void mx5000_heartbeat (Driver *drvthis, int state);
|
||||
MODULE_EXPORT void mx5000_num (Driver *drvthis, int x, int num);
|
||||
MODULE_EXPORT int mx5000_icon(Driver *drvthis, int x, int y, int icon);
|
||||
|
||||
/*
|
||||
MODULE_EXPORT void mx5000_vbar (Driver *drvthis, int x, int y, int len, int promille, int options);
|
||||
MODULE_EXPORT int mx5000_icon(Driver *drvthis, int x, int y, int icon);
|
||||
*/
|
||||
|
||||
MODULE_EXPORT int mx5000_get_free_chars (Driver *drvthis);
|
||||
MODULE_EXPORT void mx5000_set_char (Driver *drvthis, int n, unsigned char *dat);
|
||||
MODULE_EXPORT void mx5000_backlight (Driver *drvthis, int on);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user