Thanks for the feedback Rod. I am new to this, so if that the best way to do it, I will submit the patch upstream and develop an alternative method to set the LED state during board initialisation. Nick.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rod Whitby Sent: 10 January 2008 23:36 To: OpenWrt Development List Subject: Re: [OpenWrt-Devel] [PATCH] Fix leds-gpio brightness for .active_low LEDs Nick Forbes wrote: > The leds-gpio driver initialises all LEDs in the OFF state, however it > incorrectly sets the "brightness" value to 255 (LED_FULL) for LEDs > which are ".active_low". This results in the LED being off at > initialisation, but the /sys/class/leds/xxxx/brightness value being > 255 instead of 0. > The attached patch corrects this and also allows each LED to be > initialised in the ON state via ".default_trigger". The patch has been > developed against AR7 but will work for any targets that use > "leds-gpio", and should go in the relevant "patches" folder > ("patches-2.6.23" for AR7). Shouldn't the patch simply fix the line that sets the brightness? > - led_dat->cdev.brightness = cur_led->active_low ? LED_FULL : > LED_OFF; > + led_dat->cdev.brightness = init_state ? LED_FULL : LED_OFF; + led_dat->cdev.brightness = LED_OFF; Since the gpio_led_set function handles the inversion of that 0 value into a non-zero value for the GPIO pin, this seems like a true bug in the driver which should be submitted upstream. Then you could just call gpio_led_set() in the board initialisation code. Unless you've already submitted this patch upstream and had it approved by the leds-gpio author, I strongly object to modifying a standard upstream file in this manner. You're effectively creating a permanently incompatible fork of the leds-gpio driver with your patch, whereas I thought a goal of OpenWrt was to push kernel patches upstream wherever possible rather than carrying incompatible patches locally. -- Rod _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel _____________________________________________________________________ Virus Checked for Huntsworth plc group of companies _____________________________________________________________________ _____________________________________________ Huntsworth is a world class communications group with public relations at its core, global in scale but rooted in domestic excellence. We house some of the world's leading PR agencies and offer expertise across a number of sectors including: consumer, finance, public affairs and technology together with an integrated healthcare offer. For more information visit our website www.huntsworth.com Huntsworth plc is registered in England No 1729478. Registered office is 15-17 Huntsworth Mews, London NW1 6DD _____________________________________________________________________ Virus Checked for Huntsworth plc group of companies _____________________________________________________________________ _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel