qcom charger

1.充电类型

The four power source types that are detected are:

1. Standard downstream port (SDP)
– This is a computer USB port capable of USB 1.1 (100 mA), USB 2.0 (100/500 mA), or USB 3.0 (150/900 mA). D+ and Dare independently pulled down in the host with a 14.2524.8 kΩ resistance.

2. Charging downstream port (CDP)
– This is typically a powered USB hub capable of 1.5 A.

3. Dedicated charging port (DCP)  标充
– This is a (standard wall charger) capable of at least 500 mA. D+ and D- are shorted in the wall adapter with a maximum
resistance of 200 Ω. SCHG defaults to high current mode and runs automatic input current limiting (AICL).


4. Other charging port (not covered by USB charging specification 1.2)
– This is a non-standard charger with a proprietary D+/D- configuration. Typically, these chargers have similar current
capability to normal DCPs. D+ and D- are connected to Vbus via a resistor divider, which causes them to be at specific fixed
voltage levels

    from <80-p2536-5a_e_pm8953_+_pmi8952_power_management_ic_design_guidelines_training_slides.pdf>
*/

2.charger

2.1 usb 插入、充电类型检测、快充检测

// 

 "usbin-src-det",


static irqreturn_t src_detect_handler(int irq, void *_chip)
{
....
if (src_detect) {
        update_usb_status(chip, usb_present, 0);
    } else {
        update_usb_status(chip, 0, false);
....
}


void update_usb_status(struct smbchg_chip *chip, bool usb_present, bool force)
{

...
            if (!chip->usb_present && usb_present) {
                    chip->usb_present = usb_present;
                    handle_usb_insertion(chip);
                } else if (chip->usb_present && !usb_present) {
                    chip->usb_present = usb_present;
                    handle_usb_removal(chip);
                }
...
}





 // usb插入开启快充检测

 static void handle_usb_insertion(struct smbchg_chip *chip)
 {
...
    read_usb_type(chip, &usb_type_name, &usb_supply_type);      ->    smbchg_read(chip, &reg, chip->misc_base + IDEV_STS, 1);    // 读取1608寄存器获取充电类型

    smbchg_change_usb_supply_type(chip, usb_supply_type);


         // 快充检测
        if (!chip->hvdcp_not_supported &&(usb_supply_type == POWER_SUPPLY_TYPE_USB_DCP)) 
        {
        cancel_delayed_work_sync(&chip->hvdcp_det_work);
        smbchg_stay_awake(chip, PM_DETECT_HVDCP);
        schedule_delayed_work(&chip->hvdcp_det_work,msecs_to_jiffies(HVDCP_NOTIFY_MS));
    }


 }

2.2 复充,充电截止






        pmi8950_fg: qcom,fg {
            spmi-dev-container;
            compatible = "qcom,qpnp-fg";
            #address-cells = <1>;
            #size-cells = <1>;
            qcom,resume-soc = <95>;            // 复充电量
            status = "okay";
            qcom,bcl-lm-threshold-ma = <127>;   
            qcom,bcl-mh-threshold-ma = <405>;
            qcom,fg-iterm-ma = <150>;               // 截止电流
            qcom,fg-chg-iterm-ma = <100>;       // 截止电流
                        qcom,fg-cutoff-voltage-mv = <3400>;    // 关机电压






// msm-pmi8950.dtsi
  pmi8950_charger: qcom,qpnp-smbcharger {
            spmi-dev-container;
            compatible = "qcom,qpnp-smbcharger";
                        qcom,iterm-ma = <256>;                                  // 充电截止电流
                        qcom,resume-delta-mv = <100>;                   // 复充电压
            qcom,chg-inhibit-fg;                                         // 如果有这个定义,则复充条件都使用上边的fg设置

            qcom,float-voltage-mv = <4400>;                    // Maximum voltage up to which the battery is charged; supported range is 3.6 V to 4.5 V.
                        qcom,thermal-mitigation = <1900 1900 1900 0>;   // 不同温度的电流限制


                         qcom,fg-cc-cv-threshold-mv = <4400>;       // cc - cv的电压条件
             qcom,autoadjust-vfloat;               // A Boolean property that when set, makes the driver automatically readjust vfloat using the fuel gauge ADC readings to make chargingmore accurate.
             }                        






//


        chip->chg_inhibit_source_fg = of_property_read_bool(node,"qcom,chg-inhibit-fg");        // 如果有这个定义,则截止电流复充条件都使用上边的fg设置





static int smbchg_hw_init(struct smbchg_chip *chip)

{

....
          // 复充条件使用fg adc还是
    /*
     * Based on the configuration, use the analog sensors or the fuelgauge
     * adc for recharge threshold source.
     */

    if (chip->chg_inhibit_source_fg)
        rc = smbchg_sec_masked_write(chip, chip->chgr_base + CHGR_CFG1,
            TERM_I_SRC_BIT | RECHG_THRESHOLD_SRC_BIT,
            TERM_SRC_FG | RECHG_THRESHOLD_SRC_BIT);
    else
        rc = smbchg_sec_masked_write(chip, chip->chgr_base + CHGR_CFG1,
            TERM_I_SRC_BIT | RECHG_THRESHOLD_SRC_BIT, 0);
....
}

2.3.根据pmic寄存器判断是否充满

get_prop_batt_status

2.4 根据充电类型限制充电电流

static int smbchg_change_usb_supply_type(struct smbchg_chip *chip,enum power_supply_type type)
{

if (type == POWER_SUPPLY_TYPE_USB)
        current_limit_ma = DEFAULT_SDP_MA;
    else if (type == POWER_SUPPLY_TYPE_USB)
        current_limit_ma = DEFAULT_SDP_MA;
    else if (type == POWER_SUPPLY_TYPE_USB_CDP)
        current_limit_ma = DEFAULT_CDP_MA;
    else if (type == POWER_SUPPLY_TYPE_USB_HVDCP)
        current_limit_ma = smbchg_default_hvdcp_icl_ma;         // 快充充电电流限制
    else if (type == POWER_SUPPLY_TYPE_USB_HVDCP_3)
        current_limit_ma = smbchg_default_hvdcp3_icl_ma;
    else
        current_limit_ma = smbchg_default_dcp_icl_ma;

        rc = vote(chip->usb_icl_votable, PSY_ICL_VOTER, true,
                current_limit_ma);

.....


}

2.5 充电电流限制的 vote & votable


static int smbchg_probe(struct spmi_device *spmi)

{

...
    // 创建充电电流限制的vote
    chip->usb_icl_votable = create_votable(&spmi->dev,
            "SMBCHG: usb_icl",
            VOTE_MIN, NUM_ICL_VOTER, 3000,
            set_usb_current_limit_vote_cb);   // 回调函数
....
}

2.6 获取充电状态

static int get_prop_batt_status(struct smbchg_chip *chip)
{
....
charger_present = is_usb_present(chip) | is_dc_present(chip) |
              chip->hvdcp_3_det_ignore_uv;
    if (!charger_present)
        return POWER_SUPPLY_STATUS_DISCHARGING;
...
    POWER_SUPPLY_STATUS_FULL
    POWER_SUPPLY_STATUS_NOT_CHARGING
    POWER_SUPPLY_STATUS_CHARGING
}

2.7 打开、关闭充电

static int smbchg_charging_en(struct smbchg_chip *chip, bool en)
{
/* The en bit is configured active low */
    return smbchg_masked_write(chip, chip->bat_if_base + CMD_CHG_REG,
            EN_BAT_CHG_BIT, en ? 0 : EN_BAT_CHG_BIT);
}

2.8 设置满电电压

static int smbchg_float_voltage_set(struct smbchg_chip *chip, int vfloat_mv)

2.9 限制充电电流

static int smbchg_set_fastchg_current_raw(struct smbchg_chip *chip,int current_ma)

2.10 thermal & jeta


cat sys/class/power_supply/battery/system_temp_level    // 正常值为0

qcom,thermal-mitigation = <1900 1900 1900 0>;   // 不同温度的电流限制

// 超过限制temp level会导致usb charger suspend

static int smbchg_system_temp_level_set(struct smbchg_chip *chip,int lvl_sel)
{
    ...
            if (chip->therm_lvl_sel == (chip->thermal_levels - 1)) {
                  // disable charger  
                  rc = vote(chip->usb_suspend_votable, THERMAL_EN_VOTER, true, 0);
               }
 ....

                //限制充电电流
                thermal_icl_ma =(int)chip->thermal_mitigation[chip->therm_lvl_sel];
            vote(chip->usb_icl_votable, THERMAL_ICL_VOTER, true,thermal_icl_ma);     
 ....

            if (prev_therm_lvl == chip->thermal_levels - 1)  //恢复回充温度
                // enable charger
                rc = vote(chip->usb_suspend_votable, THERMAL_EN_VOTER, false, 0);
...

}

2.11 是否支持快充

chip->hvdcp_not_supported

2.12.非标充

    usb_otg: usb@78db000 {
        compatible = "qcom,hsusb-otg";          // phy-msm-usb.c
...
                qcom,floated-charger-enable = <1>;   //enable float charger 需添加高通patch
...
    }

2.13 满电电量

POWER_SUPPLY_PROP_VOLTAGE_MAX

2.14 .限制充电电流

 smbchg_set_fastchg_current_raw(chip, val->intval);

3.fg

3.1 battery thermal && qcom,battery-data && some property (dts)

// msm8953-qrd.dtsi

&pmi8950_fg {
    compatible = "qcom,qpnp-fg";
    qcom,battery-data = <&qrd_batterydata>;

        // 通过fg内部adc读取温度值
        qcom,thermal-coefficients = [DA 86 F0 50 08 3C];            // ntc热敏电阻的系数查表得出  (80-nv610-41_c_linux_android_pmic_fuel_gauge_user_guide.pdf page 11    80-vt310-123_c_pmi8994_fuel_gauge_hw_sw_control.pdf page 14)
...

    }



/ {
    qrd_batterydata: qcom,battery-data {
        qcom,batt-id-range-pct = <15>;                  // battey_id 电阻精确范围
        #include "xxxxx_7000mAh_averaged_MasterSlave.dtsi"  
                #include "xxxxx_7000mAh_averaged_SecondSlave.dtsi" 
    };
};



// xxxx_7000mAh_averaged_MasterSlave.dtsi
qcom,xxxxxxx6000atl_7000mah_averaged_masterslave_feb15th2017 {
...
    qcom,batt-id-kohm = <51>;                       // battery id
    qcom,max-voltage-uv = <4400000>;                   // 满电电压
    qcom,nom-batt-capacity-mah = <7000>;            // 电池容量
        qcom,fastchg-current-ma = <2500>;                   // charger current

...



3.2 获取 battery_id 电阻大小 (POWER_SUPPLY_PROP_RESISTANCE_ID)

static int fg_power_get_property(struct power_supply *psy,
                       enum power_supply_property psp,
                       union power_supply_propval *val)

{
        case POWER_SUPPLY_PROP_RESISTANCE_ID:
                //val->intval = get_sram_prop_now(chip, FG_DATA_BATT_ID);
                 val->intval = cm_get_ID1();
                if(val->intval == 0x21)
                     val->intval = 100000;
                else
                val->intval =1000000;
                break;

}

3.3 根据battery_id获取最佳电池数据dtsi文件


static int fg_batt_profile_init(struct fg_chip *chip)
{

        /*
         (of_batterydata.c)   
         获取最佳node by "qcom,batt-id-kohm" 
         内阻值在 "qcom,batt-id-range-pct" 范围内则使用这个node    

         fg_batt_type 为指定电池name,如果指定就只会从指定name的 dts中查找,一般不指定
     */        
    profile_node = of_batterydata_get_best_profile(batt_node, "bms",fg_batt_type);     


}

3.4 qcom,charge-unknown-battery; bringup未设置电池参数时,开启这个选项

PMI8952 charger bringup without battery profile To allow charging to proceed with an unknown battery profile (for example, for bringup purposes before
battery characterization), include the following device tree property in your charger device tree node
(qcom,qpnp-smbcharger):
qcom,charge-unknown-battery;

3.5 高低温下满电、充电电流修改



//3.  msm-pmi8950.dtsi   warm charge cold charger 


--- a/arch/arm/boot/dts/qcom/msm-pmi8950.dtsi
+++ b/arch/arm/boot/dts/qcom/msm-pmi8950.dtsi
@@ -217,7 +217,7 @@
            qcom,aicl-rerun-period-s = <180>;
            qcom,autoadjust-vfloat;
            qcom,fastchg-current-comp = <700>;// 高低温下的充电电流 Supported values are 250, 700,900 and 1200mA. Set normal current is 2A.\u9ad8\u4f4e\u6e29\u8bbe\u7f6e\u7ea6\u4e3a0.3*2A
-           qcom,float-voltage-comp =<11>;//warm或者cool状态的限制电压为4.2V,4.4V对应的值0x2E.4.1V is 0x23, so 0x2E-0x23 = 11(10进制)( 80-nt391-2x_e_pmi8952_hardware_register_description.pdf  SMBCHGL_CHGR_FV_CFG)
+           qcom,float-voltage-comp =<9>;//warm或者cool状态的限制电压为4.2V,4.4V对应的值0x2E.4.1V is 0x23, so 0x2E-0x23 = 11(10进制)
            qcom,chgr@1000 {
                reg = <0x1000 0x100>;



diff --git a/drivers/power/qpnp-smbcharger.c b/drivers/power/qpnp-smbcharger.c
index bad46e2..36c1dd8 100644
--- a/drivers/power/qpnp-smbcharger.c
+++ b/drivers/power/qpnp-smbcharger.c
@@ -6207,7 +6203,16 @@ static irqreturn_t batt_warm_handler(int irq, void *_chip)
 {
    struct smbchg_chip *chip = _chip;
    u8 reg = 0;
-
+   int rc;
+   /* 高温设置满电电压为 4.24V */
+   if (chip->float_voltage_comp != -EINVAL) {
+       rc = smbchg_float_voltage_comp_set(chip,
+           chip->float_voltage_comp);
+       if (rc < 0)
+           dev_err(chip->dev, "Couldn't set float voltage comp rc = %d\n",rc);
+       pr_smb(PR_STATUS, "set float voltage comp to %d\n",
+           chip->float_voltage_comp);
+   }
    smbchg_read(chip, &reg, chip->bat_if_base + RT_STS, 1);
    chip->batt_warm = !!(reg & HOT_BAT_SOFT_BIT);
    pr_smb(PR_INTERRUPT, "triggered: 0x%02x\n", reg);


@@ -6223,7 +6228,11 @@ static irqreturn_t batt_cool_handler(int irq, void *_chip)
 {
    struct smbchg_chip *chip = _chip;
    u8 reg = 0;
-
+   int rc;
+   /* 低温设置满电电压为 4.4V*/
+   rc = smbchg_float_voltage_comp_set(chip,0);
+   if (rc < 0)
+       dev_err(chip->dev, "Couldn't set float voltage comp rc = %d\n",rc);
    smbchg_read(chip, &reg, chip->bat_if_base + RT_STS, 1);
    chip->batt_cool = !!(reg & COLD_BAT_SOFT_BIT);
    pr_smb(PR_INTERRUPT, "triggered: 0x%02x\n", reg);


3.6 电量跳变


// 4.

 //   修改内部电量计的更新频率


--- a/drivers/power/qpnp-fg.c
+++ b/drivers/power/qpnp-fg.c
@@ -1973,12 +1973,12 @@ static void fg_handle_battery_insertion(struct fg_chip *chip)
    schedule_delayed_work(&chip->update_sram_data, msecs_to_jiffies(0));
 }

-
+#if 0     //this function is not used for a while.  it used in the "fg_common_hw_init" function originally
 static int soc_to_setpoint(int soc)
 {
    return DIV_ROUND_CLOSEST(soc * 255, 100);
 }
-
+#endif
 static void batt_to_setpoint_adc(int vbatt_mv, u8 *data)
 {
    int val;
@@ -7931,7 +7931,7 @@ static int fg_common_hw_init(struct fg_chip *chip)
    }

    rc = fg_mem_masked_write(chip, settings[FG_MEM_DELTA_SOC].address, 0xFF,
-           soc_to_setpoint(settings[FG_MEM_DELTA_SOC].value),
+           settings[FG_MEM_DELTA_SOC].value,
            settings[FG_MEM_DELTA_SOC].offset);
    if (rc) {
        pr_err("failed to write delta soc rc=%d\n", rc);


3.7 fg从reg中读取数据值更新



static int update_sram_data(struct fg_chip *chip, int *resched_ms)


// fg_data[i] 的数据含义
enum fg_mem_data_index {
    FG_DATA_BATT_TEMP = 0,
    FG_DATA_OCV,
    FG_DATA_VOLTAGE,
    FG_DATA_CURRENT,
    FG_DATA_BATT_ESR,
    FG_DATA_BATT_ESR_COUNT,
    FG_DATA_BATT_SOC,
    FG_DATA_CC_CHARGE,
    FG_DATA_VINT_ERR,
    FG_DATA_CPRED_VOLTAGE,
    /* values below this only gets read once per profile reload */
    FG_DATA_BATT_ID,
    FG_DATA_BATT_ID_INFO,
    FG_DATA_MAX,
};

4. vadc

qpnp-adc-voltage.c

4.1 获取温度值方法一





 //4.1 mpp2设置为vac输入模式

pm8937_mpps: mpps {
    ...     
            mpp@a100 {     
                /* MPP2 - VBUS CHARGE THERMAL config */
                reg = <0xa100 0x100>;
                qcom,pin-num = <2>;
                qcom,mode = <4>; /* AIN input */
                qcom,invert = <1>; /* Enable MPP */
                qcom,ain-route = <1>; /* AMUX 6 */
                qcom,master-en = <1>;
                qcom,src-sel = <0>; /* Function constant */
            };
    ...
}


 // 4.2 mmp2对应chanel 11 ( form 80-nv610-45_b_pmic_adc_software_user_guide.pdf PM8952 AMUX channels )
pm8937_vadc: vadc@3100 {
    compatible = "qcom,qpnp-vadc";
...
        chan@11 {               
                    label = "vbus_therm";    
                    reg = <0x11>;
                    qcom,decimation = <0>;
                    qcom,pre-div-channel-scaling = <0>;
                    qcom,calibration-type = "ratiometric";
                    qcom,scale-function = <11>;  
                    qcom,hw-settle-time = <2>;
                    qcom,fast-avg-setup = <0>;
                    qcom,vadc-thermal-node;
                };
...
}



// 4.3 哪边使用此vadc,及标明channel值
pmi8937_charger: qcom,qpnp-smbcharger {
    ...
            qcom,vbus_therm-vadc = <&pm8937_vadc>;      
            qcom,board_temp-vadc = <&pm8937_vadc>;
            qcom,usbchg_temp-channel-id = <17>;
            qcom,board_temp-channel-id = <19>;
    ....        
        }


// 4.4 .c文件中使用adc

// 根据名字获取对应的adc   ( qcom,vbus_therm-vadc    -  snprintf(prop_name, QPNP_MAX_PROP_NAME_LEN, "qcom,%s-vadc", name);)
if (of_find_property(spmi->dev.of_node, "qcom,vbus_therm-vadc", NULL)) 
    qpnp_get_vadc(&spmi->dev, "vbus_therm");   



// 4.5获取adc数据
static inline int32_t qpnp_vadc_read(struct qpnp_vadc_chip *dev,uint32_t channel,struct qpnp_vadc_result *result)

4.2 获取温度值方法二


/*

*/


pm8937_mpps: mpps {
            compatible = "qcom,qpnp-pin";


            mpp@a100 {
                /* MPP2 - PA_THERM config */
                reg = <0xa100 0x100>;
                qcom,pin-num = <2>;
                qcom,mode = <4>; /* AIN input */
                qcom,invert = <1>; /* Enable MPP */
                qcom,ain-route = <1>; /* AMUX 6 */
                qcom,master-en = <1>;
                qcom,src-sel = <0>; /* Function constant */
            };





pm8937_vadc: vadc@3100 {
            compatible = "qcom,qpnp-vadc";
            reg = <0x3100 0x100>;
            #address-cells = <1>;
            #size-cells = <0>;
            interrupts = <0x0 0x31 0x0>;
            interrupt-names = "eoc-int-en-set";
            qcom,adc-bit-resolution = <15>;
            qcom,adc-vdd-reference = <1800>;
            qcom,vadc-poll-eoc;


            chan@11 {
                label = "pa_therm1";
                reg = <0x11>;
                qcom,decimation = <0>;
                qcom,pre-div-channel-scaling = <0>;
                qcom,calibration-type = "ratiometric";
                qcom,scale-function = <2>;
                qcom,hw-settle-time = <2>;
                qcom,fast-avg-setup = <0>;
                qcom,vadc-thermal-node;
            };



    struct thermal_zone_device *usb_connector_device;
        long temperature;

        usb_connector_device = thermal_zone_get_zone_by_name("pa_therm1");
    ret = thermal_zone_get_temp(usb_connector_device, &temperature);


struct charger_manager->desc->thermal_zone   = "thermal name"

5. usb3.0

// drivers\usb\dwc3\dwc3-msm.c
usb3: ssusb@7000000{
        compatible = "qcom,dwc-usb3-msm";
}

6. otg

//drivers\usb\phy\phy-msm-usb.c

    usb_otg: usb@78db000 {
        compatible = "qcom,hsusb-otg";         


power_supply_set_usb_otg  //设置otg是否在线

POWER_SUPPLY_PROP_USB_OTG

7. lk 获取开机原因



pm8950_get_pon_reason

target_pause_for_battery_charge   // 判断是否为关机充电

8. charger led

&pmi8950_charger {
...
    qcom,chg-led-sw-controls; 
    qcom,chg-led-support;   // charger led 使用pmi芯片默认的 CHG_LED pin脚
  ..

}

            // qpnp-smbcharger.c
            static int smbchg_probe(struct spmi_device *spmi)
            {
            ....
                if (chip->cfg_chg_led_support &&chip->schg_version == QPNP_SCHG_LITE) {         
                        rc = smbchg_register_chg_led(chip);
                }
            ....
            }
Line 18: 01-01 19:26:37.692480 1 1 E [ 14.908805]is_fastboot_adb_enabled: is_debuggable|cta|allcommode|aging test version,ingore Line 137: 01-01 19:26:38.165411 132 132 I [ 15.381736]wcd937x_codec wcd937x-codec: wcd_mbhc_start: usbc analog enabled Line 139: 01-01 19:26:38.165581 132 132 E [ 15.381906]wcd_mbhc_start: usbc_insert_pin in dt node is missing Line 462: 01-01 19:26:41.245371 902 902 I [ 18.461696]servicemanager: Caller(pid=2254,uid=0,sid=u:r:usbd:s0) Could not find android.hardware.usb.gadget.IUsbGadget/default in the VINTF manifest. No alternative instances declared in VINTF. Line 462: 01-01 19:26:41.245371 902 902 I [ 18.461696]servicemanager: Caller(pid=2254,uid=0,sid=u:r:usbd:s0) Could not find android.hardware.usb.gadget.IUsbGadget/default in the VINTF manifest. No alternative instances declared in VINTF. Line 462: 01-01 19:26:41.245371 902 902 I [ 18.461696]servicemanager: Caller(pid=2254,uid=0,sid=u:r:usbd:s0) Could not find android.hardware.usb.gadget.IUsbGadget/default in the VINTF manifest. No alternative instances declared in VINTF. Line 471: 01-01 19:26:41.384214 1 1 I [ 18.600539]: setusbconfig toadb Line 471: 01-01 19:26:41.384214 1 1 I [ 18.600539]: setusbconfig toadb Line 474: 01-01 19:26:41.397404 1705 1705 I [ 18.613729]msm-usb-hsphy 1613000.hsphy: Avail curr from USB = 2 Line 474: 01-01 19:26:41.397404 1705 1705 I [ 18.613729]msm-usb-hsphy 1613000.hsphy: Avail curr from USB = 2 Line 529: 01-01 19:26:41.659237 2423 2423 E [ 18.875562]: USB cable not connected Line 808: 01-01 19:26:45.895584 10 10 E [ 23.111909][kworke][0x22b3adb6][11:26:45.893158] wlan: [10:E:WMI] send_action_oui_cmd_tlv: Invalid action id Line 870: 01-01 19:26:51.533277 2386 2386 E [ 28.749602]: USB cable not connected Line 925: 01-01 19:26:55.678229 1 1 I [ 32.894554]init: processing action (vendor.sys.usb.adb.disabled=*) from (/system/etc/init/hw/init.usb.rc:23) Line 925: 01-01 19:26:55.678229 1 1 I [ 32.894554]init: processing action (vendor.sys.usb.adb.disabled=*) from (/system/etc/init/hw/init.usb.rc:23) Line 925: 01-01 19:26:55.678229 1 1 I [ 32.894554]init: processing action (vendor.sys.usb.adb.disabled=*) from (/system/etc/init/hw/init.usb.rc:23) Line 1076: 01-01 19:27:00.344412 3121 3121 W [ 37.560737]: stm_core(E) keyevent_handler(E) qcom_pm8008_regulator(E) ocp2130_bias(E) coresight(E) oplus_bsp_rfcablemonitor(E) oplus_secure_common(OE) oplus_security_keventupload(OE) qcom_vadc_common(E) icc_test(E) hung_task_enhance(E) oplus_mm_kevent(E) qti_battery_debug(E) oplus_bsp_fw_update(E) charger_ulog_glink(E) msm_tsens_driver(E) sps_drv(E) debugcc_sm6115(E) msm_geni_serial(E) usb_f_ccid(E) qcom_va_minidump(E) msm_lmh_dcvs(E) qpnp_lcdb_regulator(E) oplus_bsp_tp_custom(E) oplus_bsp_tp_notify(E) qcom_i2c_pmic(E) oplus_resctrl(E) ucsi_glink(E) oplus_bsp_sensor_feedback(E) init_watchdog(E) olc(E) hung_task_enh(E) pmic_glink_debug(E) oplus_exit_mm_optimize(E) bwmon(E) altmode_glink(E) oplus_bsp_mapped_protect(E) oplus_theia(E) phy_msm_qusb_v2(E) memlat(E) core_hang_detect(E) gpucc_sm6115(E) boot_stats(E) pmic_glink(E) rpm_master_stat(E) debugcc_khaje(E) dispcc_khaje(E) rq_stats(E) glink_pkt(E) cdsprm(E) oplus_bsp_dynamic_readahead(E) msm_gpi(E) cdsp_loader(E) eud(E) Line 1076: 01-01 19:27:00.344412 3121 3121 W [ 37.560737]: stm_core(E) keyevent_handler(E) qcom_pm8008_regulator(E) ocp2130_bias(E) coresight(E) oplus_bsp_rfcablemonitor(E) oplus_secure_common(OE) oplus_security_keventupload(OE) qcom_vadc_common(E) icc_test(E) hung_task_enhance(E) oplus_mm_kevent(E) qti_battery_debug(E) oplus_bsp_fw_update(E) charger_ulog_glink(E) msm_tsens_driver(E) sps_drv(E) debugcc_sm6115(E) msm_geni_serial(E) usb_f_ccid(E) qcom_va_minidump(E) msm_lmh_dcvs(E) qpnp_lcdb_regulator(E) oplus_bsp_tp_custom(E) oplus_bsp_tp_notify(E) qcom_i2c_pmic(E) oplus_resctrl(E) ucsi_glink(E) oplus_bsp_sensor_feedback(E) init_watchdog(E) olc(E) hung_task_enh(E) pmic_glink_debug(E) oplus_exit_mm_optimize(E) bwmon(E) altmode_glink(E) oplus_bsp_mapped_protect(E) oplus_theia(E) phy_msm_qusb_v2(E) memlat(E) core_hang_detect(E) gpucc_sm6115(E) boot_stats(E) pmic_glink(E) rpm_master_stat(E) debugcc_khaje(E) dispcc_khaje(E) rq_stats(E) glink_pkt(E) cdsprm(E) oplus_bsp_dynamic_readahead(E) msm_gpi(E) cdsp_loader(E) eud(E) Line 1078: 01-01 19:27:00.344518 3121 3121 W [ 37.560843]: gcc_khaje(E) oplus_bsp_task_sched(E) gcc_sm6115(E) mem_buf(E) qcom_dma_heaps(E) qseecom_dlkm(OE) oplus_kmsg_wb(E) phy_qcom_ufs_qmp_v3_660(E) phy_qcom_ufs_qrbtc_sdm845(E) phy_qcom_ufs_qmp_v4_khaje(E) qrtr(E) qcom_glink(E) qnoc_bengal(E) qcom_soc_wdt(E) ua_cpu_ioctl(E) smp2p(E) ufshcd_crypto_qti(E) usbpd(E) clk_qcom(E) crypto_qti_common(E) dcc_v2(E) device_info(E) icc_rpm(E) mem_buf_dev(E) oplus_bsp_frame_boost(E) mem_offline(E) memory_dump_v2(E) msm_poweroff(E) oplus_phoenix(E) pinctrl_bengal(E) oplus_schedinfo(E) qcom_iommu_util(E) phy_qcom_ufs(E) oplus_pmicwd(E) pinctrl_khaje(E) qcom_ipc_logging(E) qcom_logbuf_vh(E) rpm_smd_regulator(E) qcom_wdt_core(E) boot_mode(E) gdsc_regulator(E) crypto_qti_tz(E) minidump(E) oplus_bsp_sched_assist(E) oplus_project(E) oplus_mdmfeature(E) oplus_uprobe(E) pinctrl_msm(E) phoenix_reboot_speed(E) qcom_cpufreq_hw(E) qcom_spmi_pmic(E) qcom_smd(E) secure_buffer(E) socinfo(E) rpm_smd(E) qpnp_power_on(E) stub_regulator(E) Line 1079: 01-01 19:27:00.344580 3121 3121 W [ 37.560905]: buildvariant(E) bootloader_log(E) debug_regulator(E) cdt_integrity(E) iommu_logger(E) icc_debug(E) horae_shell_temp(E) kernel_fb(E) msm_dma_iommu_mapping(E) last_boot_reason(E) oplus_bsp_eas_opt(E) nvmem_qcom_spmi_sdam(E) nvmem_qfprom(E) oplus_bsp_midas(E) oplus_bsp_task_cpustats(E) oplus_bsp_mm_osvelte(E) oplus_bsp_task_load(E) oplus_storage_log(E) oplus_fdleak_check(E) oplus_power_notifier(E) oplus_omrg(E) oplus_ftm_mode(E) soc_sleep_stats(E) oplus_mdmrst(E) oplusboot(E) proxy_consumer(E) qcom_apcs_ipc_mailbox(E) smem(E) qcom_dcvs(E) qcom_cpu_vendor_hooks(E) qcom_enhance_watchdog(E) qcom_mpm(E) qcom_pmu_lib(E) qcom_scm(E) qnoc_qos_rpm(E) qrng_dlkm(OE) regmap_spmi(E) qti_regmap_debugfs(E) sdcardfs(E) shutdown_speed(E) spmi_pmic_arb(E) slimbus(E) qcom_hwspinlock(E) Line 1546: 01-01 19:27:22.292131 4918 4918 W [ 59.508456]: Modules linked in: camera(OE) machine_dlkm(OE) wcd937x_dlkm(OE) mbhc_dlkm(OE) fsa4480_i2c(E) oplus_chg_symbol(E) wlan(OE) ipa_clientsm(OE) rndisipam(OE) ipanetm(OE) oplus_chg(E) ipam(OE) rx_macro_dlkm(OE) va_macro_dlkm(OE) tx_macro_dlkm(OE) wcd9xxx_dlkm(OE) pinctrl_lpi_dlkm(OE) adsp_loader_dlkm(OE) audio_pkt_dlkm(OE) swr_ctrl_dlkm(OE) audio_prm_dlkm(OE) bolero_cdc_dlkm(OE) coresight_tmc(E) spf_core_dlkm(OE) gpr_dlkm(OE) usb_f_gsi(E) usb_f_qdss(E) q6_notifier_dlkm(OE) oplus_audio_sipa_tuning(OE) leds_qti_flash(E) oplus_bsp_tp_ft3658u_spi(E) oplus_bsp_tp_ft3419u(E) oplus_bsp_tp_td4377_noflash(E) rmnet_wlan(OE) oplus_bsp_tp_ft3518(E) wcd937x_slave_dlkm(OE) qcom_pon(E) oplus_bsp_tp_ilitek7807s(E) oplus_chg_v2(E) tcpc_rt1711h(E) tcpci_late_sync(E) nxp_nci(OE) oplus_audio_aw87xxx(OE) oplus_bsp_tp_focal_common(E) oplus_network_linkpower_module(OE) bt_fm_slim(OE) coresight_hwevent(E) coresight_tpdm(E) icnss2(OE) nq330(E) dump_reason(E) wsa881x_analog_dlkm(OE) Line 1546: 01-01 19:27:22.292131 4918 4918 W [ 59.508456]: Modules linked in: camera(OE) machine_dlkm(OE) wcd937x_dlkm(OE) mbhc_dlkm(OE) fsa4480_i2c(E) oplus_chg_symbol(E) wlan(OE) ipa_clientsm(OE) rndisipam(OE) ipanetm(OE) oplus_chg(E) ipam(OE) rx_macro_dlkm(OE) va_macro_dlkm(OE) tx_macro_dlkm(OE) wcd9xxx_dlkm(OE) pinctrl_lpi_dlkm(OE) adsp_loader_dlkm(OE) audio_pkt_dlkm(OE) swr_ctrl_dlkm(OE) audio_prm_dlkm(OE) bolero_cdc_dlkm(OE) coresight_tmc(E) spf_core_dlkm(OE) gpr_dlkm(OE) usb_f_gsi(E) usb_f_qdss(E) q6_notifier_dlkm(OE) oplus_audio_sipa_tuning(OE) leds_qti_flash(E) oplus_bsp_tp_ft3658u_spi(E) oplus_bsp_tp_ft3419u(E) oplus_bsp_tp_td4377_noflash(E) rmnet_wlan(OE) oplus_bsp_tp_ft3518(E) wcd937x_slave_dlkm(OE) qcom_pon(E) oplus_bsp_tp_ilitek7807s(E) oplus_chg_v2(E) tcpc_rt1711h(E) tcpci_late_sync(E) nxp_nci(OE) oplus_audio_aw87xxx(OE) oplus_bsp_tp_focal_common(E) oplus_network_linkpower_module(OE) bt_fm_slim(OE) coresight_hwevent(E) coresight_tpdm(E) icnss2(OE) nq330(E) dump_reason(E) wsa881x_analog_dlkm(OE) Line 1548: 01-01 19:27:22.292323 4918 4918 W [ 59.508648]: oplus_networks_tuning(OE) pm8941_pwrkey(E) coresight_remote_etm(E) leds_aw2023(E) qti_qmi_sensor(E) usb_f_diag(E) rt_regmap(E) bcl_soc(E) cpu_hotplug(E) cnss_prealloc(OE) qcom_spmi_temp_alarm(E) oplus_security_guard(OE) qcom_spmi_adc_tm5(E) reboot_mode(E) regulator_cdev(E) i2c_msm_geni(E) qcom_iommu_debug(E) oplus_bsp_tp_ilitek_common(E) qrtr_smd(E) thermal_pause(E) ehset(E) msm_mmrm(OE) leds_qpnp_vibrator_ldo(E) ufcs_class(E) cpufreq_ondemand(E) game_opt(OE) coresight_tgu(E) oplus_data_module(OE) stm_console(E) oplus_audio_pa_manager(OE) qcom_pil_info(E) phy_msm_ssusb_qmp(E) msm_sharedmem(E) oplus_stability_helper(OE) phy_msm_qusb(E) iolimit(E) pmic_monitor(E) spi_msm_geni(E) qcom_spmi_adc5(E) oplus_bsp_memleak_detect(OE) ipa_fmwk(E) msm_qmp(E) oplus_bsp_ir_core(E) qfprom_sys(E) cx_ipeak(E) oplus_bsp_dfr_ubt(E) guestvm_loader(E) qcom_cpufreq_hw_debug(E) rpm_smd_debug(E) leds_qpnp_flash_v2(E) tz_log_dlkm(OE) oplus_game_first(OE) shutdown_detect(E) Line 1548: 01-01 19:27:22.292323 4918 4918 W [ 59.508648]: oplus_networks_tuning(OE) pm8941_pwrkey(E) coresight_remote_etm(E) leds_aw2023(E) qti_qmi_sensor(E) usb_f_diag(E) rt_regmap(E) bcl_soc(E) cpu_hotplug(E) cnss_prealloc(OE) qcom_spmi_temp_alarm(E) oplus_security_guard(OE) qcom_spmi_adc_tm5(E) reboot_mode(E) regulator_cdev(E) i2c_msm_geni(E) qcom_iommu_debug(E) oplus_bsp_tp_ilitek_common(E) qrtr_smd(E) thermal_pause(E) ehset(E) msm_mmrm(OE) leds_qpnp_vibrator_ldo(E) ufcs_class(E) cpufreq_ondemand(E) game_opt(OE) coresight_tgu(E) oplus_data_module(OE) stm_console(E) oplus_audio_pa_manager(OE) qcom_pil_info(E) phy_msm_ssusb_qmp(E) msm_sharedmem(E) oplus_stability_helper(OE) phy_msm_qusb(E) iolimit(E) pmic_monitor(E) spi_msm_geni(E) qcom_spmi_adc5(E) oplus_bsp_memleak_detect(OE) ipa_fmwk(E) msm_qmp(E) oplus_bsp_ir_core(E) qfprom_sys(E) cx_ipeak(E) oplus_bsp_dfr_ubt(E) guestvm_loader(E) qcom_cpufreq_hw_debug(E) rpm_smd_debug(E) leds_qpnp_flash_v2(E) tz_log_dlkm(OE) oplus_game_first(OE) shutdown_detect(E) Line 1548: 01-01 19:27:22.292323 4918 4918 W [ 59.508648]: oplus_networks_tuning(OE) pm8941_pwrkey(E) coresight_remote_etm(E) leds_aw2023(E) qti_qmi_sensor(E) usb_f_diag(E) rt_regmap(E) bcl_soc(E) cpu_hotplug(E) cnss_prealloc(OE) qcom_spmi_temp_alarm(E) oplus_security_guard(OE) qcom_spmi_adc_tm5(E) reboot_mode(E) regulator_cdev(E) i2c_msm_geni(E) qcom_iommu_debug(E) oplus_bsp_tp_ilitek_common(E) qrtr_smd(E) thermal_pause(E) ehset(E) msm_mmrm(OE) leds_qpnp_vibrator_ldo(E) ufcs_class(E) cpufreq_ondemand(E) game_opt(OE) coresight_tgu(E) oplus_data_module(OE) stm_console(E) oplus_audio_pa_manager(OE) qcom_pil_info(E) phy_msm_ssusb_qmp(E) msm_sharedmem(E) oplus_stability_helper(OE) phy_msm_qusb(E) iolimit(E) pmic_monitor(E) spi_msm_geni(E) qcom_spmi_adc5(E) oplus_bsp_memleak_detect(OE) ipa_fmwk(E) msm_qmp(E) oplus_bsp_ir_core(E) qfprom_sys(E) cx_ipeak(E) oplus_bsp_dfr_ubt(E) guestvm_loader(E) qcom_cpufreq_hw_debug(E) rpm_smd_debug(E) leds_qpnp_flash_v2(E) tz_log_dlkm(OE) oplus_game_first(OE) shutdown_detect(E) Line 1549: 01-01 19:27:22.292414 4918 4918 W [ 59.508739]: qti_qmi_cdev(E) rpm_smd_cooling_device(E) rtc_pm8xxx(E) uff_fp_driver(E) bcl_pmic5(E) oplus_nfc(E) oplus_bsp_tp_comon(E) oplus_wifismartantenna(OE) qcom_sysmon(E) oplus_camera_wl2868c(E) oplus_stats_calc(OE) msm_performance(E) usb_f_cdev(E) dump_device_info(E) aw_breath_algorithm(E) frpc_adsprpc(E) qcom_lpm(E) phy_msm_snps_hs(E) f_fs_ipc_log(E) phy_qcom_emu(E) oplus_io_monitor(E) oplus_score(OE) coresight_stm(E) coresight_replicator(E) wcd_core_dlkm(OE) test_kit(E) refgen(E) qti_devfreq_cdev(E) wl2866d_regulator(E) oplus_sensor(E) q6_dlkm(OE) aw37004_regulator(E) fan53870(E) lmh_cpu_vdd_cdev(E) oplus_mm_kevent_fb(E) snd_usb_audio_qmi(E) cnss_utils(OE) q6_pdr_dlkm(OE) sg(E) oplus_freeze_process(OE) rdbg(E) oplus_binder_strategy(E) oplus_app_monitor(OE) snd_event_dlkm(OE) oplus_secure_harden(OE) oplus_qr_scan(OE) dispcc_sm6115(E) qcom_ramdump(E) qpnp_pdphy(E) pd_dbg_info(E) usb_bam(E) stm_p_basic(E) ordump(E) cfg80211(E) phy_generic(E) combkey_monitor(E) Line 1549: 01-01 19:27:22.292414 4918 4918 W [ 59.508739]: qti_qmi_cdev(E) rpm_smd_cooling_device(E) rtc_pm8xxx(E) uff_fp_driver(E) bcl_pmic5(E) oplus_nfc(E) oplus_bsp_tp_comon(E) oplus_wifismartantenna(OE) qcom_sysmon(E) oplus_camera_wl2868c(E) oplus_stats_calc(OE) msm_performance(E) usb_f_cdev(E) dump_device_info(E) aw_breath_algorithm(E) frpc_adsprpc(E) qcom_lpm(E) phy_msm_snps_hs(E) f_fs_ipc_log(E) phy_qcom_emu(E) oplus_io_monitor(E) oplus_score(OE) coresight_stm(E) coresight_replicator(E) wcd_core_dlkm(OE) test_kit(E) refgen(E) qti_devfreq_cdev(E) wl2866d_regulator(E) oplus_sensor(E) q6_dlkm(OE) aw37004_regulator(E) fan53870(E) lmh_cpu_vdd_cdev(E) oplus_mm_kevent_fb(E) snd_usb_audio_qmi(E) cnss_utils(OE) q6_pdr_dlkm(OE) sg(E) oplus_freeze_process(OE) rdbg(E) oplus_binder_strategy(E) oplus_app_monitor(OE) snd_event_dlkm(OE) oplus_secure_harden(OE) oplus_qr_scan(OE) dispcc_sm6115(E) qcom_ramdump(E) qpnp_pdphy(E) pd_dbg_info(E) usb_bam(E) stm_p_basic(E) ordump(E) cfg80211(E) phy_generic(E) combkey_monitor(E) Line 1549: 01-01 19:27:22.292414 4918 4918 W [ 59.508739]: qti_qmi_cdev(E) rpm_smd_cooling_device(E) rtc_pm8xxx(E) uff_fp_driver(E) bcl_pmic5(E) oplus_nfc(E) oplus_bsp_tp_comon(E) oplus_wifismartantenna(OE) qcom_sysmon(E) oplus_camera_wl2868c(E) oplus_stats_calc(OE) msm_performance(E) usb_f_cdev(E) dump_device_info(E) aw_breath_algorithm(E) frpc_adsprpc(E) qcom_lpm(E) phy_msm_snps_hs(E) f_fs_ipc_log(E) phy_qcom_emu(E) oplus_io_monitor(E) oplus_score(OE) coresight_stm(E) coresight_replicator(E) wcd_core_dlkm(OE) test_kit(E) refgen(E) qti_devfreq_cdev(E) wl2866d_regulator(E) oplus_sensor(E) q6_dlkm(OE) aw37004_regulator(E) fan53870(E) lmh_cpu_vdd_cdev(E) oplus_mm_kevent_fb(E) snd_usb_audio_qmi(E) cnss_utils(OE) q6_pdr_dlkm(OE) sg(E) oplus_freeze_process(OE) rdbg(E) oplus_binder_strategy(E) oplus_app_monitor(OE) snd_event_dlkm(OE) oplus_secure_harden(OE) oplus_qr_scan(OE) dispcc_sm6115(E) qcom_ramdump(E) qpnp_pdphy(E) pd_dbg_info(E) usb_bam(E) stm_p_basic(E) ordump(E) cfg80211(E) phy_generic(E) combkey_monitor(E) Line 1550: 01-01 19:27:22.292523 4918 4918 W [ 59.508848]: stm_core(E) keyevent_handler(E) qcom_pm8008_regulator(E) ocp2130_bias(E) coresight(E) oplus_bsp_rfcablemonitor(E) oplus_secure_common(OE) oplus_security_keventupload(OE) qcom_vadc_common(E) icc_test(E) hung_task_enhance(E) oplus_mm_kevent(E) qti_battery_debug(E) oplus_bsp_fw_update(E) charger_ulog_glink(E) msm_tsens_driver(E) sps_drv(E) debugcc_sm6115(E) msm_geni_serial(E) usb_f_ccid(E) qcom_va_minidump(E) msm_lmh_dcvs(E) qpnp_lcdb_regulator(E) oplus_bsp_tp_custom(E) oplus_bsp_tp_notify(E) qcom_i2c_pmic(E) oplus_resctrl(E) ucsi_glink(E) oplus_bsp_sensor_feedback(E) init_watchdog(E) olc(E) hung_task_enh(E) pmic_glink_debug(E) oplus_exit_mm_optimize(E) bwmon(E) altmode_glink(E) oplus_bsp_mapped_protect(E) oplus_theia(E) phy_msm_qusb_v2(E) memlat(E) core_hang_detect(E) gpucc_sm6115(E) boot_stats(E) pmic_glink(E) rpm_master_stat(E) debugcc_khaje(E) dispcc_khaje(E) rq_stats(E) glink_pkt(E) cdsprm(E) oplus_bsp_dynamic_readahead(E) msm_gpi(E) cdsp_loader(E) eud(E) Line 1550: 01-01 19:27:22.292523 4918 4918 W [ 59.508848]: stm_core(E) keyevent_handler(E) qcom_pm8008_regulator(E) ocp2130_bias(E) coresight(E) oplus_bsp_rfcablemonitor(E) oplus_secure_common(OE) oplus_security_keventupload(OE) qcom_vadc_common(E) icc_test(E) hung_task_enhance(E) oplus_mm_kevent(E) qti_battery_debug(E) oplus_bsp_fw_update(E) charger_ulog_glink(E) msm_tsens_driver(E) sps_drv(E) debugcc_sm6115(E) msm_geni_serial(E) usb_f_ccid(E) qcom_va_minidump(E) msm_lmh_dcvs(E) qpnp_lcdb_regulator(E) oplus_bsp_tp_custom(E) oplus_bsp_tp_notify(E) qcom_i2c_pmic(E) oplus_resctrl(E) ucsi_glink(E) oplus_bsp_sensor_feedback(E) init_watchdog(E) olc(E) hung_task_enh(E) pmic_glink_debug(E) oplus_exit_mm_optimize(E) bwmon(E) altmode_glink(E) oplus_bsp_mapped_protect(E) oplus_theia(E) phy_msm_qusb_v2(E) memlat(E) core_hang_detect(E) gpucc_sm6115(E) boot_stats(E) pmic_glink(E) rpm_master_stat(E) debugcc_khaje(E) dispcc_khaje(E) rq_stats(E) glink_pkt(E) cdsprm(E) oplus_bsp_dynamic_readahead(E) msm_gpi(E) cdsp_loader(E) eud(E) Line 1552: 01-01 19:27:22.292697 4918 4918 W [ 59.509022]: gcc_khaje(E) oplus_bsp_task_sched(E) gcc_sm6115(E) mem_buf(E) qcom_dma_heaps(E) qseecom_dlkm(OE) oplus_kmsg_wb(E) phy_qcom_ufs_qmp_v3_660(E) phy_qcom_ufs_qrbtc_sdm845(E) phy_qcom_ufs_qmp_v4_khaje(E) qrtr(E) qcom_glink(E) qnoc_bengal(E) qcom_soc_wdt(E) ua_cpu_ioctl(E) smp2p(E) ufshcd_crypto_qti(E) usbpd(E) clk_qcom(E) crypto_qti_common(E) dcc_v2(E) device_info(E) icc_rpm(E) mem_buf_dev(E) oplus_bsp_frame_boost(E) mem_offline(E) memory_dump_v2(E) msm_poweroff(E) oplus_phoenix(E) pinctrl_bengal(E) oplus_schedinfo(E) qcom_iommu_util(E) phy_qcom_ufs(E) oplus_pmicwd(E) pinctrl_khaje(E) qcom_ipc_logging(E) qcom_logbuf_vh(E) rpm_smd_regulator(E) qcom_wdt_core(E) boot_mode(E) gdsc_regulator(E) crypto_qti_tz(E) minidump(E) oplus_bsp_sched_assist(E) oplus_project(E) oplus_mdmfeature(E) oplus_uprobe(E) pinctrl_msm(E) phoenix_reboot_speed(E) qcom_cpufreq_hw(E) qcom_spmi_pmic(E) qcom_smd(E) secure_buffer(E) socinfo(E) rpm_smd(E) qpnp_power_on(E) stub_regulator(E) 这个是对应时间的kernel日志
最新发布
08-13
<think>我们分析日志中与ADB、USB、adbd服务相关的错误或异常信息,以确定设备重启后ADB连接失败的原因。 根据日志,我们注意到以下关键点: 1. **adbd启动过程**: - Line 3511: adbd started - Line 3513: 尝试打开控制端点 `/dev/usb-ffs/adb/ep0` - Line 3514: 等待属性 `persist.adb.tls_server.enable=1`(这通常与网络ADB有关,但我们现在关注USB ADB) - Line 3517: 构造了UsbFfsConnection对象 - Line 3526: 启动了UsbFfs-monitor线程 2. **FUNCTIONFS_BIND超时**: - Line 4331: 第一次超时:`timed out while waiting for FUNCTIONFS_BIND, trying again` - Line 6044: 第二次超时:同样等待FUNCTIONFS_BIND超时 - Line 6726: 第三次尝试启动了UsbFfs-monitor线程 - Line 7858: 第三次尝试中,成功接收到USB事件:`USB event: FUNCTIONFS_BIND` 3. **USB状态变化**: - 在设备启动过程中,USB相关的服务(UsbDeviceManager)也在启动,但出现了一些错误: - Line 29901: `failed to write to /sys/class/android_usb/android0/f_rndis/ethaddr`(可能是由于设备尚未完全初始化) - Line 29915: `connectToProxy: usb gadget hidl hal service not found.`(表明无法连接到USB Gadget HAL服务) - Line 29935: `USB Gadget HAL AIDL/HIDL not present`(再次确认USB Gadget HAL不可用) - 但是,随后UsbPortManager成功连接到了HIDL服务(Line 30082: `USB HAL HIDL present`) 4. **USB端口状态**: - Line 46245: 检测到USB端口已连接(`connected=true`),模式为`ufp`(表示设备处于从设备模式),数据角色为`device`(设备模式)。 - 在boot完成后(Line 77542),UsbDeviceManager广播了USB状态(Line 77621): `Bundle[{host_connected=false, connected=false, unlocked=false, adb=true, configured=false}]` 这里显示`connected=false`和`configured=false`,表明USB连接尚未配置成功。 5. **ADB认证开始**: - Line 77814: `adbd_auth: received a new framework connection` 和 `received new framework fd 16`,这表明adbd已经与框架层建立了连接,用于ADB认证。 6. **后续日志**: - 在boot完成后,我们看到一些与ADB相关的包(com.google.android.adbd)被处理,但并没有明显的错误。 7. **关键问题**: - 在adbd启动初期,连续两次尝试绑定USB FunctionFS都失败了(等待FUNCTIONFS_BIND事件超时),直到第三次尝试才成功。这可能是由于USB子系统初始化较慢,导致adbd在启动时无法立即绑定。 **原因分析**: - 根本原因在于adbd启动时,USB子系统尚未准备好,导致前两次绑定尝试超时。虽然第三次尝试成功,但此时adbd可能已经进入了一个不正确的状态,或者由于前两次失败导致后续处理异常(尽管日志中没有直接体现)。 - 另外,USB Gadget HAL服务在启动初期不可用(`usb gadget hidl hal service not found`),这也表明USB子系统初始化较慢。 - 在设备重启后,USB连接状态被报告为未连接(`connected=false`)和未配置(`configured=false`),尽管物理上可能已经连接(从UsbPortManager的日志看端口是连接的)。这可能是因为USB配置过程尚未完成。 **解决方案**: 1. **延迟adbd的启动**:确保adbd在USB子系统初始化完成后再启动。可以通过修改init.rc脚本,将adbd的启动顺序调整到USB服务之后,或者添加一个等待USB就绪的条件。 例如,在init.rc中,将adbd的启动从`class core`改为`class late_start`,并添加依赖条件: ``` service adbd /system/bin/adbd class late_start disabled oneshot ``` 同时,可以添加一个属性触发器,当USB准备好后再启动adbd: ``` on property:sys.usb.state=configured start adbd ``` 但注意,这可能会延迟ADB的可用时间。 2. **增加重试机制和超时时间**:修改adbd源码,增加对FUNCTIONFS_BIND事件的等待时间,并增加重试次数。目前从日志看,adbd在超时后会重试(共尝试了三次),但前两次间隔1秒(从时间戳看:19:26:38.570启动监控线程,19:26:39.572超时,然后19:26:39.642再次尝试,19:26:40.669超时,19:26:40.815第三次尝试,19:26:41.384成功)。我们可以考虑将超时时间从当前的1秒增加到5秒,并增加重试次数。 3. **确保USB Gadget驱动正确加载**:检查内核配置,确保FunctionFS驱动(CONFIG_USB_CONFIGFS_F_FS)已启用,并确保驱动模块已正确加载。 4. **检查USB物理连接**:虽然重新插拔后可以恢复,但重启后不行,这可能是因为重启过程中USB主机控制器复位导致设备端需要重新枚举,而软件没有正确处理。可以尝试在设备启动完成后,强制复位USB控制器: ``` echo 0 > /sys/class/android_usb/android0/enable echo 1 > /sys/class/android_usb/android0/enable ``` 5. **检查USB权限**:确保adbd有权限访问`/dev/usb-ffs/adb/`下的设备节点。在日志中没有看到权限错误,但需要确认。 **验证方法**: 修改后,重启设备,观察日志中是否还会出现`timed out while waiting for FUNCTIONFS_BIND`。如果不再出现,并且adbd在启动后能够成功绑定USB,则问题解决。 根据提供的日志,我们推测主要原因是adbd启动过早,而USB子系统尚未准备好。因此,延迟adbd启动是最直接的解决方案。 相关问题: 1. 如何修改Android设备的init.rc文件而不影响OTA更新? 2. 在Android系统中,USB子系统的初始化流程是怎样的? 3. adbd的启动顺序如何控制? 4. 如何增加adbd对FUNCTIONFS_BIND事件的等待时间和重试次数? 5. 如何通过内核调试手段诊断USB FunctionFS绑定问题?</think>### 设备重启后ADB连接失败原因分析 通过日志分析,发现重启后ADB连接失败的根本原因是**USB子系统初始化时序问题**导致FUNCTIONFS_BIND超时。以下是详细分析: #### 一、核心问题:FUNCTIONFS_BIND超时 ```log Line 4331: 01-01 19:26:39.572 W adbd timed out while waiting for FUNCTIONFS_BIND Line 6044: 01-01 19:26:40.669 W adbd timed out while waiting for FUNCTIONFS_BIND Line 6726: 01-01 19:26:40.820 I adbd UsbFfs-monitor thread spawned Line 7858: 01-01 19:26:41.384 I adbd USB event: FUNCTIONFS_BIND # 第三次尝试才成功 ``` **关键问题**: 1. **时序冲突**:ADB服务(adbd)启动时($t=19:26:38.543$),USB控制器尚未完成初始化 2. **超时机制**:adbd等待FUNCTIONFS_BIND信号的超时时间仅1秒(从Line 3526到4331) 3. **重试机制**:系统进行了3次尝试(第3次成功),但前两次均失败 数学关系: $$ t_{\text{adbd\_start}} + \Delta t_{\text{timeout}} < t_{\text{usb\_ready}} $$ 其中$\Delta t_{\text{timeout}}=1s$,而实际USB就绪时间为$t=19:26:41.384$(相差约2.8秒) #### 二、根本原因链式分析 ```mermaid graph TD A[设备重启] --> B[adbd过早启动] B --> C[USB控制器未就绪] C --> D[FUNCTIONFS_BIND超时] D --> E[USB资源释放失败] E --> F[后续绑定尝试失败] F --> G[ADB连接不可用] ``` 1. **USB服务初始化延迟** (关键证据) ```log Line 29915: E UsbDeviceManager connectToProxy: usb gadget hidl hal service not found Line 29935: E UsbPortManager USB Gadget HAL AIDL/HIDL not present Line 30082: I UsbPortManager USB HAL HIDL present # 延迟548ms后才就绪 ``` 2. **资源冲突问题** ```log Line 29901: I UsbDeviceManager failed to write to /sys/class/android_usb/android0/f_rndis/ethaddr ``` 表明RNDIS(网络共享)驱动正在占用USB资源,与ADB产生冲突[^1] 3. **权限配置异常** ```log Line 20634: W PackageSettings Couldn't write -1 to /config/sdcardfs/com.google.android.adbd/appid Line 82329: W PackageManager Skipping preparing app data for com.google.android.adbd ``` ADB相关包(com.google.android.adbd)的数据目录准备失败 #### 三、USB状态机异常 ```log Line 77621: D UsbDeviceManager broadcasting Intent... extras: Bundle[{host_connected=false, connected=false, adb=true, configured=false}] ``` **状态机缺陷**: - `adb=true` 表明ADB功能已启用 - `configured=false` 表示USB未完成配置 - 这种矛盾状态导致ADB无法正常响应主机请求 #### 四、解决方案 1. **延迟adbd启动** (最优解) 修改`init.rc`: ```rc service adbd /system/bin/adbd class late_start # 从core改为late_start disabled oneshot ``` 2. **增加超时时间** 修改ADB源码(`system/core/adb/daemon/usb_ffs.cpp`): ```cpp // 默认值1000ms -> 改为5000ms static constexpr uint64_t kBindTimeout = 5000; ``` 3. **强制USB重新枚举** ```shell echo 0 > /sys/class/android_usb/android0/enable echo 1 > /sys/class/android_usb/android0/enable ``` 4. **解决资源冲突** ```shell setprop persist.vendor.usb.config adb # 禁用其他USB功能 stop mtpd # 停止可能冲突的服务 ``` #### 五、验证方法 ```shell # 检查USB状态 adb shell cat /sys/class/android_usb/android0/state # 监控初始化时序 adb logcat -b all | grep -e "UsbPortManager" -e "adbd started" # 检查绑定状态 adb shell ls -l /dev/usb-ffs/adb/ep* ``` --- ### 相关问题 1. 如何在Android系统中精确控制服务的启动顺序? 2. 当USB Gadget HAL不可用时,系统有哪些备用机制? 3. 如何动态调整ADB的FUNCTIONFS_BIND超时参数而不重新编译? 4. 在双系统设备中,USB控制器初始化有哪些特殊挑战? 5. 如何通过内核事件跟踪(ftrace)诊断USB初始化延迟? [^1]: 当多个USB功能同时启用时可能产生资源冲突 [^2]: USB HAL初始化延迟导致关键服务不可用 [^3]: ADB绑定超时机制在系统压力下可能失效
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值