http://blog.sina.com.cn/s/blog_4c0e8aa20100ung8.html

本文介绍了一种在WPF应用程序中自定义快捷键的方法,通过XML资源定义了一个名为FaskDemo的命令,并将其绑定到F3键上。当按下F3键时,会触发一个控制台输出信息。

因此我采用的是另一种方式,也是在网上查找的,不过网址个忘了,现在只剩下程序了。

实现的办法如下所示:

 

<Window.Resources>

        <RoutedUICommand x:Key="searchKey" Text="FaskDemo" />   

</Window.Resources>

    <windows.inputBindings>

        <KeyBinding Command="{StaticResource searchKey}" Key="F3"/>   </windows.inputBindings>

    <Window.CommandBindings>

        <CommandBinding 

Command="{StaticResource searchKey}" CanExecute="CommandBinding_CanExecute_F3"

"/>

    </Window.CommandBindings>

 

这是前面的xmal要做的事情,当然,我们要执行的那个FaskDemo_Click我们还的实现以下啊,那么就如下所示了:

private void CommandBinding_CanExecute_F3(object sender, CanExecuteRoutedEventArgs e)

        {

           Console.WriteLine("LeoZhao 讲鬼故事");

        }

这样就OK了。

<12>[ 32.279146] [ 5:android.hardwar: 967] healthd: battery l=1 v=3353 t=25.8 h=2 st=2 c=-1079000 fc=5000000 o=4 hv=0 sec=0 sce=0 chg=u <6>[ 32.312196] [ 5:ndroid.keychain: 4621] binder: 4621:4621 ioctl 40046210 7fc9b33de0 returned -22 <3>[ 32.316162] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:33 <3>[ 32.374153] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:34 <6>[ 32.384969] [ 0:oid.mdecservice: 4707] binder: 4707:4707 ioctl 40046210 7fc9b33de0 returned -22 <3>[ 32.428110] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:35 <4>[ 32.468345] [ 6:DefaultDispatch: 4569] audit: audit_lost=238 audit_rate_limit=5 audit_backlog_limit=64 <3>[ 32.468352] [ 6:DefaultDispatch: 4569] audit: rate limit exceeded <6>[ 32.474243] [ 6:droid.daemonapp: 4746] binder: 4746:4746 ioctl 40046210 7fc9b33de0 returned -22 <3>[ 32.479276] [ 0: kworker/0:1: 7] dev_name = 253:2,total_blks = 361267,skipped_blks = 3445,corrupted_blks = 0,fec_correct_blks = 0 <3>[ 32.484099] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:36 <6>[ 32.523141] [ 0:ocess.gservices: 4777] binder: 4777:4777 ioctl 40046210 7fc9b33de0 returned -22 <3>[ 32.540138] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:37 <6>[ 32.555531] [ 6: wpa_supplicant: 2168] [wpa_su][0x2cc45aeb][19:06:39.527582] wlan: [2168:I:SME] vdev-0: Connecting to svctest5 20:db:ab:88:e8:67 rssi: -64 freq: 5180 akm 9 cipher: uc 6 mc 6, CC: KR <6>[ 32.569746] [ 1: iod: 619] !@ 8,0 r 52171 2415524 w 2884 85952 d 9 36 f 0 0 iot 24124 0 th 0 0 0 pt 0 inp 0 7 32.569 <6>[ 32.593621] [ 5:scheduler_threa: 1892] [schedu][0x2ccf8358][19:06:39.565668] wlan: [1892:I:PE] Auth TX: seq 1 seq num 2049 status 0 WEP 0 to 20:db:ab:88:e8:67 <6>[ 32.594298] [ 0:scheduler_threa: 1892] [schedu][0x2ccfb610][19:06:39.566344] wlan: [1892:I:PE] Auth TX: success (0) <6>[ 32.595723] [ 0:scheduler_threa: 1892] [schedu][0x2cd020fa][19:06:39.567770] wlan: [1892:I:PE] Auth RX: vdev 0 sys role 2 lim_state 5 from 20:db:ab:88:e8:67 rssi -64 auth_alg 0 seq 3402 <6>[ 32.596099] [ 0:scheduler_threa: 1892] [schedu][0x2cd03d44][19:06:39.568147] wlan: [1892:I:PE] Assoc req TX: vdev 0 to 20:db:ab:88:e8:67 seq num 2050 <3>[ 32.596631] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:38 <6>[ 32.597574] [ 4:scheduler_threa: 1892] [schedu][0x2cd0abc7][19:06:39.569621] wlan: [1892:I:PE] Assoc req TX: success (0) <6>[ 32.605974] [ 4:scheduler_threa: 1892] [schedu][0x2cd321bf][19:06:39.578020] wlan: [1892:I:PE] Assoc rsp RX: subtype 0 vdev 0 sys role 2 lim state 10 rssi -64 from 20:db:ab:88:e8:67 <6>[ 32.617063] [ 4:scheduler_threa: 1892] [schedu][0x2cd66195][19:06:39.589111] wlan: [1892:I:HDD] wlan0(vdevid-0): 42:cc:85:0a:57:5f connected to 20:db:ab:88:e8:67 <6>[ 32.623679] [ 5:cds_ol_rx_threa: 1893] [cds_ol][0x2cd85171][19:06:39.595723] wlan: [1893:I:QDF] EAPOL-1 RX: SA:20:db:ab:88:e8:67 DA:42:cc:85:0a:57:5f <3>[ 32.652209] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:39 <3>[ 32.708674] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:40 <3>[ 32.708694] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wtchg_float_charge_type_check recheck ! <6>[ 32.708703] [ 0: kworker/0:1: 7] usb_notify: send_otg_notify event=vbus(1) enable=0 <6>[ 32.708710] [ 0: kworker/0:1: 7] usb_notify: otg_notifier_callback event=vbus(1) <6>[ 32.709163] [ 0: kworker/u16:3: 210] usb_notify: otg_notify_state+ event=vbus(1), enable=off <3>[ 32.709280] [ 0: kworker/u16:3: 210] get prop 64 is not supported in usb <6>[ 32.710086] [ 0: kworker/u16:6: 315] msm-dwc3 4e00000.ssusb: dwc3_otg_start_peripheral: turn off gadget dwc3-gadget <6>[ 32.710126] [ 1: kworker/u16:3: 210] usb_notify: otg_notify_state- event=vbus, cable=none <6>[ 32.712585] [ 0: kworker/0:0: 5] android_work: did not send uevent (0 0 0000000000000000) <6>[ 32.713667] [ 1: kworker/u16:6: 315] msm-dwc3 4e00000.ssusb: DWC3 in low power mode <3>[ 32.713729] [ 1: kworker/u16:6: 315] get prop 64 is not supported in usb <6>[ 32.756181] [ 0:ndroid.game.gos: 4827] binder: 4827:4827 ioctl 40046210 7fc9b33de0 returned -22 <6>[ 32.794905] I[ 0: HeapTaskDaemon: 2426] [soft_i][0x2d0a7b5c][19:06:39.766949] wlan: [0:I:QDF] EAPOL-2 TX: SA:42:cc:85:0a:57:5f DA:20:db:ab:88:e8:67 msdu_id:1199 status: succ <6>[ 32.799571] [ 5:cds_ol_rx_threa: 1893] [cds_ol][0x2d0bd957][19:06:39.771615] wlan: [1893:I:QDF] EAPOL-3 RX: SA:20:db:ab:88:e8:67 DA:42:cc:85:0a:57:5f <6>[ 32.819668] I[ 0: android.bg: 1776] [soft_i][0x2d11bc9a][19:06:39.791712] wlan: [0:I:QDF] EAPOL-4 TX: SA:42:cc:85:0a:57:5f DA:20:db:ab:88:e8:67 msdu_id:1199 status: succ <6>[ 32.821626] [ 4:scheduler_threa: 1892] [schedu][0x2d124fcf][19:06:39.793674] wlan: [1892:I:WMI] wmi_fill_rso_tlvs: RSO_CFG: vdev:0 pmk_len = 32 pmksa caching:1 OKC:1 sae_same_pmk:0 key_mgmt_offload:1 <6>[ 32.854293] [ 1: crtc_commit:76: 352] [drm:dsi_display_set_mode] [msm-dsi-info]: mdp_transfer_time=0, hactive=1200, vactive=1920, fps=90 <3>[ 32.924081] [ 0: kworker/0:0: 5] wt rerun apsd begin <3>[ 32.924100] [ 0: kworker/0:0: 5] enabling DPDM regulator <6>[ 32.941852] [ 7: binder:1369_9: 2557] !@sendLockTypeChangedInfo : lockscreen.lockout_biometric_attempt_deadline = 0 <3>[ 32.968084] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:0 <6>[ 32.986513] [ 2: crtc_commit:76: 352] [drm:dsi_display_set_mode] [msm-dsi-info]: mdp_transfer_time=0, hactive=1200, vactive=1920, fps=60 <4>[ 32.992190] [ 0: msm-watchdog: 70] msm_watchdog_data - pet: 32.992179 / last_pet: 24.800145 (delta: 8.192034) <6>[ 32.992372] [ 5: kworker/u16:10: 1389] (virq:irq_count)- 20:52393 4:41820 14:12080 119:9218 194:5547 228:5503 164:1855 243:1325 165:1125 166:1107 <6>[ 32.992400] [ 5: kworker/u16:10: 1389] (cpu:irq_count)- 0:97672 1:3508 2:3646 3:3703 4:3807 5:3851 6:9874 7:9479 <6>[ 32.992413] [ 5: kworker/u16:10: 1389] (ipi:irq_count)- 0:156695 1:76115 2:0 3:0 4:2 5:61483 6:0 <3>[ 32.994727] [ 0: kworker/0:4: 4446] cx25890h 3-006b: cx25890h_get_vbus_volt: vbus_volt = 5389 <3>[ 32.998510] [ 0: kworker/0:4: 4446] cx25890h 3-006b: cx25890h_monitor_workfunc:usb_online: 1, chg_status: 1, chg_fault: 0x0 vbus_type:1 vbus_volt=5389 <3>[ 33.024304] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:1 <6>[ 33.033242] [ 0: crtc_commit:76: 352] [drm:dsi_display_set_mode] [msm-dsi-info]: mdp_transfer_time=0, hactive=1200, vactive=1920, fps=90 <3>[ 33.049122] [ 0: kworker/0:4: 4446] cx25890h 3-006b: cx25890h adapter/usb irq handler <3>[ 33.053469] [ 0: kworker/0:4: 4446] cx25890h 3-006b: prev_vbus_gd: 1, vbus_gd: 1, prev_pg: 1, usb_online: 0, apsd_rerun: 1 <3>[ 33.054057] [ 0: kworker/0:4: 4446] cx25890h 3-006b: reg0c fault = 00 <3>[ 33.055142] [ 0: kworker/0:4: 4446] cx25890h 3-006b: cx25890h_get_vbus_volt: vbus_volt = 5586 <3>[ 33.080087] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:2 <3>[ 33.136163] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:3 <6>[ 33.172303] [ 2:ung.android.mdm: 4898] binder: 4898:4898 ioctl 40046210 7fc9b33de0 returned -22 <3>[ 33.192367] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:4 <14>[ 33.227279] [ 1: init: 1] init: Sending signal 9 to service 'idmap2d' (pid 1378) process group... <14>[ 33.234768] [ 1: binder:570_1: 576] servicemanager: 'idmap' died <14>[ 33.239940] [ 2: init: 1] libprocessgroup: Successfully killed process cgroup uid 1000 pid 1378 in 12ms <14>[ 33.241703] [ 3: init: 1] init: Control message: Processed ctl.stop for 'idmap2d' from pid: 1369 (system_server) <14>[ 33.242298] [ 3: init: 1] init: Service 'idmap2d' (pid 1378) received signal 9 <3>[ 33.248098] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:5 <3>[ 33.304237] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:6 <3>[ 33.360533] [ 0: kworker/0:1: 7] wt_chg soc:qcom_wt_chg: wait for usb_connect:0, count:7 <3>[ 33.364408] [ 0: kworker/0:4: 4446] cx25890h 3-006b: cx25890h adapter/usb irq handler <3>[ 33.368840] [ 0: kworker/0:4: 4446] cx25890h 3-006b: prev_vbus_gd: 1, vbus_gd: 1, prev_pg: 0, usb_online: 1, apsd_rerun: 1 <3>[ 33.370564] [ 0: kworker/0:4: 4446] cx25890h 3-006b: bc12_vbus_type: 1, bc12_current: 500, vbus_type: 3, bc12_check: 2 <3>[ 33.370725] [ 0: kworker/0:0: 5] cx25890h 3-006b: temp shut watchdog !!! <3>[ 33.370928] [ 0: kworker/0:4: 4446] cx25890h 3-006b: reg0c fault = 00 <3>[ 33.372058] [ 0: kworker/0:4: 4446] cx25890h 3-006b: cx25890h_get_vbus_volt: vbus_volt = 5397 <3>[ 33.374465] [ 0: kworker/0:0: 5] wt_chg soc:qcom_wt_chg: chg->vbus_volt = 5394 <3>[ 33.381230] [ 0: kworker/0:4: 4446] cx25890h 3-006b: cx25890h_get_vbus_volt: vbus_volt = 5396 <3>[ 33.383479] [ 0: kworker/0:4: 4446] cx25890h 3-006b: cx25890h_set_afc_9v: cx afc enter: <3>[ 33.383497] [ 0: kworker/0:4: 4446] cx25890h 3-006b: afc cx25890h_is_afc_chan_valid <4>[ 33.383505] [ 0: kworker/0:4: 4446] afc_iio_write_rawPSY_IIO_AFC_DETECT <6>[ 33.383510] [ 0: kworker/0:4: 4446] afc_set_voltage, set_voltage(9) <6>[ 33.383514] [ 0: kworker/0:4: 4446] afc_set_voltage, set_voltage(9) <3>[ 33.383636] [ 0: kworker/0:2: 373] afc_set_voltage_workq, afc_used is :0, afc_disable is 0 <6>[ 33.384415] [ 0: kworker/0:0: 5] wt_chg soc:qcom_wt_chg: wtchg_get_batt_cycle: batt_cycle = 0, ret = 0 <3>[ 33.384436] [ 0: kworker/0:0: 5] wt_chg soc:qcom_wt_chg: batt_temp=257, jeita_status=3, board_temp=267,lcd_on=1, vbat_over_flag=0, vbat_update_time=0, vbat_over_count=0, batt_volt=3344000, batt_cycle=0 <3>[ 33.384447] [ 0: kworker/0:0: 5] wt_chg soc:qcom_wt_chg: thermal status:(0) 0, temperature:267, thermal_engine_tab_size:7 <3>[ 33.384456] [ 0: kworker/0:0: 5] wt_chg soc:qcom_wt_chg: thermal_status: cur_usb=0 cur_board=0, cur_chg=0; last_usb=-1, last_board=0, last_chg=-1 <3>[ 33.384464] [ 0: kworker/0:0: 5] wt_chg soc:qcom_wt_chg: usb_port_thermal_cur=3000 main_chg_thermal_cur=3000, board_pcb_thermal_cur=3000 thermal_ibatt=3000 <3>[ 33.384473] [ 0: kworker/0:0: 5] chg_state_step=FAST_CHARGING chg_status_hyst_cnt=0 chg_iterm_cnt=0 chg_status_target_fcc=3000 <3>[ 33.384482] [ 0: kworker/0:0: 5] wt_chg soc:qcom_wt_chg: jeita_batt_cv=4368, jeita_batt_cv_pre=4368, input_curr=1550, input_curr_pre=500, chg_ibatt=3000 slave_enable=0 <3>[ 33.385547] [ 0: kworker/0:0: 5] wt_chg soc:qcom_wt_chg: type_ibatt=3000, jeita_ibatt=3000, main_chg_ibatt=3000, slave_chg_ibatt=0, chg_ibatt=3000,chg_ibatt_pre=500 <3>[ 33.385567] [ 0: kworker/0:0: 5] cx25890h 3-006b: cx25890h_set_charge_current: 3000 <3>[ 33.386584] [ 0: kworker/0:0: 5] cx25890h 3-006b: cx25890h_set_term_current: 256 <3>[ 33.387756] [ 0: kworker/0:0: 5] wtchg_batt_full_capacity_manage: batt_full_capacity=0, batt_soc_rechg=1, batt_capacity=1 <3>[ 33.388678] [ 0: kworker/0:0: 5] chg_temp: 309, usb_temp: 0, board_temp: 267, usb_online: 0, ac_online: 1, pd_active:0, typec_orientation:1 discharging_state: 0 <3>[ 33.388699] [ 0: kworker/0:0: 5] pd_cur_max=0 pd_max_vol=0 pd_min_vol=0 pd_allow_vol=0 <6>[ 33.388797] [ 4: kworker/u16:12: 1393] Battery Percentage: 1 <6>[ 33.391165] [ 4: pd_dbg_info: 130] ///PD dbg info 124d <5>[ 33.391180] [ 4: pd_dbg_info: 130] < 33.391>TCPC-TCPC:bat_update_work_func battery update soc = 1 <5>[ 33.391180] < 33.391>TCPC-TCPC:bat_update_work_func Battery Charging <12>[ 33.391703] [ 7:android.hardwar: 967] healthd: battery l=1 v=3344 t=25.7 h=2 st=2 c=-1079000 fc=5000000 o=3 hv=0 sec=0 sce=0 chg=a 这段为什么healthd中的chg从u变成a?
最新发布
11-29
在你提供的日志中,`healthd` 中的 `chg` 字段从 `u`(unplugged,未连接充电器)变为 `a`(AC,充电器已连接),这是一个 **充电状态切换的标志**。以下是详细分析: --- ### 🔍 日志片段分析: #### 初始状态(未充电): ```log <12>[ 32.279146] healthd: battery l=1 v=3353 t=25.8 h=2 st=2 c=-1079000 fc=5000000 o=4 hv=0 sec=0 sce=0 chg=u ``` - `chg=u`:表示充电器未连接(unplugged)。 - `c=-1079000`:电流为负值,表示电池在放电。 #### 充电器插入后状态(开始充电): ```log <12>[ 33.391703] healthd: battery l=1 v=3344 t=25.7 h=2 st=2 c=-1079000 fc=5000000 o=3 hv=0 sec=0 sce=0 chg=a ``` - `chg=a`:表示充电器已连接,且为 AC 充电器(USB 或适配器供电)。 - `c=-1079000`:电流仍为负值,可能是因为充电刚刚开始,电流尚未稳定。 --- ### ✅ 为什么 `chg` 会从 `u` 变为 `a`? #### 1. **充电器物理连接** - 用户插入了 USB 线缆或充电器。 - 系统检测到 `VBUS` 电压上升(如日志中所示的 `vbus_volt = 5394 mV`),判断为充电器连接。 #### 2. **USB PD 协议协商完成** - Type-C 控制器(如 `cx25890h`)完成了 PD 协商,确认充电器支持的电压和电流。 - 如日志中: ```log <3>[ 33.370725] cx25890h 3-006b: bc12_vbus_type: 1, bc12_current: 500, vbus_type: 3, bc12_check: 2 <3>[ 33.383479] cx25890h 3-006b: cx25890h_set_charge_current: 3000 ``` 表明系统已识别到充电器,并设置充电电流为 3000mA。 #### 3. **系统电源管理模块更新状态** - `healthd` 是 Android 的电源管理守护进程,它会根据底层驱动上报的状态更新电池信息。 - 当 `power_supply` 子系统上报 `usb_online=1`、`ac_online=1` 时,`healthd` 将 `chg` 设置为 `a`。 --- ### 📌 关键日志证据: ```log <3>[ 32.968084] wt rerun apsd begin <3>[ 32.968084] enabling DPDM regulator ``` - 表示系统开始重新检测 USB 插入事件。 ```log <3>[ 33.370928] cx25890h 3-006b: temp shut watchdog !!! ``` - 表示 USB 检测完成,开始进入充电流程。 ```log <3>[ 33.385567] cx25890h 3-006b: cx25890h_set_charge_current: 3000 ``` - 表示系统已设置充电电流为 3A,充电开始。 --- ### 🧠 为什么电流仍为负值? 虽然 `chg=a` 表示充电器已连接,但日志中仍然显示 `c=-1079000`(负值),可能原因如下: 1. **充电器刚连接,电流尚未稳定** - 系统刚刚设置好充电电流,实际电流还未上升到正值。 2. **测量误差或采样延迟** - `healthd` 获取的电流值可能来自上一次采样,尚未更新。 3. **系统功耗大于充电电流** - 如果系统运行负载较高,导致充电电流小于系统消耗,也可能表现为负值。 --- ### 📈 系统充电流程总结: | 阶段 | 关键日志 | 说明 | |------|----------|------| | USB 插入 | `usb_online=1` | USB 插入,系统开始检测充电器 | | PD 协商 | `bc12_vbus_type` | 检测充电器类型和能力 | | 设置充电参数 | `cx25890h_set_charge_current` | 设置充电电流 | | 更新充电状态 | `healthd: chg=a` | 表示充电器已连接,开始充电 | --- ### ✅ 总结 `healthd` 中 `chg` 从 `u` 变为 `a`,是因为: - **USB 充电器被插入** - **PD 协议协商完成** - **系统确认充电器连接并开始充电** 尽管电流仍为负值,但这是由于充电刚刚开始,系统尚未完全进入充电状态。后续日志中应能看到电流变为正值,表示真正进入充电阶段。 --- ###
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值