Wireless LEDs

From OLPC
Jump to: navigation, search

The XO has two leds dedicated to providing information on the wireless subsystem status. In this document we'll call them L (for left - the keyhole led) and R (for the led in the right hand).

The behavior of such LEDs can be customized with two iwpriv commands:

iwpriv eth0 ledgpio <parameters>
iwpriv eth0 ledbhv <parameters>

As of today (Oct 2008, build 8.2-767) these parameters have the following values:

iwpriv eth0 ledgpio
eth0    ledgpio:1 1 2 12 3 16

for state in `seq 0 10`; do iwpriv eth0 ledbhv ${state}; done
eth0      ledbhv:0  1  1  0  0  2  1  0  0  3  1  0  
eth0      ledbhv:1  1  2  4  1  2  1  0  1  3  2  4  
eth0      ledbhv:2  1  0  0  2  2  1  0  2  3  0  0  
eth0      ledbhv:3  1  1  0  3  2  1  0  3  3  1  0  
eth0      ledbhv:4  1  1  0  4  2  1  0  4  3  1  0  
eth0      ledbhv:5  1  0  0  5  2  1  0  5  3  1  0  
eth0      ledbhv:6  1  1  0  6  2  1  0  6  3  1  0  
eth0      ledbhv:7  1  1  0  7  2  1  0  7  3  1  0  
eth0      ledbhv:8  1  2  5  8  2  1  0  8  3  2  5  
eth0      ledbhv:9  1  0  0  9  2  2  4  9  3  1  0  
eth0      ledbhv:10  1  0  0  10  2  1  0  10  3  1  0 

But How do I interpret those numbers?



	ledgpio
		This command is used to set/get LEDs.

		iwpriv ethX ledgpio <LEDs>
			will set the corresponding LED for the GPIO Line.

		iwpriv ethX ledgpio
			will give u which LEDs are Enabled.

		Usage:
			iwpriv eth1 ledgpio 1 0 2 1 3 4
				will enable 
				LED 1 -> GPIO 0
				LED 2 -> GPIO 1
				LED 3 -> GPIO 4

			iwpriv eth1 ledgpio 
				shows LED information in the format as mentioned above.

		Note: LED0 is invalid
		Note: Maximum Number of LEDs are 16.	

	ledbhv
		This command can be used to change default LEDs behaviors. 
		A given LED behavior can be on, off or blinking. The duty/cycle can be set 
		when behavior is programmed as blinking. 
		
		Usage: 
			1. To get default LED behavior
				iwpriv mshX ledbhv <firmware state> 

			2. To set or change default LED behavior 
				iwpriv mshX ledbhv <firmware state> <lednum> <behavior> <arg> 
				firmware state: The following are some of the relevant states. 
					00: disconnected 
					01: firmware is scanning 
					02: firmware is connected and awake 
					03: firmware is sleeping 
					04: connected deep sleep 
					06: firmware disconnected link lost 
					07: firmware disconnected disassociated 
					09: data transfer while firmware is associated and not scanning. 
					    (If firmware is already in this state, LED behavior does not change
					     on this data transfer). 
					10: firmware idle, not scanning, not disconnected or disassociated.
				lednum: 1 or 2 for first and second LED. 
				behavior: 0 for steady ON, 1 - steady off and 2- blinking. 
				arg: It is used when behavior is 2 to set duty and cycle. It is defined as 
				(duty << 4 | cycle). Here duty could be 0..4 and cycle 0..5 for 34, 
				74, 149, 298, 596, 1192 ms respectively.
				
		Examples: 
			1. To get default behavior for scan
				iwpriv mshX ledbhv 1
			2. To get default behavior while data transfer 
				iwpriv mshX ledbhv 9 
			3. To turn off LED 2
                                iwpriv mshX ledbhv 2 2 1 0 
				iwpriv mshX ledbhv 10 2 1 0 
			4. To enable LED 2 and blink LED 1 while data transfer. 
				iwpriv mshX ledbhv 9 2 0 0
				iwpriv mshX ledbhv 9 1 2 4 
			5. To change duty cycle of LED 2 during data transfer 
				iwpriv mshX ledbhv 9 2 2 36 
			6. To turn ON LED 2 when firmware is disassociated/disconnected. 
				iwpriv mshX ledbhv 0 2 0 0