silklabs / silk

Build IoT using JavaScript. Silk Open Source
MIT License
164 stars 29 forks source link

WiFi stopped working #14

Closed mloffer closed 8 years ago

mloffer commented 8 years ago

I began toying around yesterday with the Silk platform using the Xiaomi developer device. I was able to get a small application up and running successfully. However, when I went to run it again today the wifi on the device seems to be broken.

$ silk run Updating /data/node_modules/poweron --------- beginning of main 09-08 11:03:02.130 I/silk-init( 4545): Starting Silk --------- beginning of system 09-08 11:03:02.432 I/silk-init( 4529): initializing silk with main: poweron 09-08 11:03:02.517 I/silk-wifi( 4533): (+0ms) WiFi initializing 09-08 11:03:02.667 I/silk-init( 4529): silk-bledroid:info Connecting to '/dev/socket/bledroid' socket +0ms 09-08 11:03:02.690 I/silk-init( 4529): silk-bledroid:info Connected to '/dev/socket/bledroid' socket +24ms 09-08 11:03:02.796 I/silk-wifi( 4533): (+279ms) wlan0 state| 213 0 00:00:00:00:00:00 0.0.0.0 0 down 09-08 11:03:02.796 I/silk-wifi( 4533): 09-08 11:03:02.799 I/silk-wifi( 4533): (+3ms) wpaCli: supplicant not ready, waiting 09-08 11:03:02.803 I/silk-wifi( 4533): (+5ms) wpad restart: wpad error, reason=Error: connect ECONNREFUSED /dev/socket/wpad 09-08 11:03:03.805 I/silk-wifi( 4533): (+1s) wpaCli: supplicant not ready, waiting 09-08 11:03:03.809 I/silk-wifi( 4533): (+5ms) wpad restart: wpad error, reason=Error: connect ECONNREFUSED /dev/socket/wpad 09-08 11:03:04.808 I/silk-wifi( 4533): (+998ms) wpaCli: supplicant not ready, waiting 09-08 11:03:04.812 I/silk-wifi( 4533): (+5ms) wpad restart: wpad error, reason=Error: connect ECONNREFUSED /dev/socket/wpad

If I try to setup the network again I get an error on wlan0:

$ silk setupwifi <network> <password> Setup Wi-Fi network: <network> <password> ... error: wlan0

I've tried restarting the device via adb to no avail. Anyone have any other ideas?

mloffer commented 8 years ago

$ silk log I/kmsg ( 414): <6>[ 1736.191712] wlan: loading driver v3.0.10.085 I/kmsg ( 414): <4>[ 1736.687105] mdss_check_dsi_ctrl_status: unblank not complete, reschedule check status I/kmsg ( 414): <4>[ 1738.687087] mdss_check_dsi_ctrl_status: unblank not complete, reschedule check status I/kmsg ( 414): <4>[ 1740.687091] mdss_check_dsi_ctrl_status: unblank not complete, reschedule check status I/kmsg ( 414): <3>[ 1741.237132] wlan: [F :HDD] hdd_driver_init: WCNSS driver not ready E/NetlinkEvent( 370): NetlinkEvent::FindParam(): Parameter 'ALERT_NAME' not found E/NetlinkEvent( 358): NetlinkEvent::FindParam(): Parameter 'ALERT_NAME' not found E/wpad ( 7421): wifi_load_driver() failed: -1 I/wpad ( 7420): wpad terminated by exit(1) I/kmsg ( 414): <11>[ 1741.436346] init: Warning! Service silk-wpad needs a SELinux domain defined; please fix! D/WifiHW ( 7431): Unable to unload driver module "wlan": No such file or directory E/NetlinkEvent( 358): NetlinkEvent::FindParam(): Parameter 'ALERT_NAME' not found E/NetlinkEvent( 370): NetlinkEvent::FindParam(): Parameter 'ALERT_NAME' not found

mloffer commented 8 years ago

I flashed my device to the nightly build (v1.1.0) and wiped my userdata and cache.

I got a lot of permissions errors after this. Running setupwifi reported:

Failed to configure wifi Error: An error occured while running: adb push wifi_setup.sh /data/ Error: Command failed: /bin/sh -c adb push wifi_setup.sh /data/ failed to copy 'wifi_setup.sh' to '/data//wifi_setup.sh': Permission denied

/data itself is not accessible to the user silk-cli (v1.0.0 available via npm) runs as. I granted rwx permission to other and created the missing node_modules directory myself. This finally let me push my application to the device. However, setupwifi is back to reporting:

error: wlan0

:'(

mloffer commented 8 years ago

I was able to get wifi back by

  1. <device> # chmod 777 /data
  2. <PC> $ silk setupwifi <ssid> <pass>
  3. <device> # chmod 544 /data/wifi_setup.sh
  4. <device> # /data/wifi_setup.sh

Not sure what the permissions/users are intended to be, but this seems to work around the issue for now.

mvines commented 8 years ago

Thanks for the report @mloffer! The permissions error after you switched to the v1.1.0 nightly build was because silk setupwifi wasn't correctly switching to the root user. That unhelpful "error: wlan0" message should now be resolved as well. Fixed at c9c15b35a16320aa65b631132a754dd11acdc8a3 and I'll publish to npmjs on Monday.

I'm not sure why wifi stopped working for you yet originally though. If this happens again, please let me know and we can debug further (either reopen this issue or create a new one).