Changeset 17100


Ignore:
Timestamp:
05/21/11 12:15:51 (2 years ago)
Author:
BrainSlayer
Message:

fix led problem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/router/libutils/gpio.c

    r16345 r17100  
    6161                sprintf(buf, "/proc/gpio/%d_out", gpio); 
    6262        } else { 
    63                 sprintf(buf, "/proc/wl0gpio/%d_out", (gpio-GPIOMAX)); 
     63                sprintf(buf, "/proc/wl0gpio/%d_out", (gpio - GPIOMAX)); 
    6464        } 
    6565#undef GPIOMAX 
     
    128128        } 
    129129 
    130         /* 
     130        /* 
    131131         * Config bit as output  
    132132         */ 
     
    142142                return; 
    143143        } 
    144         /* 
     144        /* 
    145145         * Write data  
    146146         */ 
     
    154154                        strerror(errno), errno); 
    155155        } 
    156 //      fprintf(stderr,"done\n"); 
     156//      fprintf(stderr,"done\n"); 
    157157 
    158158        close(file); 
     
    701701void set_gpio(int pin, int value) 
    702702{ 
    703         int fd; 
    704         if ((fd = open("/dev/misc/gpio", O_RDWR)) < 0) { 
    705                 printf("Error whilst opening /dev/gpio\n"); 
    706                 return; 
    707         } 
    708703 
    709704        switch (pin) { 
     
    714709                break; 
    715710        default: 
     711                int fd; 
     712                if ((fd = open("/dev/misc/gpio", O_RDWR)) < 0) { 
     713                        printf("Error whilst opening /dev/gpio\n"); 
     714                        return; 
     715                } 
    716716                ioctl(fd, GPIO_DIR_OUT, pin); 
    717717                if (value) 
     
    719719                else 
    720720                        ioctl(fd, GPIO_CLEAR, pin); 
    721                 break; 
    722         } 
    723         close(fd); 
     721                close(fd); 
     722                break; 
     723        } 
    724724} 
    725725 
Note: See TracChangeset for help on using the changeset viewer.