Wifi configuration for Pine phone
#1
Hi,

I dont know if this is the right forum for this. 

I am looking for a document or guide on how to integrate a working wifi driver for the phone to a simple rootfs that is not based on any distro.

I am trying some trial and error referring to a PMOS rooots dump. But it would be nice to understand the method in detail.

I am using the pinephone as a device to know more about low level working for a linux device. 

Thanks in advance.
  Reply
#2
I hope I'm aiming this at the right level - lower than you get to in most distros but not poking about in kernel drivers or sysfs. WiFi doesn't seem much different to any other linux - load the kernel module for the wifi hardware (8723cs in this case) if it isn't autoloaded, then use the standard tools to configure it. There are a few choices when it comes to the tools to use, and most distros pick one or other as their preference. The Gentoo Handbook's WiFi Introduction gives a bit more overview than most, although it doesn't mention connman as an alternative to NetworkManager or wicd. In fact doing a gentoo install following the process in the handbook will give you a good overview of the various bits that go into making a linux system, and some of the choices that distros make. I don't think that's an option on a pinephone, but should be fine on a spare pc or a virtual machine. Arch may give you a similar level of choice, but I've not tried it.
  Reply
#3
(04-21-2020, 10:36 AM)wibble Wrote: I hope I'm aiming this at the right level - lower than you get to in most distros but not poking about in kernel drivers or sysfs. WiFi doesn't seem much different to any other linux - load the kernel module for the wifi hardware (8723cs in this case) if it isn't autoloaded, then use the standard tools to configure it. There are a few choices when it comes to the tools to use, and most distros pick one or other as their preference. The Gentoo Handbook's WiFi Introduction gives a bit more overview than most, although it doesn't mention connman as an alternative to NetworkManager or wicd. In fact doing a gentoo install following the process in the handbook will give you a good overview of the various bits that go into making a linux system, and some of the choices that distros make. I don't think that's an option on a pinephone, but should be fine on a spare pc or a virtual machine. Arch may give you a similar level of choice, but I've not tried it.

hi,

Thanks for the reply.

I had already loaded the firmware for the rtl8723cs and call the loaded the driver from a init script.

I am able to see the interface when i run ifconfig -a.

Also I am using buildroot to build the roots and had included some wireless tools but they are not recognizing the wlan0 as a wireless device. 

Let me go thru the link you shred. 

Thanks once again.
  Reply
#4
In that gentoo link, once you get past the introduction into the bits about editing /etc/conf.d/net that's OpenRC's network configuration format, so won't be directly applicable. It was more about showing the tools available. I'm not familiar with how buildroot does things, or whether it depends on which init you pick. It seems odd that the wireless tools aren't recognising the device. It's possible there's a step I'm not aware of because the OS versions I've tried are all doing it in the background.
  Reply
#5
(04-21-2020, 01:03 PM)wibble Wrote: In that gentoo link, once you get past the introduction into the bits about editing /etc/conf.d/net that's OpenRC's network configuration format, so won't be directly applicable. It was more about showing the tools available. I'm not familiar with how buildroot does things, or whether it depends on which init you pick. It seems odd that the wireless tools aren't recognising the device. It's possible there's a step I'm not aware of because the OS versions I've tried are all doing it in the background.

Based on the guide shared and some more additional info did this. 
Added a configuration for wpa_supplicant and added the wlan0 to the interfaces.  When I start wpa_supplicant I get this error. 

# wpa_supplicant -c -d -Dwext -iwlan0 -c/etc/wpa_supplicant.conf

Successfully initialized wpa_supplicant
ioctl[SIOCSIWAP]: Operation not permitted
wlan0: Trying to associate with 30:5a:3a:67:f3:8c (SSID='beezelbub' freq=2462 MHz)
Failed to add supported operating classes IE
wlan0: Association request to the driver failed
[  105.126813] ------------[ cut here ]------------
[  105.131517] WARNING: CPU: 3 PID: 69 at net/wireless/sme.c:756 __cfg80211_connect_result+0x260/0x318 [cfg80211]
[  105.141499] Modules linked in: 8723cs© cfg80211 rfkill
[  105.146811] CPU: 3 PID: 69 Comm: kworker/u8:3 Tainted: G        WC        5.6.0+ #10
[  105.154538] Hardware name: PinePhone (DT)
[  105.158587] Workqueue: cfg80211 cfg80211_event_work [cfg80211]
[  105.164411] pstate: 40000005 (nZcv daif -PAN -UAO)
[  105.169233] pc : __cfg80211_connect_result+0x260/0x318 [cfg80211]
[  105.175355] lr : __cfg80211_connect_result+0x228/0x318 [cfg80211]
[  105.181436] sp : ffff8000112abce0
[  105.184742] x29: ffff8000112abce0 x28: 0000000000000060
[  105.190044] x27: dead000000000100 x26: dead000000000122
[  105.195346] x25: 0000000000000000 x24: ffff00006cbe1ad8
[  105.200648] x23: ffff00006cbe1a48 x22: ffff00006cbe1a00
[  105.205950] x21: 0000000000000000 x20: ffff00006cbe0018
[  105.211252] x19: ffff00006cbe1a00 x18: ffff800010df1a70
[  105.216553] x17: 0000000000000002 x16: 0000000000000001
[  105.221856] x15: 0000000000000001 x14: 00000004000b344c
[  105.227158] x13: 90001add00000000 x12: 0000000000000000
[  105.232460] x11: 0000000000000000 x10: 00ffff1701ec334c
[  105.237762] x9 : 90001edd00000000 x8 : 0000000000000000
[  105.243063] x7 : 0000000000000000 x6 : 0000000000000002
[  105.248365] x5 : 0000000000000000 x4 : 0000000000000000
[  105.253667] x3 : 0000000000000000 x2 : 0000000000000000
[  105.258968] x1 : ffff00006f7e0000 x0 : 0000000000000000
[  105.264271] Call trace:
[  105.266753]  __cfg80211_connect_result+0x260/0x318 [cfg80211]
[  105.272528]  cfg80211_process_wdev_events+0x220/0x228 [cfg80211]
[  105.278561]  cfg80211_process_rdev_events+0x38/0x90 [cfg80211]
[  105.284423]  cfg80211_event_work+0x1c/0x30 [cfg80211]
[  105.289471]  process_one_work+0x1ec/0x3b0
[  105.293473]  worker_thread+0x140/0x518
[  105.297217]  kthread+0x118/0x120
[  105.300441]  ret_from_fork+0x10/0x1c
[  105.304010] ---[ end trace dd78a8345a8cfdf2 ]---
wlan0: Authentication with 30:5a:3a:67:f3:8c timed out.
ioctl[SIOCSIWAP]: Operation not permitted
wlan0: CTRL-EVENT-DISCONNECTED bssid=30:5a:3a:67:f3:8c reason=3 locally_generated=1

How to ensure that the wifi firmware is loaded into the kernel ?

Thanks.
  Reply
#6
The driver should try to load the required file from a path under /lib/firmware. In pmOS I have /lib/firmware/rtlwifi/ and /lib/firmware/rtl_bt/ containing a number of firmware files, supplied by packages linux-firmware-rtlwifi and linux-firmware-rtl_bt respectively. I don't know exactly which ones are used by this driver, or whether there's an interaction between the wifi and bluetooth drivers. You may need to check the distro bug trackers to see if there were any fixes for wifi problems in case there's something unusual they have to do to make it work reliably.
  Reply
#7
(04-22-2020, 05:08 AM)wibble Wrote: The driver should try to load the required file from a path under /lib/firmware. In pmOS I have /lib/firmware/rtlwifi/ and /lib/firmware/rtl_bt/ containing a number of firmware files, supplied by packages linux-firmware-rtlwifi and linux-firmware-rtl_bt respectively. I don't know exactly which ones are used by this driver, or whether there's an interaction between the wifi and bluetooth drivers. You may need to check the distro bug trackers to see if there were any fixes for wifi problems in case there's something unusual they have to do to make it work reliably.

Ok looks like the driver is getting loaded. I am able to use iw tools to see the available SSIDs in range. 
Also able to connect to open networks. 
Error is only for WPA2.

Any idea what could be the problem

thanks
  Reply
#8
How precisely are you trying to connect to the WPA2 secured network?
  Reply
#9
Ok got it to work now.

The problem was with the wpa_supplicant utility. I was trying to use the wext driver which had some compatibility issues with the kernel module cfg80211.
Now I rebuilt the wpa_supplicant with the nl80211 driver support and able to connect to the wifi AP.

Learnt a lot about udev/wpa_supplicant/wext/init.d and buildroot in general.

Thanks for the support and direction.
  Reply
#10
Glad to hear you've sorted it. Perhaps you could add some details of what you've done to the wiki in case anyone else wants to try buildroot.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How-To: Remote Control Your Phone from Desktop via VNC biketool 2 449 10-12-2024, 11:47 AM
Last Post: biketool
  Article: NuttX RTOS for PinePhone: Feature Phone UI in LVGL, Zig and WebAssembly lupyuen 64 26,227 09-09-2023, 09:49 AM
Last Post: WhiteHexagon
  Article: NuttX RTOS for PinePhone: Phone Calls and Text Messages lupyuen 2 1,934 05-03-2023, 05:03 PM
Last Post: lupyuen
  [Stupid Question] Where is the phone camera software?! newusername 5 3,794 10-10-2022, 03:58 AM
Last Post: newusername
Question New user/phone here - initial update issues sexywheat 2 2,203 06-29-2022, 04:27 PM
Last Post: sexywheat
  Which apps can I run on this phone? poppyhodler 2 2,926 06-07-2022, 12:18 PM
Last Post: jenniferjohn12
  Phone Operation which SW Realease (mute funtion)? scrwbigtek 0 1,047 05-25-2022, 07:35 AM
Last Post: scrwbigtek
  Jami on the Pine phone ? bcnaz 7 6,669 04-03-2022, 12:10 PM
Last Post: Fish
  First time pine phone user Matt73 3 3,093 03-10-2022, 02:04 AM
Last Post: Matt73
  Phone Shell Nextcloud message notifications: turn them off? lsitongia 0 1,407 09-28-2021, 11:04 AM
Last Post: lsitongia

Forum Jump:


Users browsing this thread: 1 Guest(s)