nativedaemon uevent

这篇博客介绍了在Android 4.1中如何利用Netd服务和UEventObserver来检测USB线的插拔事件。通过分析UsbDeviceManager和Tethering类的调用栈,展示了USB功能切换的过程,如设置USB配置为rndis和adb。同时,提到了uevent初始化和uevent事件的处理方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

android 4.1 Netd详细分析

http://blog.youkuaiyun.com/xiaokeweng/article/details/8130218

 

03-30 15:53:03.128  3282  5303 D UsbDeviceManager:     at com.android.server.usb.UsbDeviceManager.setCurrentFunctions(UsbDeviceManager.java:981)
03-30 15:53:03.128  3282  5303 D UsbDeviceManager:     at com.android.server.usb.UsbService.setCurrentFunction(UsbService.java:300)
03-30 15:53:03.128  3282  5303 D UsbDeviceManager:     at android.hardware.usb.UsbManager.setCurrentFunction(UsbManager.java:551)
03-30 15:53:03.128  3282  5303 D UsbDeviceManager:     at com.android.server.connectivity.Tethering.setUsbTethering(Tethering.java:1149)
03-30 15:53:03.128  3282  5303 D UsbDeviceManager:     at com.android.server.connectivity.Tethering.enableTetheringInternal(Tethering.java:479)
03-30 15:53:03.128  3282  5303 D UsbDeviceManager:     at com.android.server.connectivity.Tethering.startTethering(Tethering.java:417)
03-30 15:53:03.128  3282  5303 D UsbDeviceManager:     at com.android.server.ConnectivityService.startTethering(ConnectivityService.java:3128)

 

03-30 15:53:03.129  3282  3927 I UsbDeviceManager: Setting USB config to rndis,adb
03-30 15:53:03.129  3282  3927 D UsbDeviceManager: setUsbConfig(none)
03-30 15:53:03.149   497   859 V AudioPolicyManagerCustom: getNewOutputDevice() selected device 0
03-30 15:53:03.175  4790  4790 D TetheringSettings: updateUsbState

03-30 15:53:03.186  3282  3927 D UsbDeviceManager: setUsbConfig(rndis,adb)

03-30 15:53:03.289  3282  4271 D NetdConnector: RCV <- {600 Iface added rndis0}
03-30 15:53:03.298  4313  4313 D wpa_supplicant: RTM_NEWLINK: ifi_index=24 ifname=rndis0 operstate=2 linkmode=0 ifi_family=0 ifi_flags=0x1002 ()
03-30 15:53:03.301  3282  4271 D NetdConnector: RCV <- {600 Iface linkstate rndis0 down}
03-30 15:53:03.313  3282  4272 D NetdConnector: SND -> {38 bandwidth gettetherstats}
03-30 15:53:03.316  3282  4271 D NetdConnector: RCV <- {200 38 Tethering stats list completed}
03-30 15:53:03.317  3282  4272 D NetdConnector: RMV <- {200 38 Tethering stats list completed}

 

Tethering.java

usbManager.setCurrentFunction(UsbManager.USB_FUNCTION_RNDIS);

usbService.java

UsbDeviceManager.setCurrentFunctions(function)

 

UEventObserver.java

frameworks/base/core/jni/android_os_UEventObserver.cpp

hardware/libhardware_legacy/uevent/uevent.c:42:int uevent_init()

 

 

USB线插拔检测使用UEventObserver检测uevent事件的分析

http://blog.youkuaiyun.com/yzhang8703/article/details/9429827?utm_source=tuicool&utm_medium=referral

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值