/* $Id$ * $URL$ * * driver for the "Router Board LCD port" * see port details at http://www.routerboard.com * * Copyright (C) 2004 Roman Jozsef * Copyright (C) 2004 The LCD4Linux Team * * based on the HD44780 parallel port driver and RB SDK example * * 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. * */ /* This particulary board not have paralell port but have a special LCD header * where can connect an HD44780 display. * This port called IOSC0 port, and is write only, this port control the * 4 leds on board too. * Because its a write only port you can't control leds outside lcd driver * or inverse, for this added the socket controlled leds. To send led status * simply open an UDP socket and send to localhost 127.0.0.1 port 3333 one * byte or more anyway only the first byte 4 low bits used the others is * cleared and ignored bit0 = Led1 ,bit1 = Led2 ... * This socket polled via timer callback, for detail see at drv_RB_start() * I add at to end of this file an example! * If you don't want coment #define RB_WITH LEDS and this part will be ignored * * The connection details: * The IOCS0 port lower 16 bits connected as follows: * bit LCD LEDS * 0..7 data * 8 INITX * 9 SLINX * 10 AFDX * 11 backlit * 12 LED1 * 13 LED2 * 14 LED3 * 15 LED4 * * LCD male header: * 1 Vcc +5V * 2 GND * 3 RS (Register Select,AFDX) * 4 Contrast adjust (controlled) but how? if you know tell me not mentioned on User Manual * 5 E (enable signal, INITX) * 6 R/W (Data read/write or SLINX) not used connect LCD pin to ground * 7 Data 1 * 8 Data 0 * 9 Data 3 * 10 Data 2 * 11 Data 5 * 12 Data 4 * 13 Data 7 * 14 Data 6 * 15 Backlit GND (controlled) (IOSC0 bit 11) * 16 Backlit Vcc +5V * * If you using this driver and board and you have any fun device connected, * program or story :-) ,please share for me. Thanks. * * Literature * [GEODE] Geode SC1100 Information Appliance On a Chip * (http://www.national.com/ds/SC/SC1100.pdf) * [RB User Manual] * (http://www.routerboard.com) * * * Revision 1.2 * Added backlight control */ /* * * exported fuctions: * * struct DRIVER drv_RouterBoard * */ #include "config.h" #include #include #include #include #include #include #include "debug.h" #include "cfg.h" #include "udelay.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" #include "drv_generic_gpio.h" /* #define RB_WITH_LEDS 1 */ #ifdef RB_WITH_LEDS /* Build without socket&led support */ #include #include #include #define POLL_TIMEOUT 10 /* Socket poll timeout */ #define MAXMSG_SIZE 100 /* Max messagge we can receive */ static int sock_c; /* Socket handler */ static struct sockaddr_in *sacl; char sock_msg[MAXMSG_SIZE]; #endif static char Name[] = "RouterBoard"; static int Model; static int Capabilities; /* RouterBoard control signals */ #define LCD_INITX 0x0100 #define LCD_SLINX 0x0200 #define LCD_AFDX 0x0400 #define LCD_BACKLIGHT 0x0800 #define RB_LEDS 0xF000 #define CAR 0x0CF8 #define CDR 0x0CFC /* HD44780 execution timings [microseconds] * as these values differ from spec to spec, * we use the wors
#!/bin/sh

# ftpupload
#
# Copyright (C) 2012 Jonathan McCrohan

USERNAME=`/usr/bin/ftphelper --username`
PASSWORD=`/usr/bin/ftphelper --password`
SERVER=`/usr/bin/ftphelper --server`
REMOTEDIRECTORY=`/usr/bin/ftphelper --directory`

# current file to be uploaded 
CURRENTLOG=`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='1 days ago'`"_00_00_00.log"

# upload previous 6 days for redundancy
TWODAYLOG=`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='2 days ago'`"_00_00_00.log"
THREEDAYLOG=`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='3 days ago'`"_00_00_00.log"
FOURDAYLOG=`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='4 days ago'`"_00_00_00.log"
FIVEDAYLOG=`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='5 days ago'`"_00_00_00.log"
SIXDAYLOG=`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='6 days ago'`"_00_00_00.log"
SEVENDAYLOG=`/usr/bin/ftphelper --mac`"_"`date +%Y_%m_%d --date='7 days ago'`"_00_00_00.log"

# move file to archive
mv $CURRENTLOG /var/modbuslog/archive/

# mput is dumb, and if we don't cd to the directory,
# it will try to save file to /var/modbuslog/MAC.....log on ftp remote
cd /var/modbuslog/archive/

# login to remote server and upload
ftp -n -v -i $SERVER <<EOF
user $USERNAME $PASSWORD
cd $REMOTEDIRECTORY
mput $CURRENTLOG
mput $TWODAYLOG
mput $THREEDAYLOG
mput $FOURDAYLOG
mput $FIVEDAYLOG
mput $SIXDAYLOG
mput $SEVENDAYLOG
bye
EOF

# remove files after 3 months
CLEANUP="/var/modbus/archive/"`/usr/bin/ftphelper --mac`"_"`date +%Y_%m --date='4 months ago'`"*.log"
rm $CLEANUP
= drv_generic_text_draw; widget_register(&wc); /* register icon widget */ wc = Widget_Icon; wc.draw = drv_generic_text_icon_draw; widget_register(&wc); /* register bar widget */ wc = Widget_Bar; wc.draw = drv_generic_text_bar_draw; widget_register(&wc); /* register plugins */ AddFunction("LCD::backlight", -1, plugin_backlight); return 0; } /* close driver & display */ int drv_RB_quit(const int quiet) { info("%s: shutting down.", Name); drv_generic_text_quit(); drv_generic_gpio_quit(); /* clear *both* displays */ drv_RB_clear(); /* say goodbye... */ if (!quiet) { drv_generic_text_greet("goodbye!", NULL); } #ifdef RB_WITH_LEDS close(sock_c); free(sacl); /*close network socket */ #endif return (0); } DRIVER drv_RouterBoard = { .name = Name, .list = drv_RB_list, .init = drv_RB_init, .quit = drv_RB_quit, }; #if 0 Simple example to send led status to port 3333 #include #include #include int send_packet(unsigned char leds) { struct sockaddr_in *sas; int sock; char msg[20]; msg[0] = leds; msg[1] = 0; if ((sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { fprintf(stderr, "Socket option failed.\n"); return -1; } if ((sas = (struct sockaddr_in *) malloc(sizeof(struct sockaddr_in))) == NULL) return -1; memset(sas, 0, sizeof(struct sockaddr_in)); sas->sin_family = AF_INET; sas->sin_port = htons(3333); sas->sin_addr.s_addr = inet_addr("127.0.0.1"); if (sendto(sock, msg, 6, 0, (struct sockaddr *) sas, sizeof(struct sockaddr_in)) > 0) { free(sas); return 1; } /* sent ok to dest */ free(sas); return -1; /* Send failed */ } int main() { send_packet(0x03); return 0; } #endif