Skip to content

Commit f487a70

Browse files
committed
Initial commit
0 parents  commit f487a70

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2046
-0
lines changed

.gitignore

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Built application files
2+
*.apk
3+
*.aar
4+
*.ap_
5+
*.aab
6+
7+
# Files for the ART/Dalvik VM
8+
*.dex
9+
10+
# Java class files
11+
*.class
12+
13+
# Generated files
14+
bin/
15+
gen/
16+
out/
17+
# Uncomment the following line in case you need and you don't have the release build type files in your app
18+
# release/
19+
20+
# Gradle files
21+
.gradle/
22+
build/
23+
24+
# Local configuration file (sdk path, etc)
25+
local.properties
26+
27+
# Proguard folder generated by Eclipse
28+
proguard/
29+
30+
# Log Files
31+
*.log
32+
33+
# Android Studio Navigation editor temp files
34+
.navigation/
35+
36+
# Android Studio captures folder
37+
captures/
38+
39+
# IntelliJ
40+
*.iml
41+
.idea/workspace.xml
42+
.idea/tasks.xml
43+
.idea/gradle.xml
44+
.idea/assetWizardSettings.xml
45+
.idea/dictionaries
46+
.idea/libraries
47+
# Android Studio 3 in .gitignore file.
48+
.idea/caches
49+
.idea/modules.xml
50+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
51+
.idea/navEditor.xml
52+
53+
# Keystore files
54+
# Uncomment the following lines if you do not want to check your keystore files in.
55+
#*.jks
56+
#*.keystore
57+
58+
# External native build folder generated in Android Studio 2.2 and later
59+
.externalNativeBuild
60+
.cxx/
61+
62+
# Google Services (e.g. APIs or Firebase)
63+
# google-services.json
64+
65+
# Freeline
66+
freeline.py
67+
freeline/
68+
freeline_project_description.json
69+
70+
# fastlane
71+
fastlane/report.xml
72+
fastlane/Preview.html
73+
fastlane/screenshots
74+
fastlane/test_output
75+
fastlane/readme.md
76+
77+
# Version control
78+
vcs.xml
79+
80+
# lint
81+
lint/intermediates/
82+
lint/generated/
83+
lint/outputs/
84+
lint/tmp/
85+
# lint/reports/
86+
87+
# Android Profiling
88+
*.hprof

.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/Project.xml

+116
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

+25
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# USB Gadget Tool
2+
Convert your Android to any USB device you like!
3+
4+
Following USB gadgets are integrated:
5+
* Keyboard & Mouse (/dev/hidg0 & /dev/hidg1)
6+
* FIDO CTAP (/dev/hidg0 - for WebAuthn)
7+
* CCID (Chip Card Interface Device)
8+
9+
## Roadmap
10+
* root command logging in App
11+
* Creating & enabling USB Gadgets during boot
12+
* Import custom USB Gadget profiles
13+
14+
## How does it work?
15+
USB Gadget Tool uses ConfigFS - an userspace API inside the Linux Kernel - for creation of arbitrary USB composite devices.
16+
https://www.kernel.org/doc/Documentation/filesystems/configfs/configfs.txt

app/build.gradle

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 29
5+
6+
defaultConfig {
7+
applicationId "net.tjado.usbgadget"
8+
minSdkVersion 26
9+
targetSdkVersion 29
10+
versionCode 1
11+
versionName "1.0"
12+
13+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14+
}
15+
16+
buildTypes {
17+
release {
18+
minifyEnabled false
19+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
20+
}
21+
}
22+
compileOptions {
23+
sourceCompatibility JavaVersion.VERSION_1_8
24+
targetCompatibility JavaVersion.VERSION_1_8
25+
}
26+
}
27+
28+
dependencies {
29+
implementation fileTree(dir: "libs", include: ["*.jar"])
30+
implementation 'androidx.appcompat:appcompat:1.1.0'
31+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
32+
implementation 'androidx.recyclerview:recyclerview:1.1.0'
33+
implementation 'androidx.cardview:cardview:1.0.0'
34+
testImplementation 'junit:junit:4.12'
35+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
36+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
37+
38+
}

app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package net.tjado.usbgadget;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
assertEquals("net.tjado.usbgadget", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="net.tjado.usbgadget">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>

app/src/main/assets/configfs.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
find /config/usb_gadget/ -exec ls -la {} \; 2>&1

0 commit comments

Comments
 (0)