|
From: <mla...@us...> - 2006-11-18 13:46:05
|
Revision: 177
http://svn.sourceforge.net/g15daemon/?rev=177&view=rev
Author: mlampard
Date: 2006-11-18 05:46:03 -0800 (Sat, 18 Nov 2006)
Log Message:
-----------
rename lcdlist_t struct to g15daemon_t + one or two other minor cosmetic changes to aid new developers in understanding the code.
Modified Paths:
--------------
trunk/g15daemon-wip/g15daemon/g15_plugins.c
trunk/g15daemon-wip/g15daemon/g15daemon.h
trunk/g15daemon-wip/g15daemon/linked_lists.c
trunk/g15daemon-wip/g15daemon/main.c
trunk/g15daemon-wip/g15daemon/utility_funcs.c
trunk/g15daemon-wip/plugins/g15_plugin_net.c
trunk/g15daemon-wip/plugins/g15_plugin_uinput.c
Modified: trunk/g15daemon-wip/g15daemon/g15_plugins.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/g15_plugins.c 2006-11-18 10:45:54 UTC (rev 176)
+++ trunk/g15daemon-wip/g15daemon/g15_plugins.c 2006-11-18 13:46:03 UTC (rev 177)
@@ -116,7 +116,7 @@
}
if(plugin_args->info->event_handler && plugin_args->type==G15_PLUGIN_CORE_OS_KB){
- lcdlist_t *masterlist = (lcdlist_t*)plugin_args->args;
+ g15daemon_t *masterlist = (g15daemon_t*)plugin_args->args;
pthread_mutex_lock(&lcdlist_mutex);
(masterlist->keyboard_handler) = (void*)plugin_args->info->event_handler;
pthread_mutex_unlock(&lcdlist_mutex);
@@ -165,39 +165,44 @@
return NULL;
}
-int g15_plugin_load (lcdlist_t **displaylist, char *name) {
+int g15_plugin_load (g15daemon_t *masterlist, char *filename) {
void * plugin_handle = NULL;
-
- lcdlist_t *g15daemon_lcds = (lcdlist_t*)&displaylist;
+ config_section_t *plugin_cfg = g15daemon_cfg_load_section(masterlist,"PLUGINS");
pthread_t client_connection;
pthread_attr_t attr;
lcdnode_t *clientnode;
- if((plugin_handle = g15daemon_dlopen_plugin(name,G15_PLUGIN_NONSHARED))!=NULL) {
+ if((plugin_handle = g15daemon_dlopen_plugin(filename,G15_PLUGIN_NONSHARED))!=NULL) {
plugin_t *plugin_args=malloc(sizeof(plugin_t));
plugin_args->info = dlsym(plugin_handle, "g15plugin_info");
dlerror();
if(!plugin_args->info) { /* if it doesnt have a valid struct, we should just load it as a library... but we dont at the moment FIXME */
- g15daemon_log(LOG_ERR,"%s is not a valid g15daemon plugin\n",name);
+ g15daemon_log(LOG_ERR,"%s is not a valid g15daemon plugin\n",filename);
g15daemon_dlclose_plugin(plugin_handle);
dlerror();
return -1;
}
+
+ if(strncasecmp("Load",g15daemon_cfg_read_string(plugin_cfg, plugin_args->info->name,"Load"),5)!=0)
+ {
+ g15daemon_dlclose_plugin(plugin_handle);
+ return -1;
+ }
plugin_args->type = plugin_args->info->type;
/* assign the generic eventhandler if the plugin doesnt provide one - the generic one does nothing atm. FIXME*/
if(plugin_args->info->event_handler==NULL)
plugin_args->info->event_handler = (void*)internal_generic_eventhandler;
-
+
if(plugin_args->type == G15_PLUGIN_LCD_CLIENT) {
- lcdlist_t *foolist = (lcdlist_t*)displaylist;
- /* FIXME we should just sort out the linked list stuff instead of overriding it */
+ g15daemon_t *foolist = (g15daemon_t*)masterlist;
+ /* FIXME we should just sort out the linked list stuff instead of overriding it */
if((int)foolist->numclients>=1){
- clientnode = g15daemon_lcdnode_add((void*)g15daemon_lcds);
+ clientnode = g15daemon_lcdnode_add((void*)masterlist);
}else {
clientnode = foolist->tail;
foolist->numclients++;
@@ -209,25 +214,25 @@
plugin_args->type == G15_PLUGIN_CORE_KB_INPUT ||
plugin_args->type == G15_PLUGIN_LCD_SERVER)
{
- plugin_args->args = displaylist;
+ plugin_args->args = masterlist;
plugin_args->plugin_handle = plugin_handle;
}
- memset(&attr,0,sizeof(pthread_attr_t));
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
- pthread_attr_setstacksize(&attr,64*1024); /* set stack to 64k - dont need 8Mb */
- if (pthread_create(&client_connection, &attr, (void*)plugin_thread, plugin_args) != 0) {
- g15daemon_log(LOG_WARNING,"Unable to create client thread.");
- } else {
- pthread_detach(client_connection);
- }
+ memset(&attr,0,sizeof(pthread_attr_t));
+ pthread_attr_init(&attr);
+ pthread_attr_setdetachstate(&attr,PTHREAD_CREATE_DETACHED);
+ pthread_attr_setstacksize(&attr,64*1024); /* set stack to 64k - dont need 8Mb */
+ if (pthread_create(&client_connection, &attr, (void*)plugin_thread, plugin_args) != 0) {
+ g15daemon_log(LOG_WARNING,"Unable to create client thread.");
+ } else {
+ pthread_detach(client_connection);
+ }
}
return 0;
}
-void g15_open_all_plugins(lcdlist_t **displaylist, char *plugin_directory) {
+void g15_open_all_plugins(g15daemon_t *masterlist, char *plugin_directory) {
DIR *directory;
struct dirent *ep;
@@ -241,7 +246,7 @@
strncat(pluginname,"/",1);
strncat(pluginname,ep->d_name,200);
g15daemon_log(LOG_INFO, "Loading plugin %s",pluginname);
- g15_plugin_load (displaylist, pluginname);
+ g15_plugin_load (masterlist, pluginname);
g15daemon_msleep(20);
}
}
Modified: trunk/g15daemon-wip/g15daemon/g15daemon.h
===================================================================
--- trunk/g15daemon-wip/g15daemon/g15daemon.h 2006-11-18 10:45:54 UTC (rev 176)
+++ trunk/g15daemon-wip/g15daemon/g15daemon.h 2006-11-18 13:46:03 UTC (rev 177)
@@ -54,40 +54,46 @@
* all M&G keys must be handled by the client. If the client dies or exits, normal functions resume. */
#define CLIENT_CMD_KEY_HANDLER 0x10
-/* plugin types - LCD plugins are provided with a lcd_t and keystates via EVENT when visible */
+enum {
+ /* plugin types - LCD plugins are provided with a lcd_t and keystates via EVENT when visible */
/* CORE plugins source and sink events, have no screen associated, and are not able to quit.
- by design they implement core functionality..CORE_LIBRARY implements graphic and other
- functions for use by other plugins.
+ by design they implement core functionality..CORE_LIBRARY implements graphic and other
+ functions for use by other plugins.
*/
-#define G15_PLUGIN_NONE 0
-#define G15_PLUGIN_LCD_CLIENT 1
-#define G15_PLUGIN_CORE_KB_INPUT 2
-#define G15_PLUGIN_CORE_OS_KB 3
-#define G15_PLUGIN_LCD_SERVER 4
+ G15_PLUGIN_NONE = 0,
+ G15_PLUGIN_LCD_CLIENT =1,
+ G15_PLUGIN_CORE_KB_INPUT = 2,
+ G15_PLUGIN_CORE_OS_KB = 3,
+ G15_PLUGIN_LCD_SERVER = 4
+};
+enum {
+ /* plugin RETURN values */
+ G15_PLUGIN_QUIT = -1,
+ G15_PLUGIN_OK = 0
+};
-/* plugin RETURN values */
-#define G15_PLUGIN_QUIT -1
-#define G15_PLUGIN_OK 0
+enum {
+ /* plugin EVENT types */
+ G15_EVENT_KEYPRESS = 1,
+ G15_EVENT_VISIBILITY_CHANGED,
+ G15_EVENT_USER_FOREGROUND,
+ G15_EVENT_MLED,
+ G15_EVENT_BACKLIGHT,
+ G15_EVENT_CONTRAST,
+ G15_EVENT_REQ_PRIORITY,
+ G15_EVENT_CYCLE_PRIORITY,
+ G15_EVENT_EXITNOW,
+ /* core event types */
+ G15_COREVENT_KEYPRESS_IN,
+ G15_COREVENT_KEYPRESS_OUT
+};
-/* plugin EVENT types */
-#define G15_EVENT_KEYPRESS 1
-#define G15_EVENT_VISIBILITY_CHANGED 2
-#define G15_EVENT_USER_FOREGROUND 3
-#define G15_EVENT_MLED 4
-#define G15_EVENT_BACKLIGHT 5
-#define G15_EVENT_CONTRAST 6
-#define G15_EVENT_REQ_PRIORITY 7
-#define G15_EVENT_CYCLE_PRIORITY 8
-#define G15_EVENT_EXITNOW 9
-/* core event types */
-#define G15_COREVENT_KEYPRESS_IN 10
-#define G15_COREVENT_KEYPRESS_OUT 11
+enum {
+ SCR_HIDDEN = 0,
+ SCR_VISIBLE
+};
-
-#define SCR_HIDDEN 0
-#define SCR_VISIBLE 1
-
/* plugin global or local */
enum {
G15_PLUGIN_NONSHARED = 0,
@@ -95,7 +101,7 @@
};
typedef struct lcd_s lcd_t;
-typedef struct lcdlist_s lcdlist_t;
+typedef struct g15daemon_s g15daemon_t;
typedef struct lcdnode_s lcdnode_t;
typedef struct plugin_event_s plugin_event_t;
@@ -146,7 +152,7 @@
typedef struct plugin_s
{
- lcdlist_t *masterlist;
+ g15daemon_t *masterlist;
unsigned int type;
plugin_info_t *info;
void *plugin_handle;
@@ -155,7 +161,7 @@
typedef struct lcd_s
{
- lcdlist_t *masterlist;
+ g15daemon_t *masterlist;
int lcd_type;
unsigned char buf[LCD_BUFSIZE];
int max_x;
@@ -183,14 +189,14 @@
struct lcdnode_s {
- lcdlist_t *list;
+ g15daemon_t *list;
lcdnode_t *prev;
lcdnode_t *next;
lcdnode_t *last_priority;
lcd_t *lcd;
}lcdnode_s;
-struct lcdlist_s
+struct g15daemon_s
{
lcdnode_t *head;
lcdnode_t *tail;
@@ -199,7 +205,7 @@
struct passwd *nobody;
volatile unsigned long numclients;
configfile_t *config;
-}lcdlist_s;
+}g15daemon_s;
pthread_mutex_t lcdlist_mutex;
pthread_mutex_t g15lib_mutex;
@@ -215,24 +221,24 @@
/* create a /var/run/g15daemon.pid file, returning 0 on success else -1 */
int uf_create_pidfile();
/* open & run all plugins in the given directory */
-void g15_open_all_plugins(lcdlist_t **displaylist, char *plugin_directory);
+void g15_open_all_plugins(g15daemon_t *masterlist, char *plugin_directory);
/* linked lists */
-lcdlist_t *ll_lcdlist_init();
-void ll_lcdlist_destroy(lcdlist_t **displaylist);
+g15daemon_t *ll_lcdlist_init();
+void ll_lcdlist_destroy(g15daemon_t **masterlist);
/* open and parse config file */
-int uf_conf_open(lcdlist_t *list, char *filename);
+int uf_conf_open(g15daemon_t *list, char *filename);
/* write the config file with all keys/sections */
-int uf_conf_write(lcdlist_t *list,char *filename);
+int uf_conf_write(g15daemon_t *list,char *filename);
/* free all memory used by the config subsystem */
-void uf_conf_free(lcdlist_t *list);
+void uf_conf_free(g15daemon_t *list);
/* generic handler for net clients */
int internal_generic_eventhandler(plugin_event_t *myevent);
#endif
/* the following functions are available for use by plugins */
/* create a new section */
-config_section_t *g15daemon_cfg_load_section(lcdlist_t *displaylist,char *name);
+config_section_t *g15daemon_cfg_load_section(g15daemon_t *masterlist,char *name);
/* return string value from key in sectionname */
char* g15daemon_cfg_read_string(config_section_t *section, char *key, char *defaultval);
/* return float from key in sectionname */
@@ -257,9 +263,9 @@
/* syslog wrapper */
int g15daemon_log (int priority, const char *fmt, ...);
/* cycle from displayed screen to next on list */
-void g15daemon_lcdnode_cycle(lcdlist_t *displaylist);
+void g15daemon_lcdnode_cycle(g15daemon_t *masterlist);
/* add new screen */
-lcdnode_t *g15daemon_lcdnode_add(lcdlist_t **displaylist) ;
+lcdnode_t *g15daemon_lcdnode_add(g15daemon_t **masterlist) ;
/* remove screen */
void g15daemon_lcdnode_remove (lcdnode_t *oldnode);
Modified: trunk/g15daemon-wip/g15daemon/linked_lists.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/linked_lists.c 2006-11-18 10:45:54 UTC (rev 176)
+++ trunk/g15daemon-wip/g15daemon/linked_lists.c 2006-11-18 13:46:03 UTC (rev 177)
@@ -57,56 +57,56 @@
}
-/* initialise a new displaylist, and add an initial node at the tail (used for the clock) */
-lcdlist_t *ll_lcdlist_init () {
+/* initialise a new masterlist, and add an initial node at the tail (used for the clock) */
+g15daemon_t *ll_lcdlist_init () {
- lcdlist_t *displaylist = NULL;
+ g15daemon_t *masterlist = NULL;
pthread_mutex_init(&lcdlist_mutex, NULL);
pthread_mutex_lock(&lcdlist_mutex);
- displaylist = g15daemon_xmalloc(sizeof(lcdlist_t));
+ masterlist = g15daemon_xmalloc(sizeof(g15daemon_t));
- displaylist->head = g15daemon_xmalloc(sizeof(lcdnode_t));
+ masterlist->head = g15daemon_xmalloc(sizeof(lcdnode_t));
- displaylist->tail = displaylist->head;
- displaylist->current = displaylist->head;
+ masterlist->tail = masterlist->head;
+ masterlist->current = masterlist->head;
- displaylist->head->lcd = ll_create_lcd();
- displaylist->head->lcd->mkey_state = 0;
- displaylist->head->lcd->masterlist = displaylist;
+ masterlist->head->lcd = ll_create_lcd();
+ masterlist->head->lcd->mkey_state = 0;
+ masterlist->head->lcd->masterlist = masterlist;
/* first screen is the clock/menu */
- displaylist->head->lcd->g15plugin->info = NULL;
+ masterlist->head->lcd->g15plugin->info = NULL;
- displaylist->head->prev = displaylist->head;
- displaylist->head->next = displaylist->head;
- displaylist->head->list = displaylist;
- displaylist->keyboard_handler = NULL;
- displaylist->numclients = 0;
+ masterlist->head->prev = masterlist->head;
+ masterlist->head->next = masterlist->head;
+ masterlist->head->list = masterlist;
+ masterlist->keyboard_handler = NULL;
+ masterlist->numclients = 0;
pthread_mutex_unlock(&lcdlist_mutex);
- return displaylist;
+ return masterlist;
}
-lcdnode_t *g15daemon_lcdnode_add(lcdlist_t **displaylist) {
+lcdnode_t *g15daemon_lcdnode_add(g15daemon_t **masterlist) {
lcdnode_t *new = NULL;
pthread_mutex_lock(&lcdlist_mutex);
new = g15daemon_xmalloc(sizeof(lcdnode_t));
- new->prev = (*displaylist)->head;
- new->next = (*displaylist)->tail;
+ new->prev = (*masterlist)->head;
+ new->next = (*masterlist)->tail;
new->lcd = ll_create_lcd();
- new->lcd->masterlist = (*displaylist);
+ new->lcd->masterlist = (*masterlist);
new->last_priority = NULL;
- new->list = *displaylist;
+ new->list = *masterlist;
- (*displaylist)->head->next=new;
- (*displaylist)->current = new;
+ (*masterlist)->head->next=new;
+ (*masterlist)->current = new;
- (*displaylist)->head = new;
- (*displaylist)->head->list = *displaylist;
- (*displaylist)->numclients++;
+ (*masterlist)->head = new;
+ (*masterlist)->head->list = *masterlist;
+ (*masterlist)->numclients++;
pthread_mutex_unlock(&lcdlist_mutex);
@@ -114,9 +114,9 @@
}
/* cycle through connected client displays */
-void g15daemon_lcdnode_cycle(lcdlist_t *displaylist)
+void g15daemon_lcdnode_cycle(g15daemon_t *masterlist)
{
- lcdnode_t *current_screen = displaylist->current;
+ lcdnode_t *current_screen = masterlist->current;
g15daemon_send_event(current_screen->lcd, G15_EVENT_VISIBILITY_CHANGED, SCR_HIDDEN);
do
@@ -124,50 +124,50 @@
pthread_mutex_lock(&lcdlist_mutex);
g15daemon_send_event(current_screen->lcd, G15_EVENT_USER_FOREGROUND, 0);
- if(displaylist->tail == displaylist->current){
- displaylist->current = displaylist->head;
+ if(masterlist->tail == masterlist->current){
+ masterlist->current = masterlist->head;
}else{
- displaylist->current = displaylist->current->prev;
+ masterlist->current = masterlist->current->prev;
}
pthread_mutex_unlock(&lcdlist_mutex);
}
- while (current_screen != displaylist->current);
+ while (current_screen != masterlist->current);
pthread_mutex_lock(&lcdlist_mutex);
- if(displaylist->tail == displaylist->current) {
- displaylist->current = displaylist->head;
+ if(masterlist->tail == masterlist->current) {
+ masterlist->current = masterlist->head;
} else {
- displaylist->current = displaylist->current->prev;
+ masterlist->current = masterlist->current->prev;
}
pthread_mutex_unlock(&lcdlist_mutex);
- g15daemon_send_event(displaylist->current->lcd, G15_EVENT_VISIBILITY_CHANGED, SCR_VISIBLE);
+ g15daemon_send_event(masterlist->current->lcd, G15_EVENT_VISIBILITY_CHANGED, SCR_VISIBLE);
g15daemon_send_event(current_screen->lcd, G15_EVENT_USER_FOREGROUND, 1);
pthread_mutex_lock(&lcdlist_mutex);
- displaylist->current->lcd->state_changed = 1;
- displaylist->current->last_priority = displaylist->current;
+ masterlist->current->lcd->state_changed = 1;
+ masterlist->current->last_priority = masterlist->current;
pthread_mutex_unlock(&lcdlist_mutex);
}
void g15daemon_lcdnode_remove (lcdnode_t *oldnode) {
- lcdlist_t **displaylist = NULL;
+ g15daemon_t **masterlist = NULL;
lcdnode_t **prev = NULL;
lcdnode_t **next = NULL;
pthread_mutex_lock(&lcdlist_mutex);
- displaylist = &oldnode->list;
+ masterlist = &oldnode->list;
prev = &oldnode->prev;
next = &oldnode->next;
ll_quit_lcd(oldnode->lcd);
- (*displaylist)->numclients--;
- if((*displaylist)->current == oldnode) {
- if((*displaylist)->current!=(*displaylist)->head){
- (*displaylist)->current = oldnode->next;
+ (*masterlist)->numclients--;
+ if((*masterlist)->current == oldnode) {
+ if((*masterlist)->current!=(*masterlist)->head){
+ (*masterlist)->current = oldnode->next;
} else {
- (*displaylist)->current = oldnode->prev;
+ (*masterlist)->current = oldnode->prev;
}
- (*displaylist)->current->lcd->state_changed = 1;
+ (*masterlist)->current->lcd->state_changed = 1;
}
if(&oldnode->lcd == (void*)keyhandler) {
@@ -176,12 +176,12 @@
g15daemon_log(LOG_WARNING,"Client key handler quit, going back to defaults");
}
- if((*displaylist)->head!=oldnode){
+ if((*masterlist)->head!=oldnode){
(*next)->prev = oldnode->prev;
(*prev)->next = oldnode->next;
}else{
- (*prev)->next = (*displaylist)->tail;
- (*displaylist)->head = oldnode->prev;
+ (*prev)->next = (*masterlist)->tail;
+ (*masterlist)->head = oldnode->prev;
}
free(oldnode);
@@ -189,17 +189,17 @@
pthread_mutex_unlock(&lcdlist_mutex);
}
-void ll_lcdlist_destroy(lcdlist_t **displaylist) {
+void ll_lcdlist_destroy(g15daemon_t **masterlist) {
int i = 0;
- while ((*displaylist)->head != (*displaylist)->tail) {
+ while ((*masterlist)->head != (*masterlist)->tail) {
i++;
- g15daemon_lcdnode_remove((*displaylist)->head);
+ g15daemon_lcdnode_remove((*masterlist)->head);
}
- free((*displaylist)->tail->lcd);
- free((*displaylist)->tail);
- free(*displaylist);
+ free((*masterlist)->tail->lcd);
+ free((*masterlist)->tail);
+ free(*masterlist);
pthread_mutex_destroy(&lcdlist_mutex);
}
Modified: trunk/g15daemon-wip/g15daemon/main.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/main.c 2006-11-18 10:45:54 UTC (rev 176)
+++ trunk/g15daemon-wip/g15daemon/main.c 2006-11-18 13:46:03 UTC (rev 177)
@@ -77,14 +77,14 @@
}else{
/* hacky attempt to double-time the use of L1, if the key is pressed less than half a second, it cycles the screens. If held for longer, the key is sent to the application for use instead */
lcd_t *lcd = (lcd_t*)caller;
- lcdlist_t* displaylist = lcd->masterlist;
+ g15daemon_t* masterlist = lcd->masterlist;
static unsigned int clicktime;
if(value & cycle_key) {
clicktime=g15daemon_gettime_ms();
}else{
unsigned int unclick=g15daemon_gettime_ms();
if ((unclick-clicktime)<500) {
- g15daemon_lcdnode_cycle(displaylist);
+ g15daemon_lcdnode_cycle(masterlist);
}
else
{
@@ -107,9 +107,9 @@
}
case G15_EVENT_CYCLE_PRIORITY:{
lcd_t *lcd = (lcd_t*)caller;
- lcdlist_t* displaylist = lcd->masterlist;
+ g15daemon_t* masterlist = lcd->masterlist;
if(value)
- g15daemon_lcdnode_cycle(displaylist);
+ g15daemon_lcdnode_cycle(masterlist);
break;
}
case G15_EVENT_REQ_PRIORITY: {
@@ -151,7 +151,7 @@
static void *keyboard_watch_thread(void *lcdlist){
- lcdlist_t *displaylist = (lcdlist_t*)(lcdlist);
+ g15daemon_t *masterlist = (g15daemon_t*)(lcdlist);
unsigned int keypresses = 0;
int retval = 0;
@@ -163,7 +163,7 @@
pthread_mutex_unlock(&g15lib_mutex);
if(retval == G15_NO_ERROR){
- g15daemon_send_event(displaylist->current->lcd,
+ g15daemon_send_event(masterlist->current->lcd,
G15_EVENT_KEYPRESS, keypresses);
}
g15daemon_msleep(10);
@@ -174,12 +174,12 @@
static void *lcd_draw_thread(void *lcdlist){
- lcdlist_t *displaylist = (lcdlist_t*)(lcdlist);
+ g15daemon_t *masterlist = (g15daemon_t*)(lcdlist);
static long int lastlcd = 1;
static unsigned int lastscreentime;
/* unsigned int fps = 0; */
- lcd_t *displaying = displaylist->tail->lcd;
- lcd_t *lastdisplayed=NULL;
+ lcd_t *displaying = masterlist->tail->lcd;
+ char *lastdisplayed=NULL;
memset(displaying->buf,0,1024);
g15daemon_sleep(2);
@@ -187,7 +187,7 @@
while (!leaving) {
pthread_mutex_lock(&lcdlist_mutex);
- displaying = displaylist->current->lcd;
+ displaying = masterlist->current->lcd;
if(displaying->ident != lastlcd){
/* monitor 'fps' - due to the TCP protocol, some frames will be bunched up.
@@ -195,10 +195,10 @@
/* fps = 1000 / (g15daemon_gettime_ms() - lastscreentime); */
/* if the current screen is less than 20ms from the previous (equivelant to 50fps) delay it */
/* this allows a real-world fps of 40fps with no almost frame loss and reduces peak usb bus-load */
- if((g15daemon_gettime_ms() - lastscreentime)>=20||displaying!=lastdisplayed){
+ if((g15daemon_gettime_ms() - lastscreentime)>=20||(char*)displaying!=lastdisplayed){
uf_write_buf_to_g15(displaying);
lastscreentime = g15daemon_gettime_ms();
- lastdisplayed = displaying;
+ lastdisplayed = (char*)displaying;
lastlcd = displaying->ident;
}
}
@@ -292,7 +292,7 @@
if(uf_create_pidfile() == 0) {
- lcdlist_t *lcdlist;
+ g15daemon_t *lcdlist;
pthread_attr_t attr;
struct passwd *nobody;
unsigned char location[1024];
Modified: trunk/g15daemon-wip/g15daemon/utility_funcs.c
===================================================================
--- trunk/g15daemon-wip/g15daemon/utility_funcs.c 2006-11-18 10:45:54 UTC (rev 176)
+++ trunk/g15daemon-wip/g15daemon/utility_funcs.c 2006-11-18 13:46:03 UTC (rev 177)
@@ -236,7 +236,7 @@
/* free all memory used by the config subsystem */
-void uf_conf_free(lcdlist_t *list)
+void uf_conf_free(g15daemon_t *list)
{
config_section_t *section=list->config->sections;
config_items_t *tmpitem=NULL;
@@ -266,7 +266,7 @@
}
/* write the config file with all keys/sections */
-int uf_conf_write(lcdlist_t *list,char *filename)
+int uf_conf_write(g15daemon_t *list,char *filename)
{
int config_fd=-1;
config_section_t *foo=list->config->sections;
@@ -298,7 +298,7 @@
}
/* search the list for valid section name return pointer to section, or NULL otherwise */
-config_section_t* uf_search_confsection(lcdlist_t *list,char *sectionname){
+config_section_t* uf_search_confsection(g15daemon_t *list,char *sectionname){
config_section_t *section=list->config->sections;
while(section!=NULL){
@@ -327,21 +327,21 @@
/* return pointer to section, or create a new section if it doesnt exist */
-config_section_t *g15daemon_cfg_load_section(lcdlist_t *displaylist,char *name) {
+config_section_t *g15daemon_cfg_load_section(g15daemon_t *masterlist,char *name) {
config_section_t *new = NULL;
- if((new=uf_search_confsection(displaylist,name))!=NULL)
+ if((new=uf_search_confsection(masterlist,name))!=NULL)
return new;
new = g15daemon_xmalloc(sizeof(config_section_t));
new->head = new;
new->next = NULL;;
new->sectionname=strdup(name);
- if(!displaylist->config->sections){
- displaylist->config->sections=new;
- displaylist->config->sections->head = new;
+ if(!masterlist->config->sections){
+ masterlist->config->sections=new;
+ masterlist->config->sections->head = new;
} else {
- displaylist->config->sections->head->next=new;
- displaylist->config->sections->head = new;
+ masterlist->config->sections->head->next=new;
+ masterlist->config->sections->head = new;
}
return new;
}
@@ -452,7 +452,7 @@
}
-int uf_conf_open(lcdlist_t *list, char *filename) {
+int uf_conf_open(g15daemon_t *list, char *filename) {
char *buffer, *lines;
int config_fd=-1;
Modified: trunk/g15daemon-wip/plugins/g15_plugin_net.c
===================================================================
--- trunk/g15daemon-wip/plugins/g15_plugin_net.c 2006-11-18 10:45:54 UTC (rev 176)
+++ trunk/g15daemon-wip/plugins/g15_plugin_net.c 2006-11-18 13:46:03 UTC (rev 177)
@@ -314,7 +314,7 @@
}
/* poll the listening socket for connections, spawning new threads as needed to handle clients */
-int g15_clientconnect (lcdlist_t **g15daemon, int listening_socket) {
+int g15_clientconnect (g15daemon_t **g15daemon, int listening_socket) {
int conn_s;
struct pollfd pfd[1];
@@ -366,7 +366,7 @@
*/
static void lcdserver_thread(void *lcdlist){
- lcdlist_t *displaylist = (lcdlist_t*) lcdlist ;
+ g15daemon_t *masterlist = (g15daemon_t*) lcdlist ;
int g15_socket=-1;
if((g15_socket = init_sockserver())<0){
@@ -379,7 +379,7 @@
}
while ( !leaving ) {
- g15_clientconnect(&displaylist,g15_socket);
+ g15_clientconnect(&masterlist,g15_socket);
}
close(g15_socket);
Modified: trunk/g15daemon-wip/plugins/g15_plugin_uinput.c
===================================================================
--- trunk/g15daemon-wip/plugins/g15_plugin_uinput.c 2006-11-18 10:45:54 UTC (rev 176)
+++ trunk/g15daemon-wip/plugins/g15_plugin_uinput.c 2006-11-18 13:46:03 UTC (rev 177)
@@ -58,11 +58,11 @@
int i=0;
char *custom_filename;
- lcdlist_t *displaylist = (lcdlist_t*) plugin_args;
+ g15daemon_t *masterlist = (g15daemon_t*) plugin_args;
struct uinput_user_dev uinp;
static const char *uinput_device_fn[] = { "/dev/uinput", "/dev/input/uinput","/dev/misc/uinput",0};
- uinput_cfg = g15daemon_cfg_load_section(displaylist,"Keyboard OS Mapping (uinput)");
+ uinput_cfg = g15daemon_cfg_load_section(masterlist,"Keyboard OS Mapping (uinput)");
custom_filename = g15daemon_cfg_read_string(uinput_cfg, "device",(char*)uinput_device_fn[1]);
map_Lkeys=g15daemon_cfg_read_int(uinput_cfg, "Lkeys.mapped",0);
@@ -79,8 +79,8 @@
return -1;
}
/* all other processes/threads should be seteuid nobody */
- seteuid(displaylist->nobody->pw_uid);
- setegid(displaylist->nobody->pw_gid);
+ seteuid(masterlist->nobody->pw_uid);
+ setegid(masterlist->nobody->pw_gid);
memset(&uinp,0,sizeof(uinp));
@@ -147,7 +147,7 @@
#endif
#endif
-void g15_process_keys(lcdlist_t *displaylist, unsigned int currentkeys, unsigned int lastkeys)
+void g15_process_keys(g15daemon_t *masterlist, unsigned int currentkeys, unsigned int lastkeys)
{
/* 'G' keys */
if((currentkeys & G15_KEY_G1) && !(lastkeys & G15_KEY_G1))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|