我正在尝试使用adb连接到wifi,因为我的android设备未连接任何屏幕。
我这样做如下:
修改了文件data / misc / wifi / wpa_supplicant.conf
ctrl_interface=wlan0
update_config=1
manufacturer=XXInc.
device_name=Wireless Client
model_name=MTK Wireless Model
model_number=1.0
serial_number=2.0
device_type=XX-XXXX-5
os_version=01020300
config_methods=display push_button keypad
p2p_no_group_iface=1
driver_param=use_p2p_group_interface=1
hs20=1
network={
ssid="MYSSDID"
psk="MYPASSWORD"
scan_ssid=1
}
我的问题是:
如何向文件添加加密类型:WPA/WPA2 PSK
以及如何开始连接?
我尝试过:
adb shell am startservice -n com.google.wifisetup/.WifiSetupService -a WifiSetupService.Connect -e ssid <your_ssid> -e passphrase <your_password>
但找不到该服务:
Starting service: Intent { act=WifiSetupService.Connect cmp=com.google.wifisetup/.WifiSetupService }
Error: Not found; no service started.
这是我发现与wifi相关的
./system/etc/compiled-classes:6481:com.android.server.wifi.nano.WifiMetricsProto$AlertReasonCount
./system/etc/compiled-classes:6482:com.android.server.wifi.nano.WifiMetricsProto$ConnectionEvent
./system/etc/compiled-classes:6483:com.android.server.wifi.nano.WifiMetricsProto$RouterFingerPrint
./system/etc/compiled-classes:6484:com.android.server.wifi.nano.WifiMetricsProto$RssiPollCount
./system/etc/compiled-classes:6485:com.android.server.wifi.nano.WifiMetricsProto$SoftApDurationBucket
./system/etc/compiled-classes:6486:com.android.server.wifi.nano.WifiMetricsProto$SoftApReturnCodeCount
./system/etc/compiled-classes:6487:com.android.server.wifi.nano.WifiMetricsProto$StaEvent
./system/etc/compiled-classes:6488:com.android.server.wifi.nano.WifiMetricsProto$StaEvent$ConfigInfo
./system/etc/compiled-classes:6489:com.android.server.wifi.nano.WifiMetricsProto$WifiLog
./system/etc/compiled-classes:6490:com.android.server.wifi.nano.WifiMetricsProto$WifiLog$ScanReturnEntry
./system/etc/compiled-classes:6491:com.android.server.wifi.nano.WifiMetricsProto$WifiLog$WifiSystemStateEntry
./system/etc/compiled-classes:6492:com.android.server.wifi.nano.WifiMetricsProto$WifiScoreCount
谢谢
答案 0 :(得分:1)
这应该可以工作
adb shell am startservice -n com.google.wifisetup/.WifiSetupService -a WifiSetupService.Connect -e ssid <your_ssid> -e passphrase <your_password>