ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

Questions about hardware,drivers and peripherals
Forum rules
Before you post please read this

ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

Postby mcurran on Tue Jul 29, 2008 8:17 pm

Hello:

I have an ASUS G1Sn-B1 laptop (see picture in signature) and I use the following to turn on the various LED lights on the front and side of my notebook.

(I'VE UPDATED THE DIRECTORY TREE FOR THE COMMANDS BELOW, TO COMPENSATE FOR THE CHANGES WITH THE MOST RECENT RELEASE OF asus-laptop)


# Gain Appropriate Permissions
sudo -s

# Load Module
sudo modprobe asus-laptop

# Turn On Side-Lights (Gaming)
sudo echo 1 > /sys/class/leds/asus\:gaming/brightness (UPDATE: sudo echo 1 > /sys/class/leds/asus::gaming/brightness)

# Turn Off Side-Lights (Gaming)
sudo echo 0 > /sys/class/leds/asus\:gaming/brightness (UPDATE: sudo echo 0 > /sys/class/leds/asus::gaming/brightness)

# Turn On Front-Light (Touchpad)
sudo echo 1 > /sys/class/leds/asus\:touchpad/brightness (UPDATE: sudo echo 1 > /sys/class/leds/asus::touchpad/brightness)

# Turn Off Front-Light (Touchpad)
sudo echo 0 > /sys/class/leds/asus\:touchpad/brightness (UPDATE: sudo echo 0 > /sys/class/leds/asus::touchpad/brightness)

# Turn On eMail-Light (Mail)
sudo echo 1 > /sys/class/leds/asus\:mail/brightness (UPDATE: sudo echo 1 > /sys/class/leds/asus::mail/brightness)

# Turn Off eMail-Light (Mail)
sudo echo 0 > /sys/class/leds/asus\:mail/brightness (UPDATE: sudo echo 0 > /sys/class/leds/asus::mail/brightness)


If I do a restart, the modules will stay loaded (default is off), but they are reset with a reboot/shutdown. Is there any way I can set this up so that these files get run on startup? I was going to try Sessions, but it seems this would be a bit more complicated. Is there a program I can download to run modules on startup? Please let me know. Or even better; just edit a file so default is all on? These just appear to be image files in the mentioned directories, so I can't really edit anything at this point.
Last edited by mcurran on Wed Feb 18, 2009 8:40 pm, edited 3 times in total.
IBM IntelliStation Z Pro [6227-ACU]
Intel Xeon (3.4GHz) | Irwindale (x2)
nVIDIA GTX 460 (1024MB-DDR5)
6GB RAM (800MHz)
MULTI-BOOT: Metro/Mountain Lion/LMDE
    User avatar
    mcurran
    Level 3
    Level 3
     
    Posts: 100
    Joined: Sun Jan 20, 2008 10:32 pm

    Linux Mint is funded by ads and donations.
     

    Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

    Postby Husse on Wed Jul 30, 2008 8:55 am

    You seem to know a bit so I'll give short answer
    You could make a script, test that it works, put in in init.d and create a symlink to the proper rc.d folder (should be rc.d5 :))
    Image
    Don't fix it if it ain't broken, don't break it if you can't fix it
    Husse
    Level 21
    Level 21
     
    Posts: 19710
    Joined: Sun Feb 11, 2007 7:22 am
    Location: Near Borås Sweden

    Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

    Postby mcurran on Wed Jul 30, 2008 8:23 pm

    These rc-scripts seem to try to hard to reference/handlle a simple command/instruction (e.g. to much jumping around), is it because boot processes like init need simple instructions and cannot use gtk (for example) like I would in a terminal (or whatever language it is - I'm pretty sure it's gtk, right :) ). Well I'm just wondering, because If I'm really gonna go all out for this and study rc scripts, I'm gonna want to make them flash like they do in Windows, for the hell of it. Would I be better off creating a higher level program and put it on my taskbar and use easier dependencies. Haha, I'm procrastinating, somebody must've done this already... No?

    Hey, maybe if I do put in the effort, I might learn something and then build myself a sophisticated boot level framebuffer that'll get my grub at 1680x1050.

    You should just ask someone to setup a Mint chat and host it if your posting this much anyways, Husse.

    Hey, you know you want to write the two files for me. PLEASE? I didn't get past C++, and this will take me a long while to understand: http://wiki.debianhelp.org/pmwiki.php/D ... nitScripts
    IBM IntelliStation Z Pro [6227-ACU]
    Intel Xeon (3.4GHz) | Irwindale (x2)
    nVIDIA GTX 460 (1024MB-DDR5)
    6GB RAM (800MHz)
    MULTI-BOOT: Metro/Mountain Lion/LMDE
      User avatar
      mcurran
      Level 3
      Level 3
       
      Posts: 100
      Joined: Sun Jan 20, 2008 10:32 pm

      Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

      Postby Husse on Thu Jul 31, 2008 8:08 am

      Ah
      You do a simple bash script or rather sh script
      #!/bin/sh
      or
      #!/bin/bash
      I'm not versatile in this but I make may way around
      I think I have to come back to this - time is lacking :)
      Image
      Don't fix it if it ain't broken, don't break it if you can't fix it
      Husse
      Level 21
      Level 21
       
      Posts: 19710
      Joined: Sun Feb 11, 2007 7:22 am
      Location: Near Borås Sweden

      Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

      Postby mcurran on Thu Jul 31, 2008 7:13 pm

      I didn't create a script. I just downloaded and installed the latest asus-laptop module: acpi4asus-0.41

      I just untarred the package acpi4asus-0.41-tar.bz2 and did make and then make install - just like I would for any package and it worked. Not sure if there will be problems later on, since I didn't compile the kernel or anything like others suggested. But it works perfect - NICE!

      Nope, wait, I was wrong - Must've just been because I booted Windows first and for some reason the lights were kept on. Damn!
      IBM IntelliStation Z Pro [6227-ACU]
      Intel Xeon (3.4GHz) | Irwindale (x2)
      nVIDIA GTX 460 (1024MB-DDR5)
      6GB RAM (800MHz)
      MULTI-BOOT: Metro/Mountain Lion/LMDE
        User avatar
        mcurran
        Level 3
        Level 3
         
        Posts: 100
        Joined: Sun Jan 20, 2008 10:32 pm

        Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

        Postby Husse on Fri Aug 01, 2008 5:56 am

        I booted Windows first

        This is because "hardware secrets" are revealed to M$ but not to others
        This way Windows can use some firmware "tricks" that Linux can't
        Boot into Windows > use the thing (sound wifi whatever) > boot back into Linux and you'll find that it remains on in a large number of cases
        Image
        Don't fix it if it ain't broken, don't break it if you can't fix it
        Husse
        Level 21
        Level 21
         
        Posts: 19710
        Joined: Sun Feb 11, 2007 7:22 am
        Location: Near Borås Sweden

        Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

        Postby mcurran on Thu Aug 07, 2008 6:58 pm

        Any assistance would be much appreciated. I'm sure editing the rc files for adding bootup scripts and then creating the symlink is easy - I just can't understand the HowTo's all over the net. Am I missing something, or are people purposely not writing these tutorials for noobs?
        IBM IntelliStation Z Pro [6227-ACU]
        Intel Xeon (3.4GHz) | Irwindale (x2)
        nVIDIA GTX 460 (1024MB-DDR5)
        6GB RAM (800MHz)
        MULTI-BOOT: Metro/Mountain Lion/LMDE
          User avatar
          mcurran
          Level 3
          Level 3
           
          Posts: 100
          Joined: Sun Jan 20, 2008 10:32 pm

          Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

          Postby Husse on Sat Aug 09, 2008 1:17 pm

          Somewhat short description
          Make a script - remember the first line is always #!bash or #!sh
          Put it in /etc/init.d
          Make it executable and owned by root
          Make a symlink (all links you make are probably symlinks so don't worry about the sym part) to the script which you put in
          /etc/rc5.d
          and name it S99your_script
          There are different ways to achieve this and don't worry about why and why S99 - look that up in google if you are interested
          Image
          Don't fix it if it ain't broken, don't break it if you can't fix it
          Husse
          Level 21
          Level 21
           
          Posts: 19710
          Joined: Sun Feb 11, 2007 7:22 am
          Location: Near Borås Sweden

          Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

          Postby mcurran on Thu Aug 21, 2008 3:18 pm

          Thanks Husse. I don't understand what the script would be though, would it just be the commands? I get the part about where you save them. But would the script just be:

          (Beginning of text file)
          #!/bin/sh

          sudo echo 1 > /sys/class/leds/asus\:gaming/brightness

          (End of text file)

          So root privelages and the asus-module would already be loaded at that runlevel? Well I think the asus-module would be loaded anyways, because I haven't had to manually load that since I installed it and replaced acpi.
          IBM IntelliStation Z Pro [6227-ACU]
          Intel Xeon (3.4GHz) | Irwindale (x2)
          nVIDIA GTX 460 (1024MB-DDR5)
          6GB RAM (800MHz)
          MULTI-BOOT: Metro/Mountain Lion/LMDE
            User avatar
            mcurran
            Level 3
            Level 3
             
            Posts: 100
            Joined: Sun Jan 20, 2008 10:32 pm

            Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

            Postby Husse on Fri Aug 22, 2008 6:09 am

            Maybe I missed something - do you load all the lines in the first post in one instant?
            That's what I assumed
            Image
            Don't fix it if it ain't broken, don't break it if you can't fix it
            Husse
            Level 21
            Level 21
             
            Posts: 19710
            Joined: Sun Feb 11, 2007 7:22 am
            Location: Near Borås Sweden

            Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

            Postby mcurran on Fri Aug 22, 2008 11:19 pm

            No, I'll run each command separately, so If I wanted to turn on the front led and side leds, I would have to do this in a terminal:

            sudo -s

            (my password)

            sudo echo 1 > /sys/class/leds/asus\:gaming/brightness

            sudo echo 1 > /sys/class/leds/asus\:touchpad/brightness
            IBM IntelliStation Z Pro [6227-ACU]
            Intel Xeon (3.4GHz) | Irwindale (x2)
            nVIDIA GTX 460 (1024MB-DDR5)
            6GB RAM (800MHz)
            MULTI-BOOT: Metro/Mountain Lion/LMDE
              User avatar
              mcurran
              Level 3
              Level 3
               
              Posts: 100
              Joined: Sun Jan 20, 2008 10:32 pm

              Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

              Postby Husse on Sat Aug 23, 2008 11:40 am

              But if so why do you want to run the script at boot ?
              Image
              Don't fix it if it ain't broken, don't break it if you can't fix it
              Husse
              Level 21
              Level 21
               
              Posts: 19710
              Joined: Sun Feb 11, 2007 7:22 am
              Location: Near Borås Sweden

              Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

              Postby mcurran on Sun Aug 24, 2008 11:41 pm

              Because I want the LED lights on by default. I like them, and they're green, so they match my OS now. :o

              So these two commands turn on the lights on the side of my lcd screen, and a light by the touchpad. But initially I needed to load the asus-laptop module, since that's the driver, and sometimes I had to be root to load the module. But now the module automatically loads at startup, but the lights don't turn on, unless I open a terminal and run the commands.

              Seriously, wouldn't have it taken you less time to just tell me what to do by now? I just can't figure this one out for some reason.
              User avatar
              mcurran
              Level 3
              Level 3
               
              Posts: 100
              Joined: Sun Jan 20, 2008 10:32 pm

              Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

              Postby mcurran on Sun Sep 07, 2008 12:51 am

              If anyone can provide me some instruction on creating a startup script in init.d and rc5.d I would greatly appreciate it. Please help.
              IBM IntelliStation Z Pro [6227-ACU]
              Intel Xeon (3.4GHz) | Irwindale (x2)
              nVIDIA GTX 460 (1024MB-DDR5)
              6GB RAM (800MHz)
              MULTI-BOOT: Metro/Mountain Lion/LMDE
                User avatar
                mcurran
                Level 3
                Level 3
                 
                Posts: 100
                Joined: Sun Jan 20, 2008 10:32 pm

                Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

                Postby Husse on Sun Sep 07, 2008 6:11 pm

                I started to write an answer but I lost internet (just a few minutes) a couple of times today...
                This has gone down deep before you bumped it - august 25 is on page 5 in my posts (this is the date of the previous post)
                If you want the two leads in you example above to light up then something like this
                First the script - lets call it ledlight
                Code: Select all
                #! /bin/bash
                #to get leds to light up
                echo 1 > /sys/class/leds/asus\:gaming/brightness
                echo 1 > /sys/class/leds/asus\:touchpad/brightness

                Then the symlink
                Code: Select all
                ln /etc/init.d/ledlight  /etc/rc5.d/S45ledlight

                The number S45 indicates at what time in the boot sequence the script is to be run S45 is about the middle - just a guess
                Image
                Don't fix it if it ain't broken, don't break it if you can't fix it
                Husse
                Level 21
                Level 21
                 
                Posts: 19710
                Joined: Sun Feb 11, 2007 7:22 am
                Location: Near Borås Sweden

                Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

                Postby mcurran on Mon Sep 15, 2008 9:19 pm

                Thanks Husse, you're the man!

                I'm almost there. I got the script file saved in init.d and created the symlink. I can both run the symlink and display it, and it works when I run it; however, it is not loading/executing on startup (Tried both restart and reboot). Do I need to put the sudo in front of each command or try runlevel 6? I've tried a few things, but it just doesn't want to work by itself for some reason. I tried changing it to a sh script, but that didn't help much...
                IBM IntelliStation Z Pro [6227-ACU]
                Intel Xeon (3.4GHz) | Irwindale (x2)
                nVIDIA GTX 460 (1024MB-DDR5)
                6GB RAM (800MHz)
                MULTI-BOOT: Metro/Mountain Lion/LMDE
                  User avatar
                  mcurran
                  Level 3
                  Level 3
                   
                  Posts: 100
                  Joined: Sun Jan 20, 2008 10:32 pm

                  Re: ASUS G1 Series (LED's) - Load Module/Command On Start-Up?

                  Postby mcurran on Mon Sep 15, 2008 10:33 pm

                  Hi Husse:

                  Got it working (FYI: changed the names to asus-leds and S45asus-leds respectively)

                  had to do:

                  sudo update-rc.d S45asus-leds defaults (At first it said the file didn't exist, so I had to put a symlink in init.d and then create the startup for some reason)

                  When I tried this, in order to keep the symlink in the rc5.d runlevel folder, I got the following:

                  sudo update-rc.d /etc/rc5.d/S45asus-leds defaults
                  update-rc.d: /etc/init.d//etc/rc5.d/S45asus-leds: file does not exist (even though file did exist w/ appropriate permissions)

                  WHY? It's not really important to have this sqeaky clean, since it's working, but I'm just curious why the auto update command only works if the symlink is in init.d and not one of the runlevel folders (in this case: rc5.d)

                  Also the automated startup creation command update-rc.d created a bunch of symlink start and stop shortcuts in init.d two, which is messy.
                  User avatar
                  mcurran
                  Level 3
                  Level 3
                   
                  Posts: 100
                  Joined: Sun Jan 20, 2008 10:32 pm

                  Linux Mint is funded by ads and donations.
                   

                  Return to Hardware Support

                  Who is online

                  Users browsing this forum: No registered users and 14 guests