Skip to content

Commit

Permalink
Merge pull request #40 from giorgio130/master
Browse files Browse the repository at this point in the history
Other small fixes for kobo light
  • Loading branch information
chrox committed Aug 6, 2013
2 parents 0469360 + ca1ea2b commit b5625d4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions kobolight.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ static int openLightDevice(lua_State *L) {
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 All @@ -50,7 +45,7 @@ static int closeLightDevice(lua_State *L) {

static int setBrightness(lua_State *L) {
LightInfo *light = (LightInfo*) luaL_checkudata(L, 1, "kobolight");
int brightness = luaL_optint(L, 2, 0)*100/24;
int brightness = luaL_optint(L, 2, 0);

if (brightness < 0 || brightness > 100) {
return luaL_error(L, "Wrong brightness value %d given!", brightness);
Expand All @@ -60,6 +55,7 @@ static int setBrightness(lua_State *L) {
return luaL_error(L, "cannot change brightess value");
}
light->brightness = brightness;
light->isOn = 1;
return 0;
}

Expand Down

0 comments on commit b5625d4

Please sign in to comment.