Android-4.2-3G porting path libusb (1)

Source: Internet
Author: User

Android-4.2-3G porting path libusb (1)

Some time ago, we transplanted 3G modules to smart TV and found that Baidu Google, which transplanted 3G, found that it was basically on the linux development board,

Here, I will record the whole process of porting, so that others can avoid detours. If you have any suggestions or do not want to send a message, please leave a message ~

 

Currently, all 3G modules use usb interfaces. It is identified as a usb storage device by default in the android system and will be mounted as a usb storage device through Vold!

Therefore, you must switch the device type to a Modem device. Only in this way can you achieve normal communication between the host and the module. Here you need a conversion driver,

 

Only through the mode conversion is correct identification of 3G devices, here first parse the usb-modeswitch required API porting.

 

 

2. Compile libusb/libusb-compat

You can download the latestLibusb-1.0.9AndLibusb-compat-0.1.4(Compatible with long versions ),

Decompress the package to our android source codeExternal, The two lib is for the following usb_modeswitch service dynamic library, can be directly on the linux cross compilation, and finally can get libusb. so libusb-compat.so, the compilation method has a lot of online!

I want to transplant it to the android platform, so I will compile it in external using the android compilation mechanism!

Add Android. mk to the two folders

First look at the libusb Android. mk:

 

#jscese add this android.mk to compile libusb.so for usb_modelswitch 140819LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)common_src :=libusb/core.c libusb/descriptor.c libusb/io.c libusb/sync.c libusb/os/linux_usbfs.c common_include :=$(LOCAL_PATH)/ $(LOCAL_PATH)/libusb $(LOCAL_PATH)/libusb/osLOCAL_MODULE := libusbLOCAL_SRC_FILES :=$(common_src)LOCAL_C_INCLUDES +=$(common_include)include $(BUILD_SHARED_LIBRARY)

 

We can see that only five. c source files are compiled. Some of the libusb packages we downloaded do not need to be modified or configured,

My libusb source code download: http://download.csdn.net/detail/jscese/7868431

 

Android. mk of libusb-compat:

 

#jscese add this android.mk to compile libusb-compat.so for usb_modelswitch 140819LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LIBUSB_DIR :=external/libusbcommon_src :=libusb/core.c common_include :=$(LOCAL_PATH)/ $(LOCAL_PATH)/libusb $(LIBUSB_DIR)/libusbLOCAL_MODULE := libusb-compatLOCAL_SRC_FILES :=$(common_src)LOCAL_C_INCLUDES +=$(common_include)LOCAL_SHARED_LIBRARIES := libusbinclude $(BUILD_SHARED_LIBRARY)

 

We can see that libusb-compat introduces libusb

My libusb-compat source code download: http://download.csdn.net/detail/jscese/7868445

 

You can use the following code in the source code:

 

mmm external/libusb

Compile the corresponding. so

 

 

Here we will record the libusb port first, step by step ..

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.