i was wondering if there was a way i could monitor the wlan interface to see if it was still up and then get it to start back up. i don't really know what's going on because once the wifi goes down the pi is incommunicado. there's nothing in dmesg. all it seems to show is me unplugging the device and plugging it back in when it fails.
Code: Select all
[ 12.446390] usbcore: registered new interface driver rtl8192cu
[ 20.399901] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ 21.126997] bcm2835 ALSA card created!
[ 21.140844] bcm2835 ALSA chip created!
[ 21.153073] bcm2835 ALSA chip created!
[ 21.159230] bcm2835 ALSA chip created!
[ 21.176427] bcm2835 ALSA chip created!
[ 21.184640] bcm2835 ALSA chip created!
[ 21.199231] bcm2835 ALSA chip created!
[ 21.206774] bcm2835 ALSA chip created!
[ 21.412618] i2c /dev entries driver
[ 40.318139] Adding 102396k swap on /var/swap. Priority:-1 extents:1 across:102396k SS
[1649595.574373] usb 1-1.2.3: USB disconnect, device number 5
[1649600.980981] usb 1-1.2.3: new high-speed USB device number 6 using dwc_otg
[1649601.082815] usb 1-1.2.3: New USB device found, idVendor=0bda, idProduct=8176
[1649601.082847] usb 1-1.2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1649601.082864] usb 1-1.2.3: Product: 802.11n WLAN Adapter
[1649601.082877] usb 1-1.2.3: Manufacturer: Realtek
[1649601.082890] usb 1-1.2.3: SerialNumber: 00e04c000001
[1759016.280963] usb 1-1.2.3: USB disconnect, device number 6
[1759018.620722] usb 1-1.2.3: new high-speed USB device number 7 using dwc_otg
[1759018.722604] usb 1-1.2.3: New USB device found, idVendor=0bda, idProduct=8176
[1759018.722635] usb 1-1.2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1759018.722652] usb 1-1.2.3: Product: 802.11n WLAN Adapter
[1759018.722666] usb 1-1.2.3: Manufacturer: Realtek
[1759018.722678] usb 1-1.2.3: SerialNumber: 00e04c000001
ps - here's the python script that runs at 4:30. it scrapes the weather off of weather.com and its output is piped to festival.
Code: Select all
#!/usr/bin/python
import urllib, re, time
content = urllib.urlopen ("http://www.weather.com/weather/right-now/94606").read()
timestr = re.sub ('AM','ay em',time.strftime('It is %A %B %d %Y, %I:%M %p'))
pat = re.compile (
'"temperature-fahrenheit".(?P<temp>-?\d+).+?'
'"weather-phrase">(?P<phrase>[A-Za-z ]+).+?'
'arrow wind-dir-(?P<winddir>[A-Z]+)".+?'
'wx-temp">(?P<windspd>\d+).+?'
'"humidity">(?P<humidity>\d+%).+?'
'incheshg">(?P<barometer>[0-9.]+).+?'
'wx-pressure-(?P<trend>[A-Za-z]+)'
, re.DOTALL)
m = pat.search (content)
windir = m.group ("winddir")
windir = windir.replace ('N', 'North ')
windir = windir.replace ('S', 'South ')
windir = windir.replace ('E', 'East ')
windir = windir.replace ('W', 'West ')
foo = '''{0}, current conditions are {2} and {1} degrees, humidity \
is {5}, wind is {4} miles per hour out of the {3},the barometer is \
{6} and {7}, now get the f*ck out of bed'''
print foo.format (timestr, m.group ("temp"),
m.group ("phrase"), windir, m.group ("windspd"), m.group ("humidity"),
m.group ("barometer"), m.group ("trend"))