Skip to content

Commit

Permalink
Start kobo light from a known state.
Browse files Browse the repository at this point in the history
  • Loading branch information
Giorgio Micotti committed Aug 2, 2013
1 parent 214baab commit 698fb17
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kobolight.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ static int openLightDevice(lua_State *L) {
luaL_getmetatable(L, "kobolight");
lua_setmetatable(L, -2);
light->ld = open("/dev/ntx_io", O_RDWR);
printf("opening file\n");
if (light->ld == -1) {
return luaL_error(L, "cannot open light device");
}
light->brightness = 20;
if (ioctl(light->ld, 241, light->brightness)) {
return luaL_error(L, "cannot turn on the light");
}
light->isOn = 1;
return 1;
}

Expand Down

0 comments on commit 698fb17

Please sign in to comment.