USB function与Active Sync

本文详细介绍了WinCE系统中USBFunction的三种工作模式:SERIAL、RNDIS及MASS_STORAGE,并针对每种模式提供了具体的配置示例,包括解决ActiveSync冲突问题的方法。

WinCE中USB Function一般有三种工作方式。

 

set BSP_USBFNCLASS=SERIAL
@REM set BSP_USBFNCLASS=RNDIS
@REM set BSP_USBFNCLASS=MASS_STORAGE

如果利用BSP_USBFNCLASS=SERIAL,则设备其实就会虚拟出一个串口,在我的设备里port index就是5.如下:

 

[HKEY_LOCAL_MACHINE/Drivers/USB/FunctionDrivers/Serial_Class]
    "FriendlyName"=LOC_USBFN_SERIAL_NAME
    "idVendor"=dword:0547
    "Manufacturer"=LOC_USBFN_SERIAL_MANUFACTURER
    "idProduct"=dword:2720
    "Product"=LOC_USBFN_SERIAL_PRODUCT
    "Index"=dword:5      ;如果index 5被占用,Active Sync就无法工作。系统启动就会弹出一个无法通信的对话框。这样就需要改,让它向后顺延。可以改成5以后的数。

 

如果利用的是set BSP_USBFNCLASS=RNDIS,这时Active Sync就是利用RNDIS来工作,这个时候如果有无线网络的话,就会冲突,需要修改Active Sync的设置,允许Active Sync和无线同时存在。

 

如果用的是BSP_USBFNCLASS=MASS_STORAGE,这时设备就相当于一个USB disk,U盘的名字可以在注册表里修改。

我现在要实现VBUS唤醒系统,(即系统休眠后插入usb可以实现唤醒系统,并且有adb口,目前是休眠之后插入usb无法唤醒) 目前抓到的唤醒log如下: [ 282.641013] PM: pm_system_irq_wakeup: 175 triggered c263000.thermal-sensor [ 282.641764] PM: PM: Pending Wakeup Sources: [timerfd] [ 282.669925] usb_extcon_detect_cable : id = 1, vbus = 0 [ 282.709202] [drm] [msm-dsi-warn]: secondary default panel not found 我的预期是id = 1, vbus = 1 这是log打印相关的代码: static void usb_extcon_detect_cable(struct work_struct *work) { int id, vbus; struct usb_extcon_info *info = container_of(to_delayed_work(work), struct usb_extcon_info, wq_detcable); /* check ID and VBUS and update cable state */ id = info->id_gpiod ? gpiod_get_value_cansleep(info->id_gpiod) : 1; vbus = info->vbus_gpiod ? gpiod_get_value_cansleep(info->vbus_gpiod) : id; printk("ct %s : id = %d, vbus = %d\n", __func__, id, vbus); /* at first we clean states which are no longer active */ if (id) { if (info->vbus_out_gpiod) gpiod_set_value_cansleep(info->vbus_out_gpiod, 0); extcon_set_state_sync(info->edev, EXTCON_USB_HOST, false); } if (!vbus) extcon_set_state_sync(info->edev, EXTCON_USB, false); if (!id) { if (info->vbus_out_gpiod) gpiod_set_value_cansleep(info->vbus_out_gpiod, 1); extcon_set_state_sync(info->edev, EXTCON_USB_HOST, true); } else { if (vbus) extcon_set_state_sync(info->edev, EXTCON_USB, true); } } 这是我在devicetree/qcom/neo-pmic-overlay.dtsi的配置:你检查下哪些地方可能配置的不对: #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/pinctrl/qcom,pmic-gpio.h> #include <dt-bindings/iio/qcom,spmi-vadc.h> #include <dt-bindings/interrupt-controller/irq.h> #include "pm8150.dtsi" &pm8150_gpios { usb0_vbus_det { usb0_vbus_det_default: usb0_vbus_det_default { pins = "gpio5"; function = "normal"; input-enable; bias-disable; //power-source = <0>; /* 1.8V input supply */ }; }; }; &soc { reboot_reason { compatible = "qcom,reboot-reason"; nvmem-cells = <&restart_reason>; nvmem-cell-names = "restart_reason"; }; gpio_keys { compatible = "gpio-keys"; label = "gpio-keys"; pinctrl-names = "default"; pinctrl-0 = <&gpio_vol_up>, <&gpio_camera_shot>; vol_up { label = "vol_up"; gpios = <&tlmm 122 GPIO_ACTIVE_LOW>; linux,input-type = <1>; linux,code = <KEY_VOLUMEUP>; debounce-interval = <15>; linux,can-disable; }; camera_shot { label = "camera_shot"; gpios = <&tlmm 64 GPIO_ACTIVE_LOW>; linux,input-type = <1>; linux,code = <KEY_CAMERA>; debounce-interval = <15>; linux,can-disable; }; }; extcon_usb0: extcon_usb0 { compatible = "linux,extcon-usb-gpio"; vbus-gpio = <&pm8150_gpios 5 GPIO_ACTIVE_HIGH>; interrupt-parent = <&spmi_bus>; interrupts = <0x0 0xc9 0 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "pm8150_gpio5"; wakeup-source; pinctrl-names = "default"; pinctrl-0 = <&usb0_vbus_det_default>; }; }; &pm8150_vadc { pm8150_skin_therm { reg = <ADC5_AMUX_THM1_100K_PU>; label = "pm8150_skin_temp"; qcom,hw-settle-time = <200>; qcom,ratiometric; qcom,pre-scaling = <1 1>; }; /* * This thermistor has 100k pullup already connected, * modify config following HW recommendation, for all * platforms other than SG. */ pm8150_wlan_therm { reg = <ADC5_AMUX_THM2>; label = "pm8150_wlan_temp"; qcom,hw-settle-time = <200>; qcom,pre-scaling = <1 1>; qcom,scale-fn-type = <ADC_SCALE_HW_CALIB_THERM_100K_PULLUP>; }; pm8150_xo_therm { reg = <ADC5_XO_THERM_100K_PU>; label = "pm8150_xo_therm"; qcom,hw-settle-time = <600>; qcom,ratiometric; qcom,pre-scaling = <1 1>; }; }; &pm8150_adc_tm { io-channels = <&pm8150_vadc ADC5_AMUX_THM1_100K_PU>, <&pm8150_vadc ADC5_AMUX_THM2>, <&pm8150_vadc ADC5_XO_THERM_100K_PU>; pm8150_skin_therm { reg = <ADC5_AMUX_THM1_100K_PU>; qcom,hw-settle-time = <200>; qcom,ratiometric; }; /* * This thermistor has 100k pullup already connected, * modify config following HW recommendation, for all * platforms other than SG. */ pm8150_wlan_therm { reg = <ADC5_AMUX_THM2>; qcom,hw-settle-time = <200>; }; pm8150_xo_therm { reg = <ADC5_XO_THERM_100K_PU>; qcom,hw-settle-time = <600>; qcom,ratiometric; }; }; &thermal_zones { sys-therm-0 { polling-delay-passive = <0>; polling-delay = <0>; thermal-sensors = <&pm8150_adc_tm ADC5_AMUX_THM1_100K_PU>; trips { active-config0 { temperature = <125000>; hysteresis = <1000>; type = "passive"; }; active-config1 { temperature = <125000>; hysteresis = <1000>; type = "passive"; }; }; }; sys-therm-1 { polling-delay-passive = <0>; polling-delay = <0>; thermal-sensors = <&pm8150_adc_tm ADC5_AMUX_THM2>; trips { active-config0 { temperature = <125000>; hysteresis = <1000>; type = "passive"; }; active-config1 { temperature = <125000>; hysteresis = <1000>; type = "passive"; }; sys_therm1_config0: sys-therm1-config0 { temperature = <54000>; hysteresis = <2000>; type = "passive"; }; sys_therm1_config1: sys-therm1-config1 { temperature = <56000>; hysteresis = <2000>; type = "passive"; }; sys_therm1_config2: sys-therm1-config2 { temperature = <58000>; hysteresis = <2000>; type = "passive"; }; }; }; xo-therm { polling-delay-passive = <0>; polling-delay = <0>; thermal-sensors = <&pm8150_adc_tm ADC5_XO_THERM_100K_PU>; trips { active-config0 { temperature = <125000>; hysteresis = <1000>; type = "passive"; }; active-config1 { temperature = <125000>; hysteresis = <1000>; type = "passive"; }; }; }; }; &qupv3_se10_i2c { clock-frequency = <400000>; #address-cells = <1>; #size-cells = <0>; status = "ok"; battery: battery { compatible = "simple-battery"; voltage-min-design-microvolt = <3100000>; energy-full-design-microwatt-hours = <2520000>; charge-full-design-microamp-hours = <645000>; over-voltage-threshold-microvolt = <4500000>; re-charge-voltage-microvolt = <250000>; /* bq256xx's termination current setting has a min limit of 60mA */ charge-term-current-microamp = <60000>; constant-charge-current-max-microamp = <500000>; constant-charge-voltage-max-microvolt = <4480000>; voltage-max-design-microvolt = <4480000>; precharge-current-microamp = <128000>; factory-internal-resistance-micro-ohms = <120000>; }; charger: charger@6b { compatible = "ti,bq25600"; reg = <0x6b>; interrupt-parent = <&tlmm>; interrupts = <6 IRQ_TYPE_EDGE_FALLING>; debugboard-detect-gpio = <&tlmm 54 GPIO_ACTIVE_HIGH>; ti,watchdog-timeout-ms = <0>; pinctrl-names = "default"; pinctrl-0 = <&bq256xx_intr_default>; input-voltage-limit-microvolt = <4480000>; input-current-limit-microamp = <500000>; monitored-battery = <&battery>; status = "ok"; }; battery_645mAh: battery_645mAh { qmax-cell0 = <16384>; resist-table = <34 31 29 33 39 26 31 28 28 29 31 31 46 83 221>; }; battery_630mAh: battery_630mAh { qmax-cell0 = <15656>; resist-table = <16 16 17 20 22 13 17 18 18 18 17 23 28 44 62>; }; bq27421: fuel-gauge@55 { compatible = "ti,bq27421"; reg = <0x55>; interrupt-parent = <&tlmm>; interrupts = <7 IRQ_TYPE_EDGE_FALLING>; pinctrl-names = "default"; pinctrl-0 = <&bq27421_intr_default>; bat-resist-table = <&battery_645mAh>; monitored-battery = <&battery>; status = "ok"; }; }; &usb0 { extcon = <&extcon_usb0>, <&eud>; }; &pm8150_pon { qcom,log-kpd-event; };补充一下,gpio5注册的中断号是cat /proc/interrupts | grep spmi 304: 0 0 0 0 spmi-gpio 4 Edge soc:extcon_usb0我 cat /proc/interrupts | grep spmi 304: 0 0 0 0 spmi-gpio 4 Edge soc:extcon_usb0 而代码里interrupt-parent = <&spmi_bus>;这两者需要对应吗
最新发布
08-27
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值