Ubuntu Wireless disabled cannot turn it back on

To re-enable the wireless interface:
Wireless had been working just fine. I was going to be using only wired connection for a while, so I decided to just flip the wireless switch to OFF. Seems that the physical hardware switch to turn wireless networking (and Bluetooth) off actually sets a software setting in Ubuntu to DISABLE the wireless interface(s). Hardware switch on my HP Pavilion DV2000 is ON when pushed towards the RIGHT and OFF when towards the LEFT. Here’s what I did to get things working.

Entered the command string:
$ sudo ifconfig wlan0 up

(got the following response – pay attention to the “RF-kill” bits.)
SIOCSIFFLAGS: Operation not possible due to RF-kill
(OK – at this point, I entered the following search term in Google:
ubuntu 10.10 + SIOCSIFFLAGS: Operation not possible due to RF-kill
Came up with web sites that had info about the RF-Kill command and its options.)

(this checks what the NetworkManager thinks is happening – I had already used sudo to edit the following file with VI and set the “WirelessEnabled=false” to “true”)
$ cat /var/lib/NetworkManager/NetworkManager.state
OUTPUT:
[main]
NetworkingEnabled=true
WirelessEnabled=true
WWANEnabled=true

(now, remember the rfkill command? Use the following while moving the switch back and forth to see how the OS is really seeing)
$ sudo rfkill event
(OUTPUT)
type 1 op 0 soft 1 hard 1
type 1 op 0 soft 1 hard 0
type 2 op 0 soft 0 hard 0

(1st line shows that both the software & hardware are ON (1s) while line #3 shows both software & hardware are OFF (0s) – this is real time so moving switch produces more output, just watch the differences carefully.)
(now, do the following command to see that the OS says the wireless interface is indeed disabled, as far as it’s concerned.)

$ sudo lshw -C network
(OUTPUT)
*-network DISABLED 
description: Wireless interface
logical name: wlan0
(do that RFKILL again with different parameter and see the data listed in a bit more human-friendly format)

$ sudo rfkill list all
(OUTPUT)
0: phy0: Wireless LAN
Soft blocked: yes
Hard blocked: yes
1: hp-wifi: Wireless LAN
Soft blocked: yes
Hard blocked: yes
2: hp-bluetooth: Bluetooth
Soft blocked: no
Hard blocked: yes
(shows both software & hardware “switches” for wireless are currently “blocked” Note the Bluetooth hardware switch is turned off – wireless & Bluetooth share the same switch.)

(use the rfkill with Super User rights to unblock all the interfaces)
$ sudo rfkill unblock all
(then do the lshw to show what if anything is disabled)
$ sudo lshw -C network
(OUTPUT)
*-network 
description: Wireless interface

(OK, looks good! Check the NetworkManager’s state)
$ cat /var/lib/NetworkManager/NetworkManager.state
(OUTPUT)
[main]
NetworkingEnabled=true
WirelessEnabled=true
WWANEnabled=true

(Joy! The WiFi starts to do a DHCP lease request after issuing the network restart command with the following)
$ sudo /etc/init.d/network-manager restart
(should be good to go!)

http://www.linuxquestions.org/questions/ubuntu-63/wireless-became-disabled-how-do-i-enable-858357/

Following command:- 

sudo rfkill list all 

enabled the menu option. Then I selected and Enabled the check Box.