Hi,

urtwn0 is a usb wifi connnection which work perfectly after bootup,
which got its configuration from /etc/hostname.urtwn0. But every time
resuming from zzz, it gets offline and need to online (sh /etc/netstart)
manually. Tried using /etc/apm/resume or ifstated(8) to execute "sh
/etc/netstart" in order to bring urtwn0 online but it doesn't work.
Instead, through /etc/apm/resume, ifstated(8) is able to bring urtwn0
online.

1. ifstated
"ifconfig urtwn0 down" after ifstated started (through
/etc/rc.d/ifstated) works correctly. But after resume, it doesn't seems
to do anything. /var/log/messages & /var/log/daemon didn't show anything
useful to me. A "/etc/rc.d/ifstated reload" fixes it and it then does
its job, bringing urtwn0 online. A possible bug in ifstated or I've
mis-configured ifstated?

2. /etc/apm/resume
After resume from zzz, the command "sh /etc/netstart" in /etc/apm/resume
doesn't seems get executed at all, or some error happens but didn't get
recorded in /var/log/messages or /var/log/daemon. Tried "set -x" (made
/etc/apm/resume as bourne shell script) but nothing useful shown in
those logfiles. Maybe I've done something wrong here?

3. With ifstated through /etc/apm/resume
By reloading ifstated in /etc/apm/resume, it works accordingly.

Although this achieve my purpose of bringing interface urtwn0 online
after resume, the extra step taken to bring urtwn0 online seems awkward.
What seems to be wrong in what I've done in ifstated or /etc/apm/resume
that it doesn't execute "sh /etc/netstart"?

Below are my configurations and logs I've noticed. Please do let me know
if more information is needed.

Regards,
Edward.

/etc/hostname.urtwn0:
        nwid ssid_name
        wpakey secret
        inet 10.10.10.2 255.0.0.0

/etc/ifstated-urtwn0.conf:
        urtwn0_up = "urtwn0.link.up"
        urtwn0_down = "!urtwn0.link.up"
        urtwn0_unknown = "urtwn0.link.unknown"

        net = '( "ping -q -c 1 -w 1 8.8.8.8 > /dev/null" every 10 )'
        gateway = '( "ping -q -c 1 -w 1 10.10.10.1 > /dev/null" every 10 )'

        state check {
                if $urtwn0_down || $urtwn0_unknown
                        set-state dead
        }

        state dead {
                init {
                        run "sh /etc/netstart"
                }
        }

/etc/apm/resume:
        #!/bin/sh

        # wait 5 for urtwn0 gets loaded
        sleep 5; /etc/rc.d/ifstated reload

/etc/rc.conf.local:
        ifstated_flags="-f /etc/ifstated-urtwn0.conf"

uname -a:
        OpenBSD laptop 5.5 GENERIC.MP#315 amd64

ifconfig urtwn0:
        urtwn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
                lladdr 90:61:0c:16:66:00
                priority: 4
                groups: wlan egress
                media: IEEE802.11 autoselect (OFDM54 mode 11g)
                status: active
                ieee80211: nwid ssid_name chan 10 bssid b8:a3:86:bf:22:bb 188dB 
wpakey <not displayed> wpaprotos wpa1,wpa2 wpaakms psk wpaciphers tkip,ccmp 
wpagroupcipher tkip
                inet 10.10.10.111 netmask 0xffffff00 broadcast 10.10.10.255
                inet6 fe80::9261:cff:fe16:540a%urtwn0 prefixlen 64 scopeid 0x16

/var/log/daemon:
        Jul  8 10:16:33 laptop apmd: system suspending
        Jul  8 10:16:46 laptop apmd: system resumed from sleep
        Jul  8 10:18:42 laptop apmd: system suspending
        Jul  8 10:19:25 laptop apmd: system resumed from sleep

/var/log/messages:
        Jul  8 10:16:33 laptop apmd: system suspending
        Jul  8 10:16:35 laptop /bsd: error: [drm:pid12060:i915_write8] *ERROR* 
Unknown unclaimed register before writing to 3b4
        Jul  8 10:16:46 laptop /bsd: error: [drm:pid12060:i915_write32] *ERROR* 
Unclaimed write to 70030
        Jul  8 10:16:46 laptop /bsd: error: 
[drm:pid12060:intel_dp_set_link_train] *ERROR* Timed out waiting for DP idle 
patterns
        Jul  8 10:16:46 laptop /bsd: error: [drm:pid12060:i915_write32] *ERROR* 
Unknown unclaimed register before writing to 64040
        Jul  8 10:16:46 laptop /bsd: urtwn0 detached
        Jul  8 10:16:46 laptop /bsd: wskbd1: disconnecting from wsdisplay0
        Jul  8 10:16:46 laptop /bsd: wskbd1 detached
        Jul  8 10:16:46 laptop /bsd: ukbd0 detached
        Jul  8 10:16:46 laptop /bsd: uhidev0 detached
        Jul  8 10:16:46 laptop /bsd: wsmouse1 detached
        Jul  8 10:16:46 laptop /bsd: ums0 detached
        Jul  8 10:16:46 laptop /bsd: uhid0 detached
        Jul  8 10:16:46 laptop /bsd: uhid1 detached
        Jul  8 10:16:46 laptop /bsd: uhid2 detached
        Jul  8 10:16:46 laptop /bsd: uhidev1 detached
        Jul  8 10:16:46 laptop /bsd: uhid3 detached
        Jul  8 10:16:46 laptop /bsd: uhid4 detached
        Jul  8 10:16:46 laptop /bsd: uhid5 detached
        Jul  8 10:16:46 laptop /bsd: uhid6 detached
        Jul  8 10:16:46 laptop /bsd: uhidev2 detached
        Jul  8 10:16:46 laptop /bsd: ugen0 detached
        Jul  8 10:16:46 laptop /bsd: video0 detached
        Jul  8 10:16:46 laptop /bsd: uvideo0 detached
        Jul  8 10:16:46 laptop /bsd: uhub1 detached
        Jul  8 10:16:46 laptop apmd: system resumed from sleep
        Jul  8 10:16:47 laptop /bsd: uhub1 at uhub0 port 1 "Intel Rate Matching 
Hub" rev 2.00/0.04 addr 2
        Jul  8 10:16:48 laptop /bsd: urtwn0 at uhub1
        Jul  8 10:16:48 laptop /bsd:  port 1 "Realtek 802.11n WLAN Adapter" rev 
2.00/2.00 addr 3
        Jul  8 10:16:49 laptop /bsd: urtwn0: MAC/BB RTL8192CU, RF 6052 2T2R, 
address 90:61:0c:16:66:00
        Jul  8 10:16:49 laptop /bsd: uhidev0 at uhub1
        Jul  8 10:16:49 laptop /bsd:  port 2 configuration 1 interface 0 
"Logitech USB Receiver" rev 2.00/12.01 addr 4
        Jul  8 10:16:49 laptop /bsd: uhidev0: iclass 3/1
        Jul  8 10:16:49 laptop /bsd: ukbd0 at uhidev0: 8 variable keys, 6 key 
codes
        Jul  8 10:16:50 laptop /bsd: wskbd1 at ukbd0 mux 1
        Jul  8 10:16:50 laptop /bsd: wskbd1: connecting to wsdisplay0
        Jul  8 10:16:50 laptop /bsd: uhidev1 at uhub1
        Jul  8 10:16:50 laptop /bsd:  port 2 configuration 1 interface 1 
"Logitech USB Receiver" rev 2.00/12.01 addr 4
        Jul  8 10:16:50 laptop /bsd: uhidev1: iclass 3/1, 8 report ids
        Jul  8 10:16:50 laptop /bsd: ums0 at uhidev1 reportid 2: 16 buttons, Z 
dir
        Jul  8 10:16:50 laptop /bsd: wsmouse1 at ums0 mux 0
        Jul  8 10:16:50 laptop /bsd: uhid0 at uhidev1 reportid 3: input=4, 
output=0, feature=0
        Jul  8 10:16:50 laptop /bsd: uhid1 at uhidev1 reportid 4: input=1, 
output=0, feature=0
        Jul  8 10:16:50 laptop /bsd: uhid2 at uhidev1 reportid 8: input=1, 
output=0, feature=0
        Jul  8 10:16:50 laptop /bsd: uhidev2 at uhub1
        Jul  8 10:16:50 laptop /bsd:  port 2 configuration 1 interface 2 
"Logitech USB Receiver" rev 2.00/12.01 addr 4
        Jul  8 10:16:50 laptop /bsd: uhidev2: iclass 3/0, 33 report ids
        Jul  8 10:16:50 laptop /bsd: uhid3 at uhidev2 reportid 16: input=6, 
output=6, feature=0
        Jul  8 10:16:50 laptop /bsd: uhid4 at uhidev2 reportid 17: input=19, 
output=19, feature=0
        Jul  8 10:16:50 laptop /bsd: uhid5 at uhidev2 reportid 32: input=14, 
output=14, feature=0
        Jul  8 10:16:50 laptop /bsd: uhid6 at uhidev2 reportid 33: input=31, 
output=31, feature=0
        Jul  8 10:16:50 laptop /bsd: ugen0 at uhub1
        Jul  8 10:16:50 laptop /bsd:  port 7 "Generic USB2.0-CRW" rev 
2.00/39.60 addr 5
        Jul  8 10:16:51 laptop /bsd: uvideo0 at uhub1
        Jul  8 10:16:51 laptop /bsd:  port 8 configuration 1 interface 0 "SuYin 
Integrated_Webcam_HD" rev 2.00/37.29 addr 6
        Jul  8 10:16:51 laptop /bsd: video0 at uvideo0
        Jul  8 10:18:42 laptop apmd: system suspending
        Jul  8 10:18:45 laptop /bsd: error: [drm:pid12060:i915_write8] *ERROR* 
Unknown unclaimed register before writing to 3b4
        Jul  8 10:19:05 laptop /bsd: error: [drm:pid12060:i915_write32] *ERROR* 
Unclaimed write to 70030
        Jul  8 10:19:05 laptop /bsd: error: 
[drm:pid12060:intel_dp_set_link_train] *ERROR* Timed out waiting for DP idle 
patterns
        Jul  8 10:19:05 laptop /bsd: error: [drm:pid12060:i915_write32] *ERROR* 
Unknown unclaimed register before writing to 64040
        Jul  8 10:19:05 laptop /bsd: urtwn0 detached
        Jul  8 10:19:05 laptop /bsd: wskbd1: disconnecting from wsdisplay0
        Jul  8 10:19:05 laptop /bsd: wskbd1 detached
        Jul  8 10:19:05 laptop /bsd: ukbd0 detached
        Jul  8 10:19:05 laptop /bsd: uhidev0 detached
        Jul  8 10:19:05 laptop /bsd: wsmouse1 detached
        Jul  8 10:19:05 laptop /bsd: ums0 detached
        Jul  8 10:19:05 laptop /bsd: uhid0 detached
        Jul  8 10:19:05 laptop /bsd: uhid1 detached
        Jul  8 10:19:05 laptop /bsd: uhid2 detached
        Jul  8 10:19:05 laptop /bsd: uhidev1 detached
        Jul  8 10:19:05 laptop /bsd: uhid3 detached
        Jul  8 10:19:05 laptop /bsd: uhid4 detached
        Jul  8 10:19:05 laptop /bsd: uhid5 detached
        Jul  8 10:19:05 laptop /bsd: uhid6 detached
        Jul  8 10:19:05 laptop /bsd: uhidev2 detached
        Jul  8 10:19:05 laptop /bsd: ugen0 detached
        Jul  8 10:19:05 laptop /bsd: video0 detached
        Jul  8 10:19:05 laptop /bsd: uvideo0 detached
        Jul  8 10:19:05 laptop /bsd: uhub1 detached
        Jul  8 10:19:06 laptop /bsd: uhub1 at uhub0 port 1 "Intel Rate Matching 
Hub" rev 2.00/0.04 addr 2
        Jul  8 10:19:07 laptop /bsd: urtwn0 at uhub1
        Jul  8 10:19:07 laptop /bsd:  port 1 "Realtek 802.11n WLAN Adapter" rev 
2.00/2.00 addr 3
        Jul  8 10:19:07 laptop /bsd: urtwn0: MAC/BB RTL8192CU, RF 6052 2T2R, 
address 90:61:0c:16:66:00
        Jul  8 10:19:08 laptop /bsd: uhidev0 at uhub1
        Jul  8 10:19:08 laptop /bsd:  port 2 configuration 1 interface 0 
"Logitech USB Receiver" rev 2.00/12.01 addr 4
        Jul  8 10:19:08 laptop /bsd: uhidev0: iclass 3/1
        Jul  8 10:19:08 laptop /bsd: ukbd0 at uhidev0: 8 variable keys, 6 key 
codes
        Jul  8 10:19:08 laptop /bsd: wskbd1 at ukbd0 mux 1
        Jul  8 10:19:08 laptop /bsd: wskbd1: connecting to wsdisplay0
        Jul  8 10:19:08 laptop /bsd: uhidev1 at uhub1
        Jul  8 10:19:08 laptop /bsd:  port 2 configuration 1 interface 1 
"Logitech USB Receiver" rev 2.00/12.01 addr 4
        Jul  8 10:19:08 laptop /bsd: uhidev1: iclass 3/1, 8 report ids
        Jul  8 10:19:08 laptop /bsd: ums0 at uhidev1 reportid 2: 16 buttons, Z 
dir
        Jul  8 10:19:08 laptop /bsd: wsmouse1 at ums0 mux 0
        Jul  8 10:19:08 laptop /bsd: uhid0 at uhidev1 reportid 3: input=4, 
output=0, feature=0
        Jul  8 10:19:08 laptop /bsd: uhid1 at uhidev1 reportid 4: input=1, 
output=0, feature=0
        Jul  8 10:19:08 laptop /bsd: uhid2 at uhidev1 reportid 8: input=1, 
output=0, feature=0
        Jul  8 10:19:08 laptop /bsd: uhidev2 at uhub1
        Jul  8 10:19:08 laptop /bsd:  port 2 configuration 1 interface 2 
"Logitech USB Receiver" rev 2.00/12.01 addr 4
        Jul  8 10:19:08 laptop /bsd: uhidev2: iclass 3/0, 33 report ids
        Jul  8 10:19:08 laptop /bsd: uhid3 at uhidev2 reportid 16: input=6, 
output=6, feature=0
        Jul  8 10:19:08 laptop /bsd: uhid4 at uhidev2 reportid 17: input=19, 
output=19, feature=0
        Jul  8 10:19:08 laptop /bsd: uhid5 at uhidev2 reportid 32: input=14, 
output=14, feature=0
        Jul  8 10:19:08 laptop /bsd: uhid6 at uhidev2 reportid 33: input=31, 
output=31, feature=0
        Jul  8 10:19:09 laptop /bsd: ugen0 at uhub1
        Jul  8 10:19:09 laptop /bsd:  port 7 "Generic USB2.0-CRW" rev 
2.00/39.60 addr 5
        Jul  8 10:19:10 laptop /bsd: uvideo0 at uhub1
        Jul  8 10:19:10 laptop /bsd:  port 8 configuration 1 interface 0 "SuYin 
Integrated_Webcam_HD" rev 2.00/37.29 addr 6
        Jul  8 10:19:10 laptop /bsd: video0 at uvideo0
        Jul  8 10:19:25 laptop apmd: system resumed from sleep

Reply via email to