Skip to content

Instantly share code, notes, and snippets.

@kylemanna
Last active June 27, 2023 23:12
Show Gist options
  • Star 78 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save kylemanna/6930087 to your computer and use it in GitHub Desktop.
Save kylemanna/6930087 to your computer and use it in GitHub Desktop.
Connmanctl Cheat Sheet

Connmanctl Cheat Sheet

Configure WiFi

  • Scan for access points (run multiple times for more complete scan):

      # connmanctl scan wifi
      Scan completed for wifi
    
  • Display access points discovered:

      # connmanctl services
      *AO Wired                ethernet_9059af5f4217_cable
          HOME-0842            wifi_009e959b585c_484f4d452d30383432_managed_psk
          ATT440               wifi_009e959b585c_415454343430_managed_psk
          andent               wifi_009e959b585c_616e64656e74_managed_psk
                               wifi_009e959b585c_hidden_managed_psk
          ATT512               wifi_009e959b585c_415454353132_managed_psk
          GoldenBearTriangle   wifi_009e959b585c_476f6c64656e42656172547269616e676c65_managed_psk
          Mr. Pamuk            wifi_009e959b585c_4d722e2050616d756b_managed_psk
          thegirls             wifi_009e959b585c_7468656769726c73_managed_psk
          HappyDays            wifi_009e959b585c_486170707944617973_managed_psk
          tipsycoopaloop       wifi_009e959b585c_7469707379636f6f70616c6f6f70_managed_psk
          2BlueWiFi            wifi_009e959b585c_32426c756557694669_managed_psk
    
  • Displays details on the AP of interest:

      # connmanctl services wifi_009e959b585c_32426c756557694669_managed_psk
      /net/connman/service/wifi_009e959b585c_32426c756557694669_managed_psk
        Type = wifi
        Security = [ psk ]
        State = idle
        Strength = 63
        Favorite = False
        Immutable = False
        AutoConnect = False
        Name = 2BlueWiFi
        Ethernet = [ Method=auto, Interface=wlan0, Address=00:9E:95:9B:58:5C, MTU=1500 ]
        IPv4 = [  ]
        IPv4.Configuration = [ Method=dhcp ]
        IPv6 = [  ]
        IPv6.Configuration = [ Method=auto, Privacy=disabled ]
        Nameservers = [  ]
        Nameservers.Configuration = [  ]
        Timeservers = [  ]
        Timeservers.Configuration = [  ]
        Domains = [  ]
        Domains.Configuration = [  ]
        Proxy = [  ]
        Proxy.Configuration = [  ]
        Provider = [  ]
    
  • Write config file for connecting to secure AP:

      # cat << EOF > /var/lib/connman/<SSID>-psk.config
      [service_wifi_<hash>_managed_psk]
      Type = wifi
      Name = <SSID>
      Passphrase = <passphrase>
      EOF
    
    • Should be automatically re-read without needing to restart connman.
    • Verify this worked correctly by re-running connmanctl services and observe Immutable, AutoConnect and Favorite are set to true.
  • Connect to the new secure AP:

      # connmanctl connect wifi_009e959b585c_32426c756557694669_managed_psk
    
    • Verify correct operation by running connmanctl services and observe the local interface address as well as DNS. Also can check ip addr ls and cat /etc/resolv.conf

Comments / Issues

  • WiFi driver + connman-1.17 + beaglebone appears to be buggy with connmanctl disable/enable
  • Connmanctl connect seems buggy, potential it calls enable?
@timinski
Copy link

timinski commented Feb 13, 2017

Also:
Frequency = XXXX (wfii frequency in mhz)

@elmor34
Copy link

elmor34 commented Jul 8, 2017

I have a BBBW most recent version

First wifi was working. But after upgrading linux,
I lost wifi.

ifconfig wlan0 up
wlan0: ERROR while getting interface flags: No such device
iwconfig wlan0
wlan0 No such device

wifi is enabled in /var/lib/connman/settings_
connmanctl technologies shows only ethernet.

I tried many linux versions, but I still get the same.
any idea?
Thanks

@sicada
Copy link

sicada commented Jan 22, 2018

@elmor34 I don't know if you ever solved your issue, but it is most likely due to a known flaw with the BeagleBone Green Wireless where the TI WL18xx Wifi chip gets stuck in a weird / abnormal state after warm reboot. The issue is discussed in depth in several threads such as:

https://groups.google.com/forum/#!topic/beagleboard/VnQVr0g9YA8
https://e2e.ti.com/support/wireless_connectivity/wilink_wifi_bluetooth/f/307/p/541669/1979197

I was able to recover my wifi functionality by upgrading to the latest BBGW kernel (4.4.110-ti-r143) by running the update_kernel.sh script at: /opt/scripts/tools/update_kernel.sh

@Napoleon-BlownApart
Copy link

Napoleon-BlownApart commented May 20, 2018

Where there are two or more known wireless networks available, is there a way of setting a priority order?
If not, is it possible to set the AutoConnect property to false for a particular SSID? I've tried doing this in the -psk.config file using AutoConnect = false but connman seems to ignore this setting, and looking into the <SSID>-psk/settings file the setting is set to true.

@smjaberl
Copy link

Hey,

Is there a chance to connect without scanning the networks?

I would use it in a embedded environment and it would be very useful, if I have a command like this:

connmanctl services wifi ssid=mywifi psk=123312

What is the hash good for?

regards
jan

@TylerCox
Copy link

Hey,

Is there a chance to connect without scanning the networks?

I would use it in a embedded environment and it would be very useful, if I have a command like this:

connmanctl services wifi ssid=mywifi psk=123312

What is the hash good for?

regards
jan

Speaking only as a developer who used the library, in my experience you need to have the ID string (the one containing a combination of the network name, and hardware ID mixed in and whatnot), after you have that string you could probably connect without scanning from then on, but you would have to at least scan once in the lifetime of that network usage. I'm pretty sure that this is due to the fact that connman wants to to be specific in your connection attempt in case somebody else uses the same wifi ID. When I dug through the API's I didn't see anything that looked like you could connect with only the wifi name ignoring an initial scan.

@smjaberl
Copy link

@TylerCox: Thanks, I think what I want to do is not wanted, because of security aspects.

Maybe it would be nice to add this to the cheat sheet:

"The symbols in the output above are: '*' favorite (saved) network, 'A' autoconnectable, 'O' online and 'R' ready. If no letter is shown in the O/R column, the network is not connected. In addition, temporary states include 'a' for association, 'c' configuration and 'd' disconnecting. When any of these three letters are showing, the network is in the process of connecting or disconnecting."
found at this point: https://01.org/connman/documentation

@acrossmovil
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment