History

Added buttonserver support for Nook Color Specify the configuration file for buttonserver with -c.

Joel Armstrong committed 15 years ago

Commit 571aa1c1 parent 9447faa3 files · +29 −6Browse files

Unified · Split

3 files
  1. appl/buttonserver.b +13 −4
  2. emu/port/main.c +5 −2
  3. etc/buttonserver-nook-color.cfg +11 −0
appl/buttonserver.b+13−4
@@ -1,10 +1,8 @@
1−# TODO: handle clients closing file
21 implement ButtonServer;
32
43 include "sys.m";
54 sys : Sys;
65 include "draw.m";
7−include "arg.m";
86 include "styx.m";
97 styx: Styx;
108 Rmsg, Tmsg: import styx;
@@ -15,7 +13,10 @@ nametree: Nametree; · 4 unmodified lines
1513 Tree: import nametree;
1614 include "cfg.m";
1715 cfg: Cfg;
16+include "arg.m";
17+arg : Arg;
1818
19+cfgfile := "/etc/buttonserver.cfg";
1920 mntflg := Sys->MBEFORE;
2021 mntpt := "/dev";
2122 Qroot, Qbuttons : con big iota;
@@ -43,9 +44,17 @@ init(nil: ref Draw->Context, args: list of string) · 21 unmodified lines
4344 styxservers->init(styx);
4445 nametree = load Nametree Nametree->PATH;
4546 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+ }
4655 cfg = load Cfg Cfg->PATH;
47− if(cfg->init("/etc/buttonserver.cfg") != "") {
48− raise "could not access configuration file";
56+ if(cfg->init(cfgfile) != "") {
57+ raise sys->sprint("could not access configuration file %s", cfgfile);
4958 }
5059
5160 for(i := 0; i < MAX_READERS; i++) {
emu/port/main.c+5−2
@@ -147,9 +147,12 @@ option(int argc, char *argv[], void (*badusage)(void)) · 146 unmodified lines
147147 system("echo 255 > /sys/class/backlight/s5p_bl/brightness");
148148 }
149149 else if (type == 'c') {
150− eventfiles = malloc(2*sizeof(char *));
150+ eventfiles = malloc(5*sizeof(char *));
151151 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;
153156 displaydepth = 32;
154157 geom("600x1024");
155158 rotation_opt = 1;
etc/buttonserver-nook-color.cfg+11−0
@@ -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"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t