Android new vendor ID enable
2015-06-29 13:25
459 查看
转自:/article/1423002.html
When we develop the Android, maybe we will change the USB Vendor ID and Product ID according the chip provider. After we change it, the driver provided by Google won't work with it. So, we need some other operation.
Please take the following information as a reference.
Android 2.1_r2 with Linux 2.6.30
In drivers/usb/gadget/android.c, it will define the VID and PID as following.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/* Default vendor and product IDs, overridden by platform data */
#define VENDOR_ID 0x18D1
#define PRODUCT_ID 0x0001
#define ADB_PRODUCT_ID 0x0002
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Maybe you will change to other value for VID and PID. Taking following as a reference.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/* Changed vendor and product IDs, overridden by platform data */
#define VENDOR_ID 0x2020
#define PRODUCT_ID 0x0018
#define ADB_PRODUCT_ID 0x0019
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
After you do like this, you need to modify the default adb driver in android_winusb.inffile. Add the following lines
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;Test
%SingleAdbInterface% = USB_Install, USB/VID_2020&PID_0019
%CompositeAdbInterface% = USB_Install, USB/VID_2020&PID_00019&MI_01
%SingleBootLoaderInterface% = USB_Install, USB/VID_2020&PID_0FFF
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
After this, I think the device can be detected in windows. Then if you want it work with Android SDK, you still need one more step.
Enter the Android SDK tools directory and execute android.bat update adb. after this operation, you will get the .android folder with android_usb.ini file under C:/Documents and Settings/<login_name>. Then add the test USB vendor ID in it. After editing it, it looks like
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x2020
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Then the Adb can work well.
When we develop the Android, maybe we will change the USB Vendor ID and Product ID according the chip provider. After we change it, the driver provided by Google won't work with it. So, we need some other operation.
Please take the following information as a reference.
Android 2.1_r2 with Linux 2.6.30
In drivers/usb/gadget/android.c, it will define the VID and PID as following.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/* Default vendor and product IDs, overridden by platform data */
#define VENDOR_ID 0x18D1
#define PRODUCT_ID 0x0001
#define ADB_PRODUCT_ID 0x0002
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Maybe you will change to other value for VID and PID. Taking following as a reference.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
/* Changed vendor and product IDs, overridden by platform data */
#define VENDOR_ID 0x2020
#define PRODUCT_ID 0x0018
#define ADB_PRODUCT_ID 0x0019
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
After you do like this, you need to modify the default adb driver in android_winusb.inffile. Add the following lines
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;Test
%SingleAdbInterface% = USB_Install, USB/VID_2020&PID_0019
%CompositeAdbInterface% = USB_Install, USB/VID_2020&PID_00019&MI_01
%SingleBootLoaderInterface% = USB_Install, USB/VID_2020&PID_0FFF
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
After this, I think the device can be detected in windows. Then if you want it work with Android SDK, you still need one more step.
Enter the Android SDK tools directory and execute android.bat update adb. after this operation, you will get the .android folder with android_usb.ini file under C:/Documents and Settings/<login_name>. Then add the test USB vendor ID in it. After editing it, it looks like
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.
0x2020
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Then the Adb can work well.
相关文章推荐
- 《打造高质量Android应用:Android开发必知的50个诀窍》
- Android 关于inflate
- Android反编译改变一些东西之后再次打包
- 为什么是“51-android.rules”?
- android studio 使用笔记
- Android开发中解决动画只执行一次的方法
- android Ant 批量多渠道打包
- Android布局中layout_gravity与gravity的使用总结
- Android 基于google Zxing实现二维码、条形码扫描
- Android Thread线程
- android开发自定义View,可以自由拖动的控件
- Android权威官方屏幕适配全攻略
- 打造一个全命令行的Android构建系统
- 使用Android Studio遇到JAVA (TM) Platform SE binary stop working的问题
- android studio的使用心得
- Android—解决重写TextView设置字体大量引用后卡屯的问题
- Android 框架练成 教你打造高效的图片加载框架
- Android调用WebService系列之请求调用
- Android Apk病毒查杀
- android应用存储用户信息,map集合与用户对象存储