Changeset 32046


Ignore:
Timestamp:
May 14, 2017, 4:08:27 PM (10 days ago)
Author:
brainslayer
Message:

usb led's

Location:
src/router/services/sysinit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/router/services/sysinit/devices/ethernet.c

    r29426 r32046  
    206206static int detect_drivers(char *enabled, char *list, char **driverset)
    207207{
    208         static char word[256];
     208        char word[256];
    209209        char *next, *wordlist;
    210210        int rcc = 0;
  • src/router/services/sysinit/sysinit-mvebu.c

    r32041 r32046  
    4646#include <cymac.h>
    4747
     48static void set_led_usbport(char *led, char *ports)
     49{
     50        char word[256];
     51        char *next;
     52
     53        sysprintf("echo usbport > /sys/class/leds/%s/trigger");
     54
     55        foreach(word, ports, next) {
     56                sysprintf("echo 1 > /sys/class/leds/%s/ports/%s");
     57        }
     58
     59}
     60
    4861#define SIOCGMIIREG     0x8948  /* Read MII PHY register.  */
    4962#define SIOCSMIIREG     0x8949  /* Write MII PHY register.  */
     
    190203        if (brand == ROUTER_WRT_1900AC) {
    191204                sysprintf("echo disk-activity > /sys/class/leds/mamba\\:white\\:esata/trigger");
    192                 sysprintf("echo usb1-port1 > /sys/class/leds/mamba\\:white\\:usb2/trigger");
    193                 sysprintf("echo \"usb2-port1 usb3-port1\" > /sys/class/leds/mamba\\:white\\:usb3_1/trigger");
    194                 sysprintf("echo usb3-port2 > /sys/class/leds/mamba\\:white\\:usb3_2/trigger");
     205                set_led_usbport("mamba\\:white\\:usb3_2", "usb3-port2");
     206                set_led_usbport("mamba\\:white\\:usb3_1", "usb2-port1 usb3-port1");
     207                set_led_usbport("mamba\\:white\\:usb2", "usb1-port1");
    195208        }
    196209
    197210        if (brand == ROUTER_WRT_1200AC) {
    198211                sysprintf("echo disk-activity > /sys/class/leds/caiman\\:white\\:sata/trigger");
    199                 sysprintf("echo usb1-port1 > /sys/class/leds/pca963x\\:caiman\\:white\\:usb2/trigger");
    200                 sysprintf("echo \"usb2-port1 usb3-port1\" > /sys/class/leds/pca963x\\:caiman\\:white\\:usb3_1/trigger");
    201                 sysprintf("echo usb3-port1 > /sys/class/leds/pca963x\\:caiman\\:white\\:usb3_2/trigger");
     212                set_led_usbport("pca963x\\:caiman\\:white\\:usb3_2", "usb3-port1");
     213                set_led_usbport("pca963x\\:caiman\\:white\\:usb3_1", "usb2-port1 usb3-port1");
     214                set_led_usbport("pca963x\\:caiman\\:white\\:usb2", "usb1-port1");
    202215        }
    203216
    204217        if (brand == ROUTER_WRT_1900ACV2) {
    205218                sysprintf("echo disk-activity > /sys/class/leds/cobra\\:white\\:sata/brightness");
    206                 sysprintf("echo usb1-port1 > /sys/class/leds/pca963x\\:cobra\\:white\\:usb2/trigger");
    207                 sysprintf("echo \"usb2-port1 usb3-port1\" > /sys/class/leds/pca963x\\:cobra\\:white\\:usb3_1/trigger");
    208                 sysprintf("echo usb3-port1 > /sys/class/leds/pca963x\\:cobra\\:white\\:usb3_2/trigger");
    209 
     219
     220                set_led_usbport("pca963x\\:cobra\\:white\\:usb3_2", "usb3-port1");
     221                set_led_usbport("pca963x\\:cobra\\:white\\:usb3_1", "usb2-port1 usb3-port1");
     222                set_led_usbport("pca963x\\:cobra\\:white\\:usb2", "usb1-port1");
    210223        }
    211224
    212225        if (brand == ROUTER_WRT_1900ACS) {
    213226                sysprintf("echo disk-activity > /sys/class/leds/shelby\\:white\\:sata/brightness");
    214                 sysprintf("echo usb1-port1 > /sys/class/leds/pca963x\\:shelby\\:white\\:usb2/trigger");
    215                 sysprintf("echo \"usb2-port1 usb3-port1\" > /sys/class/leds/pca963x\\:shelby\\:white\\:usb3_1/trigger");
    216                 sysprintf("echo usb3-port1 > /sys/class/leds/pca963x\\:shelby\\:white\\:usb3_2/trigger");
     227
     228                set_led_usbport("pca963x\\:shelby\\:white\\:usb3_2", "usb3-port1");
     229                set_led_usbport("pca963x\\:shelby\\:white\\:usb3_1", "usb2-port1 usb3-port1");
     230                set_led_usbport("pca963x\\:shelby\\:white\\:usb2", "usb1-port1");
    217231
    218232        }
     
    220234        if (brand == ROUTER_WRT_3200ACM) {
    221235                sysprintf("echo disk-activity > /sys/class/leds/rango\\:white\\:sata/brightness");
     236                set_led_usbport("pca963x\\:rango\\:white\\:usb3_2", "usb3-port1");
     237                set_led_usbport("pca963x\\:rango\\:white\\:usb3_1", "usb2-port1 usb3-port1");
     238                set_led_usbport("pca963x\\:rango\\:white\\:usb2", "usb1-port1");
     239
    222240        }
    223241
Note: See TracChangeset for help on using the changeset viewer.