Author Topic: Led From Command Line?  (Read 2874 times)

clofland

  • Full Member
  • ***
  • Posts: 247
    • View Profile
    • http://www.lofland.net/
Led From Command Line?
« on: December 19, 2005, 03:50:46 pm »
Is there a way to turn on the green "mail" LED from a script in pdaXrom?
C-760 Last Running pdaXrom 1.1.0beta3
- Sandisk UltraII 1GB SD card - Socket LP CF LAN card - Socket LP CF WLAN card - Socket CF Bluetooth Card Rev H -

pierre

  • Newbie
  • *
  • Posts: 3
    • View Profile
Led From Command Line?
« Reply #1 on: December 20, 2005, 07:25:21 am »
On my C-1000 (pdaXrom), I has device named sharp_led in /dev. Maybe this can help you...

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Led From Command Line?
« Reply #2 on: December 20, 2005, 07:43:44 am »
SLC-860 cacko / senao wifi

web-angel

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
    • http://
Led From Command Line?
« Reply #3 on: December 20, 2005, 08:11:13 am »
look at the command :

xset --help ... it talk about a led fonction ...

Perhaps ...
SL-C860 / PdaXrom RC12 - CF Wifi linksys - Sd 512 (ext2) Cf 512 (fat)

pgas

  • Hero Member
  • *****
  • Posts: 1097
    • View Profile
    • http://
Led From Command Line?
« Reply #4 on: December 20, 2005, 04:47:03 pm »
attached: ledmail

usage:
ledmail on
ledmail off (whatever in fact)

source:
Code: [Select]
#include
#include
#include
#include
#include
#include
#include

#include "sharp_char.h"

int main(int argc,char **argv)
{
  int fd;
  int status=0;
  sharp_led_status st;
  if ((argc>1) && (strcmp(argv[1],"on")==0))
  {
    status=1;
  }

  fd = open ("/dev/sharp_led", O_WRONLY);
  st.which = 9;
  st.status = status;
  ioctl(fd, SHARP_LED_SETSTATUS, &st);
  close(fd);

  return 0;
}
SLC-860 cacko / senao wifi

clofland

  • Full Member
  • ***
  • Posts: 247
    • View Profile
    • http://www.lofland.net/
Led From Command Line?
« Reply #5 on: December 21, 2005, 12:40:36 pm »
Thanks pgas! I was just about to try patching something together when I saw your binary. Very cool, this is exactly what I needed!

FYI, you can set "which" to 13 instead of 9 and give several other status numbers to have the mail LED flash/blink in many different ways. If you set "which" to 12 you can control the battery LED.

If I get ambitios, I'll modify your code to take more options later this week, unless someone with real C++ skills gets to it first.

Now it is just too bad that there is no way to keep that LED blinking after the Z goes to sleep.
« Last Edit: December 21, 2005, 12:41:23 pm by clofland »
C-760 Last Running pdaXrom 1.1.0beta3
- Sandisk UltraII 1GB SD card - Socket LP CF LAN card - Socket LP CF WLAN card - Socket CF Bluetooth Card Rev H -