|
From: <mla...@us...> - 2006-07-31 03:49:53
|
Revision: 37 Author: mlampard Date: 2006-07-30 20:49:43 -0700 (Sun, 30 Jul 2006) ViewCVS: http://svn.sourceforge.net/g15daemon/?rev=37&view=rev Log Message: ----------- add ability for background clients to switch themselves into the foreground and back again. Make any backlight changes made by clients affect only those clients. Modified Paths: -------------- trunk/g15daemon/ChangeLog trunk/g15daemon/g15daemon/g15_net.c trunk/g15daemon/g15daemon/g15_uinput.c trunk/g15daemon/g15daemon/g15daemon.h trunk/g15daemon/g15daemon/lcdclient_test.c trunk/g15daemon/g15daemon/main.c trunk/g15daemon/g15daemon/utility_funcs.c Modified: trunk/g15daemon/ChangeLog =================================================================== --- trunk/g15daemon/ChangeLog 2006-07-30 15:21:21 UTC (rev 36) +++ trunk/g15daemon/ChangeLog 2006-07-31 03:49:43 UTC (rev 37) @@ -26,13 +26,23 @@ - Initial release 1.1 21/07/2006 - Add WBMP support and Perl bindings. -1.2 svn - current +1.2 31/07/2006 +** IMPORTANT NOTE ** +This release has changed the LCD screen switch function to the MR key to +allow clients use of all 'L' keys. +** - reduce per-thread stack usage - default was 8Mb on i386 linux. now 256k this makes top output look much nicer ;) - optimize lcd buffer path, removing a conversion step. and reducing the buffer size from 7k to 1k - misc other memory optimisations. -- added python bindings -- added ability for lcd clients to receive keypresses directly +- added python bindings (thanks muhgatus) +- added ability for lcd clients to receive L G & M key keypresses directly - moved lcd display/client switch from L1 to MR -- MR key is now backlit. +- MR key is now backlit when clients are attached. +- Added ability for lcd clients to change backlight brightness +- Added ability for lcd clients to toggle M-key LEDs +- Added libG15Render client support. +- Added ability for hidden lcd clients to bring themselves to the foreground +- clients change only their own backlight/mkey led status + Modified: trunk/g15daemon/g15daemon/g15_net.c =================================================================== --- trunk/g15daemon/g15daemon/g15_net.c 2006-07-30 15:21:21 UTC (rev 36) +++ trunk/g15daemon/g15daemon/g15_net.c 2006-07-31 03:49:43 UTC (rev 37) @@ -112,7 +112,6 @@ pfd[0].events = POLLIN | POLLPRI; if(poll(pfd,1,500)>0){ if(pfd[0].revents & POLLPRI) { /* receive out-of-band request from client and deal with it */ - oobdata: memset(msgbuf,0,20); msgret = recv(sock, msgbuf, 10 , MSG_OOB); if (msgret < 1) { @@ -129,12 +128,26 @@ memset(msgbuf,0,4); /* client isn't currently being displayed.. tell them nothing */ send(sock,(void *)msgbuf,sizeof(current_key_state),0); } + }else if(msgbuf[0] == 'p') { /* client wants to switch priorities */ + pthread_mutex_lock(&lcdlist_mutex); + if(lcdnode->list->current != lcdnode){ + lcdnode->last_priority = lcdnode->list->current; + lcdnode->list->current = lcdnode; + } + else if (lcdnode->list->current == lcdnode && lcdnode->last_priority != NULL){ + lcdnode->list->current = lcdnode->last_priority; + lcdnode->last_priority = NULL; + } + pthread_mutex_unlock(&lcdlist_mutex); }else if(msgbuf[0] & 0x80) { /* client wants to change the backlight */ - setLCDBrightness(msgbuf[0]-0x80); + lcdnode->lcd->backlight_state = msgbuf[0]-0x80; + lcdnode->lcd->state_changed = 1; }else if(msgbuf[0] & 0x40) { /* client wants to change the LCD contrast */ - setLCDContrast(msgbuf[0]-0x40); + lcdnode->lcd->contrast_state = msgbuf[0]-0x40; + lcdnode->lcd->state_changed = 1; }else if(msgbuf[0] & 0x20) { /* client wants to change the M-key backlights */ - setLEDs(msgbuf[0]-0x20); + lcdnode->lcd->mkey_state = msgbuf[0]-0x20; + lcdnode->lcd->state_changed = 1; } } else if(pfd[0].revents & POLLIN) { Modified: trunk/g15daemon/g15daemon/g15_uinput.c =================================================================== --- trunk/g15daemon/g15daemon/g15_uinput.c 2006-07-30 15:21:21 UTC (rev 36) +++ trunk/g15daemon/g15daemon/g15_uinput.c 2006-07-31 03:49:43 UTC (rev 37) @@ -232,6 +232,8 @@ } else { displaylist->current = displaylist->current->prev; } + displaylist->current->lcd->state_changed = 1; + displaylist->current->last_priority = displaylist->current; pthread_mutex_unlock(&lcdlist_mutex); } } Modified: trunk/g15daemon/g15daemon/g15daemon.h =================================================================== --- trunk/g15daemon/g15daemon/g15daemon.h 2006-07-30 15:21:21 UTC (rev 36) +++ trunk/g15daemon/g15daemon/g15daemon.h 2006-07-31 03:49:43 UTC (rev 37) @@ -54,6 +54,12 @@ int max_y; int connection; long int ident; + unsigned int backlight_state; + unsigned int mkey_state; + unsigned int contrast_state; + unsigned int state_changed; + unsigned int client_notify; + unsigned int display_status; } lcd_t; typedef struct lcdnode_s lcdnode_t; @@ -63,6 +69,7 @@ lcdlist_t *list; lcdnode_t *prev; lcdnode_t *next; + lcdnode_t *last_priority; lcd_t *lcd; }lcdnode_s; Modified: trunk/g15daemon/g15daemon/lcdclient_test.c =================================================================== --- trunk/g15daemon/g15daemon/lcdclient_test.c 2006-07-30 15:21:21 UTC (rev 36) +++ trunk/g15daemon/g15daemon/lcdclient_test.c 2006-07-31 03:49:43 UTC (rev 37) @@ -89,8 +89,12 @@ msgbuf[0]=G15_BRIGHTNESS_BRIGHT|G15DAEMON_BACKLIGHT; send(g15screen_fd,msgbuf,1,MSG_OOB); } +// if(keystate & 16){ + msgbuf[0]='p'; /* switch priorities */ + send(g15screen_fd,msgbuf,1,MSG_OOB); + sleep(2); +// } usleep(5000); - } g15_close_screen(g15screen_fd); return 0; Modified: trunk/g15daemon/g15daemon/main.c =================================================================== --- trunk/g15daemon/g15daemon/main.c 2006-07-30 15:21:21 UTC (rev 36) +++ trunk/g15daemon/g15daemon/main.c 2006-07-31 03:49:43 UTC (rev 37) @@ -44,6 +44,8 @@ unsigned int current_key_state; +extern unsigned int connected_clients; + static void *keyboard_watch_thread(void *lcdlist){ lcdlist_t *displaylist = (lcdlist_t*)(lcdlist); @@ -89,6 +91,7 @@ if(displaylist->tail == displaylist->current){ lcdclock(displaying); + displaying->mkey_state = 0; } if(displaying->ident != lastlcd){ @@ -96,6 +99,15 @@ lastlcd = displaying->ident; } + if(displaying->state_changed ){ + setLCDContrast(displaying->contrast_state); + if(connected_clients) + displaying->mkey_state = displaying->mkey_state | G15_LED_MR; + setLEDs(displaying->mkey_state); + setLCDBrightness(displaying->backlight_state); + displaying->state_changed = 0; + } + pthread_mutex_unlock(&lcdlist_mutex); pthread_msleep(200); Modified: trunk/g15daemon/g15daemon/utility_funcs.c =================================================================== --- trunk/g15daemon/g15daemon/utility_funcs.c 2006-07-30 15:21:21 UTC (rev 36) +++ trunk/g15daemon/g15daemon/utility_funcs.c 2006-07-31 03:49:43 UTC (rev 37) @@ -62,7 +62,11 @@ lcd_t *lcd = g15_xmalloc (sizeof (lcd_t)); lcd->max_x = LCD_WIDTH; lcd->max_y = LCD_HEIGHT; - + lcd->backlight_state = G15_BRIGHTNESS_MEDIUM; + lcd->mkey_state = G15_LED_MR; + lcd->contrast_state = G15_CONTRAST_MEDIUM; + lcd->state_changed = 1; + return (lcd); } @@ -272,6 +276,8 @@ displaylist->current = displaylist->head; displaylist->head->lcd = create_lcd(); + displaylist->head->lcd->mkey_state = 0; + displaylist->head->prev = displaylist->head; displaylist->head->next = displaylist->head; displaylist->head->list = displaylist; @@ -290,6 +296,7 @@ new->prev = (*display_list)->current; new->next = NULL; new->lcd = create_lcd(); + new->last_priority = NULL; (*display_list)->current->next=new; (*display_list)->current = new; @@ -315,8 +322,10 @@ quit_lcd(oldnode->lcd); - if((*display_list)->current == oldnode) - (*display_list)->current = oldnode->prev; + if((*display_list)->current == oldnode) { + (*display_list)->current = oldnode->prev; + (*display_list)->current->lcd->state_changed = 1; + } if(oldnode->next!=NULL){ (*next)->prev = oldnode->prev; @@ -326,6 +335,7 @@ } free(oldnode); + pthread_mutex_unlock(&lcdlist_mutex); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |