Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

There are some functions/hotkeys on my laptop that don't work like controlling brightness or turning on/off the wlan card. Fortunately for me i know how to control the brightness with setpci ex: setpci -s 00:02.0 F4.B=55 where 55 is the desired brightness level.

So the question is, how can i find my wlan card and make it go on/off.

This is the dumpregs command output:

cap pos w name
     00 W VENDOR_ID
     02 W DEVICE_ID
     04 W COMMAND
     06 W STATUS
     08 B REVISION
     09 B CLASS_PROG
     0a W CLASS_DEVICE
     0c B CACHE_LINE_SIZE
     0d B LATENCY_TIMER
     0e B HEADER_TYPE
     0f B BIST
     10 L BASE_ADDRESS_0
     14 L BASE_ADDRESS_1
     18 L BASE_ADDRESS_2
     1c L BASE_ADDRESS_3
     20 L BASE_ADDRESS_4
     24 L BASE_ADDRESS_5
     28 L CARDBUS_CIS
     2c L SUBSYSTEM_VENDOR_ID
     2e W SUBSYSTEM_ID
     30 L ROM_ADDRESS
     3c B INTERRUPT_LINE
     3d B INTERRUPT_PIN
     3e B MIN_GNT
     3f B MAX_LAT
     18 B PRIMARY_BUS
     19 B SECONDARY_BUS
     1a B SUBORDINATE_BUS
     1b B SEC_LATENCY_TIMER
     1c B IO_BASE
     1d B IO_LIMIT
     1e W SEC_STATUS
     20 W MEMORY_BASE
     22 W MEMORY_LIMIT
     24 W PREF_MEMORY_BASE
     26 W PREF_MEMORY_LIMIT
     28 L PREF_BASE_UPPER32
     2c L PREF_LIMIT_UPPER32
     30 W IO_BASE_UPPER16
     32 W IO_LIMIT_UPPER16
     38 L BRIDGE_ROM_ADDRESS
     3e W BRIDGE_CONTROL
     10 L CB_CARDBUS_BASE
     14 W CB_CAPABILITIES
     16 W CB_SEC_STATUS
     18 B CB_BUS_NUMBER
     19 B CB_CARDBUS_NUMBER
     1a B CB_SUBORDINATE_BUS
     1b B CB_CARDBUS_LATENCY
     1c L CB_MEMORY_BASE_0
     20 L CB_MEMORY_LIMIT_0
     24 L CB_MEMORY_BASE_1
     28 L CB_MEMORY_LIMIT_1
     2c W CB_IO_BASE_0
     2e W CB_IO_BASE_0_HI
     30 W CB_IO_LIMIT_0
     32 W CB_IO_LIMIT_0_HI
     34 W CB_IO_BASE_1
     36 W CB_IO_BASE_1_HI
     38 W CB_IO_LIMIT_1
     3a W CB_IO_LIMIT_1_HI
     40 W CB_SUBSYSTEM_VENDOR_ID
     42 W CB_SUBSYSTEM_ID
     44 L CB_LEGACY_MODE_BASE
  01 00 - CAP_PM
  02 00 - CAP_AGP
  03 00 - CAP_VPD
  04 00 - CAP_SLOTID
  05 00 - CAP_MSI
  06 00 - CAP_CHSWP
  07 00 - CAP_PCIX
  08 00 - CAP_HT
  09 00 - CAP_VNDR
  0a 00 - CAP_DBG
  0b 00 - CAP_CCRC
  0c 00 - CAP_HOTPLUG
  0d 00 - CAP_SSVID
  0e 00 - CAP_AGP3
  0f 00 - CAP_SECURE
  10 00 - CAP_EXP
  11 00 - CAP_MSIX
  12 00 - CAP_SATA
  13 00 - CAP_AF
0001 00 - ECAP_AER
0002 00 - ECAP_VC
0003 00 - ECAP_DSN
0004 00 - ECAP_PB
0005 00 - ECAP_RCLINK
0006 00 - ECAP_RCILINK
0007 00 - ECAP_RCECOLL
0008 00 - ECAP_MFVC
000a 00 - ECAP_RBCB
000b 00 - ECAP_VNDR
000d 00 - ECAP_ACS
000e 00 - ECAP_ARI
000f 00 - ECAP_ATS
0010 00 - ECAP_SRIOV
share|improve this question
    
Which model of laptop do you have? –  user76204 Dec 9 '12 at 11:24
add comment

1 Answer 1

Firstly, using setpci to directly set hardware registers and states can be risky just because of the very low-level hardware access, unless you know it has been tried before like with the brightness setting you mention.

Secondly, as I do not know your laptop model and thus its components technical specifications, this post is a just an introduction of how to find information with lspci and setpci, which you can adapt to your needs.

Thirdly, all the commands are fine to run, as they merely query the device; only setpci run with sudo will actually change a device setting.

(If you just want to drop the connection instead of actually switching the hardware device off you can select your wlan device and run sudo iwconfig wlan0 down. This is far (!) easier than trying to enable/disable the hardware device with setpci.)


First run lspci to find the addresses of all of your hardware; for example, my ethernet controller is

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)

Now use the bus address/domain (02:00:0) and run lspci again with

sudo lspci -s 02:00.0 -nnvvxxx

and you will get the full readout of the information available and a hex dump of the PCI configuration space:

02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ [10ec:8139] (rev 10)
    Subsystem: Billionton Systems Inc LNR-100 Family 10/100 Base-TX Ethernet [14cb:0200]
    Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
    Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
    Latency: 64 (8000ns min, 16000ns max)
    Interrupt: pin A routed to IRQ 17
    Region 0: I/O ports at 2400 [size=256]
    Region 1: Memory at 44000000 (32-bit, non-prefetchable) [size=512]
    Capabilities: [50] Power Management version 2
        Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0-,D1+,D2+,D3hot+,D3cold-)
        Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
    Kernel driver in use: 8139too
    Kernel modules: 8139too, 8139cp
00: ec 10 39 81 07 00 90 02 10 00 00 02 00 40 00 00
10: 01 24 00 00 00 00 00 44 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 02 01 00 00 cb 14 00 02
30: 00 00 00 00 50 00 00 00 00 00 00 00 11 01 20 40
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

The hex dump continues, but I have curtailed it; you will need further technical specifications of your device for these values to have any meaning.

Now with setpci --dumpregs you can find out about the general hardware registers and then use setpci to query the device address (02:00.0) with, for example, one of these registers:

setpci -s 02:00.0 STATUS

to return a value. This can be repeated with the other registers in the list, but again you need to refer to detailed technical information on your devices at the same time.

In summary, you will need to refer to the technical specifications of your WLAN card (and possibly PCI specifications) so that you can find and choose the correct register and then refer to the lspci and setpci data so you can prepare the sudo setpci command setting that enables/disables the card. It is not possible to find the correct register without in depth specifications, and often it is difficult to find the correct one anyway. However, I hope that this short discussion might help point you in the right direction.

share|improve this answer
    
Yes, that was a very good description of how things work. I am using a RTL8191SEvB card to which i can not find any specification. Can you please specify on what kind of specs im looking for? Btw, im sorry i didn't replied sooner, did the bounty go to you? –  alex Dec 18 '12 at 20:34
1  
@alex You probably need a detailed sheet listing the pci registers, but that may be difficult to come across, as the Realtek site doesn't seem to have any detailed specs. You may have to contact Realtek as I can't find any information either. –  user76204 Dec 23 '12 at 12:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.