WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: iwconfig persistence settings  (Read 4772 times)

Offline KHarvey

  • Full Member
  • ***
  • Posts: 102
iwconfig persistence settings
« on: November 04, 2011, 02:39:43 PM »
It took me a while but I was finally able to get my wireless working.  I had an older version of TC that I was using, and when I downloaded the new version it solved most of my worldly wifi issues.
Now I have a working solution, but I am not sure I like how it works, which makes me think that I am not doing it right.

I created a /opt/wlan0.sh file with the following:
Quote
pkill udhcpc
sleep 13
iwconfig wlan0 essid xxx mode managed key xxxx
ifconfig wlan0 up
udhcpc -i wlan0
I then added this file to the filetool.lst so that it would be backed up.

So now I have 2 questions: 
  • What file is loading the /opt/wlan0.sh, as I did not see it in /mnt/sdc1/tce/onboot.lst?
  • Also, I added the sleep 13 as I could not get wlan0.sh to work unless I added in a timeout.  I tried bumping it down to 5 seconds but it still would not get an IP, so then I tried 10 and it worked most of the time, so then I settled on 13 seconds and it has worked everytime so far.  Is there another way that I should be setting up the persistence?
I just don't like using sleeps because I am just adding an arbitrary amount of loading time, I believe I should either check for a process to complete or just load in the proper order.

Any advice?

Once again sorry about the quote's rather than the code, I am not allowed to use code yet as it states I cannot post external links.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: iwconfig persistence settings
« Reply #1 on: November 04, 2011, 02:45:04 PM »
You need to call if from /opt/bootlocal.sh or /opt/bootsync.sh.

Offline KHarvey

  • Full Member
  • ***
  • Posts: 102
Re: iwconfig persistence settings
« Reply #2 on: November 04, 2011, 03:32:00 PM »
Perfect, thank you very much gerald_clark.  wlan0 is actually in bootlocal.sh, not sure how it got there as I did not put it there, but it works for me.  It looks like it is in the right spot as bootlocal.sh is used for processing background commands, while bootsync.sh is used to process boot commands.

So now I am just wondering if there is a better way to handle the sleep problem, as all of the other wlan0.sh scripts that I have seen do not have a wait time in them.  Also I guess I should clarify a little bit on what is happening.  If I do not use the sleep timeout then iwconfig never connects to a WAP, but it is up and has an IP.  I am assuming the IP is a carry over from before the computer was rebooted.
Also I think I have a problem with when the computer goes to sleep it appears to disconnects the wireless.  I'm currently testing this now, as I didn't notice it until I started writing this response.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11573
Re: iwconfig persistence settings
« Reply #3 on: November 04, 2011, 08:41:02 PM »
Hi KHarvey
If  udhcpc  is actually taking 10 seconds to shut down, you could try using the  nodhcp  boot code.

Offline KHarvey

  • Full Member
  • ***
  • Posts: 102
Re: iwconfig persistence settings
« Reply #4 on: November 07, 2011, 10:10:53 AM »
Thank you so much Rich.  You were actually right it was the pkill udhcpc that was causing the slow down.  So I removed that line and the sleep line and now it works perfectly.

For anyone else it now looks like
Quote
iwconfig wlan0 essid "xxxx" mode managed key xxxx
ifconfig wlan0 up
udhcpc -i wlan0

Once again thank you gerald_clark and Rich for your help.