From ca1ea2be3a21776b1b7547bf0b4f00147290ac53 Mon Sep 17 00:00:00 2001 From: Giorgio Micotti Date: Mon, 5 Aug 2013 22:55:20 +0200 Subject: [PATCH] Other small fixes --- kobolight.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/kobolight.c b/kobolight.c index 209fa1ca3..a4a1f1055 100644 --- a/kobolight.c +++ b/kobolight.c @@ -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; } @@ -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); @@ -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; }