RK3288 Android 5.x USB存在的BUG引起的问题

某刷卡模块USB工作不正常:
1.接模块启动系统,工作不正常,查USB驱动信息:
T: Bus=02 Lev=02 Prnt=02 Port=03 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0471 ProdID=a112 Rev= 2.00
S: Manufacturer=LC TEC.
S: Product=LC XU HID
S: SerialNumber=?19768J438
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=300mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=82(I) Atr=03(Int.) MxPS= 32 Ivl=2ms
E: Ad=01(O) Atr=03(Int.) MxPS= 32 Ivl=2ms

2.系统启动后接模块,工作正常,USB信息:
T: Bus=02 Lev=02 Prnt=02 Port=03 Cnt=01 Dev#= 11 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=0471 ProdID=a112 Rev= 2.00
S: Manufacturer=LC TEC.
S: Product=LC XU HID
S: SerialNumber=?19768J438
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=300mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=03(HID ) Sub=00 Prot=00 Driver=(none)
E: Ad=82(I) Atr=03(Int.) MxPS= 32 Ivl=2ms
E: Ad=01(O) Atr=03(Int.) MxPS= 32 Ivl=2ms

区别在于一个是usbhid,一个是none。另外发现打开他们的读卡apk以后,有时候会出现Driver类型的切换,如果最后切换成none就可以正常工作,否则是工作不正常。最后是修改了以下代码解决问题:

diff --git a/services/usb/java/com/android/server/usb/UsbHostManager.java b/services/usb/java/com/android/server/usb/UsbHostManager.java
index e769bda..115c0a7 100644
--- a/services/usb/java/com/android/server/usb/UsbHostManager.java
+++ b/services/usb/java/com/android/server/usb/UsbHostManager.java
@@ -230,6 +230,8 @@ public class UsbHostManager {
             mNewConfigurations = null;
             mNewInterfaces = null;
             mNewEndpoints = null;
+	    mNewConfiguration = null;
+	    mNewInterface = null;
         }
     }
 
-- 

 

你可能感兴趣的:(Android)