WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: wifi.tcz  (Read 18293 times)

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: wifi.tcz
« Reply #30 on: November 14, 2013, 08:33:40 PM »
Quote
Problem: When connected to a wifi router, the name displayed in the DHCP client list is "unknown".
That may depend on the router in question, mostly the name is constructed from client MAC in such case.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline Gerrelt

  • Full Member
  • ***
  • Posts: 182
Re: wifi.tcz
« Reply #31 on: November 15, 2013, 08:26:00 AM »

I am using a TP-Link router, and it displays Client name, mac address and ip address. But the Client name is set to unknown, if the hostname is not specified with the udhcpc command.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Offline roberts

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: wifi.tcz
« Reply #32 on: November 16, 2013, 12:50:33 PM »
Gerrelt's patch accepted. Updated wifi.tcz posted to 4.x and 5.x repos as well as the dCore x86 and armv7 import directories.
10+ Years Contributing to Linux Open Source Projects.

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: wifi.tcz
« Reply #33 on: November 16, 2013, 01:14:51 PM »
piCore repos updated
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Gerrelt

  • Full Member
  • ***
  • Posts: 182
Re: wifi.tcz
« Reply #34 on: November 17, 2013, 12:25:03 PM »

Thanks guys!

I've update my wifi.tcz and everything is running good. I've tested it on three different wifi adapters.

One word of warning for people that want to use the -w option in a headless situation: When you add the command "wifi.sh -a -w" to bootlocal, do it after starting openssh or dropbear. When added before starting ssh, then if anything goes wrong with the wifi connection (wrong password or something), ssh will not be started. This means you cannot access your machine by plugging in a wired network. You will have to attach a keyboard and monitor to correct the situation.
So add it after starting ssh.

While typing this I realised this could probably also be solved by add ing a "&" to the end of the wifi start command. This will start it in the background, and return to the bootlocal script immediately. But I haven't tested that.

Greetings,

   Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Offline Gerrelt

  • Full Member
  • ***
  • Posts: 182
Re: wifi.tcz
« Reply #35 on: February 15, 2015, 09:12:32 AM »
Hello everybody,

I've got a proposal for a change to the wifi.tcz.

Problem:
I've encountered some problems with some WiFi adapters. Running wifi.sh produced only a partial access point list, and/or wouldn't automatically connect.
I traced the problem down to the adapter not being entirely ready scanning, but it does return an empty or partial list.
The problem is that in the wifi.sh script the "iwlist "$WIFI" scanning" command is executed too soon after "ifconfig "$WIFI" up".
At the moment of scanning, the network might be up, but the wifi adapter is not entirely started up yet. This results in a partial AP list. The adapter needs a little more time to complete the scan for AP points.
The automatic connect fails because of this reason too. Most of the times, it can not find the set accespoint name in the partial AP list.

Solution:
The "solution" is to wait a little before before executing the iwlist command. This solved the problem for some adapters, but not for all.
Apparently some adapters automatically start scanning after the "ifconfig "$WIFI" up" command, to prepare for the iwlist command.
But other adapters don't do this, and start the first scan when the "iwlist "$WIFI" scanning" is executed.

So, the solution is twofold:
- add a dummy iwlist scanning command right after ifconfig up, for starting the first scan.
- move the "sleep 1" from line 85 to line 83. Now it will sleep 1 second before each iwlist scanning try. This will give the WiFi adapter some time for scanning.

The drawback is that connecting to a wifi network takes one second longer, the benefit is that it makes the wifi connection much more reliable.

I've tested it on several WiFi adapters on piCore 6.0rc1, and piCore 6.0. Also user sbp tested this solution (only the sleep mod) on piCore 6.1alpha2.
And it seems to work great.

The difference report:
Code: [Select]
--- /tmp/tcloop/wifi/usr/local/bin/wifi.sh
+++ /home/tc/wifi.sh
@@ -78,11 +78,15 @@
 
 echo "Standby for scan of available networks..."
 ifconfig "$WIFI" up 2>/dev/null
+# do a dummy ap scan to start up the wifi adapter
+iwlist "$WIFI" scanning >/dev/null
 (for i in `seq 5`
 do
+        # sleep 1 sec to give the wifi adapter some time to complete scanning
+        sleep 1
+        # do actual scan
  iwlist "$WIFI" scanning
  [ "$?" == 0 ] && break
- sleep 1
 done ) | awk -v wifi="$WIFI" -v dbfile="$DB" -v mode="$MODE" -v obtainlease="$OBTAINLEASE" -v currenthostname=$CURRENTHOSTNAME -v ptmp="$PTMP" '
 BEGIN {
  RS="\n"

Greetings,
   
    Gerrelt.
« Last Edit: February 15, 2015, 09:14:41 AM by Gerrelt »
my Raspberry Pi page: http://raspberry.gerrelt.nl

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: wifi.tcz
« Reply #36 on: February 15, 2015, 12:13:40 PM »
Hi Gerrelt

thanks for the fix, it is OK for me. I will apply and update wifi.tcz

Béla
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Gerrelt

  • Full Member
  • ***
  • Posts: 182
Re: wifi.tcz
« Reply #37 on: February 15, 2015, 12:51:59 PM »
Hi Béla,


Great! Thanks.  :)

Greetings,
   Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 404
Re: wifi.tcz
« Reply #38 on: February 15, 2015, 08:05:59 PM »
Hi guys,

This issue only cropped up in piCore v6.1alpha2. Up till then connection to the wireless network worked 100% of the time.

I have noticed (in the past) that the first "scan" usually didn't show all the wireless networks but the main wireless networks always appeared. The second and subsequent scans usually showed one or two more networks but the extra networks were of marginal strength and never the ones I wanted to connect too.

What changed?

regards
Greg

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: wifi.tcz
« Reply #39 on: February 16, 2015, 01:13:37 AM »


What changed?


Only the kernel.


Az én iPad készülékemről küldve a Tapatalk segítségével
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline Gerrelt

  • Full Member
  • ***
  • Posts: 182
Re: wifi.tcz
« Reply #40 on: February 16, 2015, 07:06:34 AM »
What changed?

Hi Greg,

 I think this problem has become more visible because of the improved performance of piCore. Because it's faster, the wifi adapter now has less time to do a full AP scan. Which results in a empty or partial list.

Greetings,
    Gerrelt.
my Raspberry Pi page: http://raspberry.gerrelt.nl