Qtopia and led's driver

whitebank
Hi everybody.

I'm writing an Qtopia application to control the led through led's driver.

        int fd;
  fd = open("/dev/leds0", 0);
  if (fd < 0) {
    fd = open("/dev/leds", 0);
  }
  if (fd < 0) {
    return;
  }
  ioctl(fd, 1, 1);  //turn led1 on
  close(fd);

i put those code in Qtopia file (led.cpp). I did compile it successful. And
the application load rightly in mini2440 board. However, when i press the
button which run above code, the whole system is stopped running -> i have
to press reset button :(

Someone know this problem, please help me, thankss.

whitebank
:D
i found out for my own question. I should remove the last line,
"close(fd)".

thanks anyway.

whitebank
Hi again. I face a new problem with this driver.
When i removed the code "close(fd)", it just works for the first time :(

I try to use Qfile to open led's driver, it works fine with "close(fd)",
but i could not read the data from led's driver but only the normal file.

Who knows this problem? please help me