日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Android >内容正文

Android

build libusb for Android

發(fā)布時間:2023/12/15 Android 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 build libusb for Android 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

平臺

libusb版本:libusb-1.0.20

Ubuntu: 14.04

NDK:android-ndk-r9d

測試手機:三星S4

開發(fā)板:GD32

==================

?

Building:

---------

?

To build libusb for Android do the following:

?

1. Download the latest NDK from:

http://developer.android.com/tools/sdk/ndk/index.html

?

2. Extract the NDK.

?

3. Open a shell and make sure there exist an NDK global variable

set to the directory where you extracted the NDK.

?

4. Change directory to libusb's "android/jni"

?

5. Run "ndk-build".(需要設置環(huán)境變量或者使用絕對路徑)

?

The libusb library, examples and tests can then be found in:

"android/libs/$ARCH"

?

Where $ARCH is one of:

armeabi(測試使用此架構,armeabi-v7a未測試)

armeabi-v7a

x86

?

Installing:

-----------

For a rooted device it is possible to install libusb into the system

image of a running device:

?

1. Connect the device to a machine running ADB.

?

2. Execute the following commands on the machine

running ADB:

?

# Make the system partition writable

adb shell su -c "mount -o remount,rw /system"

?

# Install libusb

adb push obj/local/armeabi/libusb1.0.so /sdcard/

adb shell su -c "cat > /system/lib/libusb1.0.so < /sdcard/libusb1.0.so"

adb shell rm /sdcard/libusb1.0.so

?

?

Test:

-----------

1. new project file

1) 任意目錄下mkdir libusb_for_android

2) 在libusb_for_android/ 添加libusb1.0.so、libusb.h、usbtest2.0.c,并且新建jni目錄

3) 在jni/ 新建Android.mk和Application.mk

?

2. 在jni/下運行:/opt/android_ndk/android-ndk-r9d/ndk-build

在libusb_for_android/libs/armeabi/下即可找到產生的可執(zhí)行文件usbtest

?

3. 將usbtest adb push到手機的sdcard/

?

4. 將開發(fā)板和手機相連,然后再手機的超級終端下運行:./usbtest

?

總結

以上是生活随笔為你收集整理的build libusb for Android的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內容還不錯,歡迎將生活随笔推薦給好友。