Setting up a simple ad-hoc network can be done......the biggest problem
is that ad-hoc on the rpi does not support wpa encryption. All you can
do is open or WEP.
if you edit the file /opt/bootlocal.sh. Add the following lines AFTER
the #pCPstop------ line
Code:
--------------------
ifconfig | grep -q Bcast
if [ $? -ne 0 ]; then
echo "Entering Wifi Ad-Hoc mode"
pkill udhcpd
[ ! -d /var/lib/misc ] && mkdir /var/lib/misc
touch /var/lib/misc/udhcpd.lease
cat << EOF > /etc/udhcpd.conf
interface wlan0
start 10.10.10.2
end 10.10.10.10
opt subnet 255.255.255.0
opt dns 10.10.10.1
opt router 10.10.10.1
EOF
ifconfig wlan0 down
iwconfig wlan0 mode ad-hoc
iwconfig wlan0 key 1234567ABC
iwconfig wlan0 channel 6 essid pCP
ifconfig wlan0 10.10.10.1 netmask 255.255.255.0 up
udhcpd
DONE=0
until [ $DONE -ne 0 ]; do
if [ "$(iwgetid -r)" != "pCP" ]; then
echo "New SSID Connected"
DONE=1
fi
ifconfig eth0 | grep -q Bcast
if [ $? -eq 0 ]; then
echo "eth0 is now up"
DONE=1
fi
sleep 5
done
pkill udhcpd
echo "Exiting"
fi
--------------------
You can make the WEP key anything you want (as above its
1234567ABC)....... there is no DNS server so once the adhoc is up and
your device connects to it.......the address of the pCP device will be
10.10.10.1. My iphone takes along time to accept its dhcp lease,
perhaps setting that connection as a static would work faster. Again,
this setup is just for configuration. Once you click on Save/Connect on
the wifi page, wait for the backup to get done....you will see it try to
connect, this obviously kills the ad-hoc network. Your device should
come online just fine. If you are running LMS, then you probably need
to power cycle your box. If you want to force a reboot after
connecting, then put a line pcp rb after the echo "Exiting"
statement.
------------------------------------------------------------------------
paul-'s Profile: http://forums.slimdevices.com/member.php?userid=58858
View this thread: http://forums.slimdevices.com/showthread.php?t=107995
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix