OESF Portables Forum

Model Specific Forums => Sharp Zaurus => Zaurus - pdaXrom => Topic started by: clofland on December 19, 2005, 03:50:46 pm

Title: Led From Command Line?
Post by: clofland on December 19, 2005, 03:50:46 pm
Is there a way to turn on the green "mail" LED from a script in pdaXrom?
Title: Led From Command Line?
Post by: pierre 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...
Title: Led From Command Line?
Post by: pgas on December 20, 2005, 07:43:44 am
not an answer but :
https://www.oesf.org/index.php?title=Led_Howto (https://www.oesf.org/index.php?title=Led_Howto)
Title: Led From Command Line?
Post by: web-angel on December 20, 2005, 08:11:13 am
look at the command :

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

Perhaps ...
Title: Led From Command Line?
Post by: pgas 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;
}
Title: Led From Command Line?
Post by: clofland 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.