Unified · Split
| @@ -1,10 +1,8 @@ | |||
| 1 | # TODO: handle clients closing file | ||
| 2 | implement ButtonServer; | 1 | implement ButtonServer; |
| 3 | 2 | ||
| 4 | include "sys.m"; | 3 | include "sys.m"; |
| 5 | sys : Sys; | 4 | sys : Sys; |
| 6 | include "draw.m"; | 5 | include "draw.m"; |
| 7 | include "arg.m"; | ||
| 8 | include "styx.m"; | 6 | include "styx.m"; |
| 9 | styx: Styx; | 7 | styx: Styx; |
| 10 | Rmsg, Tmsg: import styx; | 8 | Rmsg, Tmsg: import styx; |
| @@ -15,7 +13,10 @@ nametree: Nametree; · 4 unmodified lines | |||
| 15 | Tree: import nametree; | 13 | Tree: import nametree; |
| 16 | include "cfg.m"; | 14 | include "cfg.m"; |
| 17 | cfg: Cfg; | 15 | cfg: Cfg; |
| 16 | include "arg.m"; | ||
| 17 | arg : Arg; | ||
| 18 | 18 | ||
| 19 | cfgfile := "/etc/buttonserver.cfg"; | ||
| 19 | mntflg := Sys->MBEFORE; | 20 | mntflg := Sys->MBEFORE; |
| 20 | mntpt := "/dev"; | 21 | mntpt := "/dev"; |
| 21 | Qroot, Qbuttons : con big iota; | 22 | Qroot, Qbuttons : con big iota; |
| @@ -43,9 +44,17 @@ init(nil: ref Draw->Context, args: list of string) · 21 unmodified lines | |||
| 43 | styxservers->init(styx); | 44 | styxservers->init(styx); |
| 44 | nametree = load Nametree Nametree->PATH; | 45 | nametree = load Nametree Nametree->PATH; |
| 45 | nametree->init(); | 46 | nametree->init(); |
| 47 | arg = load Arg Arg->PATH; | ||
| 48 | arg->init(args); | ||
| 49 | while((c := arg->opt()) != 0) { | ||
| 50 | case c { | ||
| 51 | 'c' => cfgfile = arg->arg(); | ||
| 52 | * => sys->print("unrecognized option %c\n", c); | ||
| 53 | } | ||
| 54 | } | ||
| 46 | cfg = load Cfg Cfg->PATH; | 55 | cfg = load Cfg Cfg->PATH; |
| 47 | if(cfg->init("/etc/buttonserver.cfg") != "") { | 56 | if(cfg->init(cfgfile) != "") { |
| 48 | raise "could not access configuration file"; | 57 | raise sys->sprint("could not access configuration file %s", cfgfile); |
| 49 | } | 58 | } |
| 50 | 59 | ||
| 51 | for(i := 0; i < MAX_READERS; i++) { | 60 | for(i := 0; i < MAX_READERS; i++) { |
| @@ -147,9 +147,12 @@ option(int argc, char *argv[], void (*badusage)(void)) · 146 unmodified lines | |||
| 147 | system("echo 255 > /sys/class/backlight/s5p_bl/brightness"); | 147 | system("echo 255 > /sys/class/backlight/s5p_bl/brightness"); |
| 148 | } | 148 | } |
| 149 | else if (type == 'c') { | 149 | else if (type == 'c') { |
| 150 | eventfiles = malloc(2*sizeof(char *)); | 150 | eventfiles = malloc(5*sizeof(char *)); |
| 151 | eventfiles[0] = "/dev/input/event0"; | 151 | eventfiles[0] = "/dev/input/event0"; |
| 152 | eventfiles[1] = NULL; | 152 | eventfiles[1] = "/dev/input/event1"; |
| 153 | eventfiles[2] = "/dev/input/event2"; | ||
| 154 | eventfiles[3] = "/dev/input/event3"; | ||
| 155 | eventfiles[4] = NULL; | ||
| 153 | displaydepth = 32; | 156 | displaydepth = 32; |
| 154 | geom("600x1024"); | 157 | geom("600x1024"); |
| 155 | rotation_opt = 1; | 158 | rotation_opt = 1; |
| @@ -0,0 +1,11 @@ | |||
| 1 | # Nook Color | ||
| 2 | "0 1 102 1"="home press" | ||
| 3 | "0 1 102 0"="home release" | ||
| 4 | "0 1 116 1"="power press" | ||
| 5 | "0 1 116 0"="power release" | ||
| 6 | "1 1 114 1"="volume down press" | ||
| 7 | "1 1 114 2"="volume down hold" | ||
| 8 | "1 1 114 0"="volume down release" | ||
| 9 | "1 1 115 1"="volume up press" | ||
| 10 | "1 1 115 2"="volume up hold" | ||
| 11 | "1 1 115 0"="volume up release" | ||