Skip to content

Commit 2342bfd

Browse files
committed
Initial commit
0 parents  commit 2342bfd

39 files changed

+1369
-0
lines changed

.gitignore

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Created by https://www.gitignore.io/api/android,intellij
2+
3+
### Android ###
4+
# Built application files
5+
*.apk
6+
*.ap_
7+
8+
# Files for the ART/Dalvik VM
9+
*.dex
10+
11+
# Java class files
12+
*.class
13+
14+
# Generated files
15+
bin/
16+
gen/
17+
out/
18+
19+
# Gradle files
20+
.gradle/
21+
build/
22+
23+
# Local configuration file (sdk path, etc)
24+
local.properties
25+
26+
# Proguard folder generated by Eclipse
27+
proguard/
28+
29+
# Log Files
30+
*.log
31+
32+
# Android Studio Navigation editor temp files
33+
.navigation/
34+
35+
# Android Studio captures folder
36+
captures/
37+
38+
# Intellij
39+
*.iml
40+
.idea/workspace.xml
41+
.idea/libraries
42+
43+
# Keystore files
44+
*.jks
45+
46+
### Android Patch ###
47+
gen-external-apklibs
48+
49+
50+
### Intellij ###
51+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
52+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
53+
54+
# User-specific stuff:
55+
.idea/workspace.xml
56+
.idea/tasks.xml
57+
.idea/dictionaries
58+
.idea/vcs.xml
59+
.idea/jsLibraryMappings.xml
60+
61+
# Sensitive or high-churn files:
62+
.idea/dataSources.ids
63+
.idea/dataSources.xml
64+
.idea/dataSources.local.xml
65+
.idea/sqlDataSources.xml
66+
.idea/dynamic.xml
67+
.idea/uiDesigner.xml
68+
69+
# Gradle:
70+
.idea/gradle.xml
71+
.idea/libraries
72+
73+
# Mongo Explorer plugin:
74+
.idea/mongoSettings.xml
75+
76+
## File-based project format:
77+
*.iws
78+
79+
## Plugin-specific files:
80+
81+
# IntelliJ
82+
/out/
83+
84+
# mpeltonen/sbt-idea plugin
85+
.idea_modules/
86+
87+
# JIRA plugin
88+
atlassian-ide-plugin.xml
89+
90+
# Crashlytics plugin (for Android Studio and IntelliJ)
91+
com_crashlytics_export_strings.xml
92+
crashlytics.properties
93+
crashlytics-build.properties
94+
fabric.properties
95+
96+
### Intellij Patch ###
97+
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
98+
99+
# *.iml
100+
# modules.xml
101+
# .idea/misc.xml
102+
# *.ipr

.idea/.name

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

.idea/compiler.xml

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

.idea/copyright/profiles_settings.xml

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

.idea/encodings.xml

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

.idea/misc.xml

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

.idea/modules.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.

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2016 Tobias Trumm
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Android Raspberry Pi Keyboard
2+
© 2016 [Tobias Trumm](mailto:[email protected]) licensed under MIT license
3+
4+
## Info
5+
Use your Android device as an USB keyboard on your Raspberry Pi (or other Linux devices).
6+
7+
I wrote this app mainly because I wanted to learn how to communicate between Android and other devices over USB. Do not expect it to work flawlessly, not all keys will work. If you are looking for a simple way to control your Raspberry Pi from your Android device there are probably better solutions out there. Depending on the software keyboard on your Android device this app will work better or worse. I have got the best results using [Hacker's Keyboard](https://play.google.com/store/apps/details?id=org.pocketworkstation.pckeyboard).
8+
9+
## Python Dependencies
10+
- [python-evdev](https://python-evdev.readthedocs.io/)
11+
- [pyusb](https://walac.github.io/pyusb/)
12+
- [pyudev](https://pyudev.readthedocs.io/)
13+
14+
## Usage
15+
1. Install the app on your Android device and copy the python scripts from the `linux_client/` directory to your Raspberry Pi.
16+
2. Attach your Android device to your Raspberry Pi with an USB cable.
17+
3. Get the vendor ID of your Android device. Open a terminal and execute `lsusb`. You will see a list of USB devices with their vendor and product ID. The first 4 characters are the vendor ID.
18+
4. Start the `accessory.py` script with `sudo python accessory.py xxxx`. Replace `xxxx` with your vendor ID.
19+
5. A message asking for permission to use the USB connection should have appeared on your Android device. Accept it. Now you should be able to use your Android device as a keyboard.
20+
6. To exit the python script, use `Ctrl` + `c`

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 24
5+
buildToolsVersion "23.0.3"
6+
7+
defaultConfig {
8+
applicationId "de.tobiastrumm.raspberrykeyboard"
9+
minSdkVersion 12
10+
targetSdkVersion 24
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
compile fileTree(dir: 'libs', include: ['*.jar'])
24+
testCompile 'junit:junit:4.12'
25+
compile 'com.android.support:appcompat-v7:24.0.0'
26+
}

app/proguard-rules.pro

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in C:\Users\tobia_000\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package de.tobiastrumm.raspberrykeyboard;
2+
3+
import android.app.Application;
4+
import android.test.ApplicationTestCase;
5+
6+
/**
7+
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8+
*/
9+
public class ApplicationTest extends ApplicationTestCase<Application> {
10+
public ApplicationTest() {
11+
super(Application.class);
12+
}
13+
}

app/src/main/AndroidManifest.xml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="de.tobiastrumm.raspberrykeyboard">
4+
5+
<uses-feature android:name="android.hardware.usb.accessory" />
6+
7+
8+
<application
9+
android:allowBackup="true"
10+
android:icon="@mipmap/ic_launcher"
11+
android:label="@string/app_name"
12+
android:supportsRtl="true"
13+
android:theme="@style/AppTheme">
14+
<activity android:name=".MainActivity"
15+
android:windowSoftInputMode="stateVisible"
16+
android:launchMode="singleTop">
17+
<intent-filter>
18+
<action android:name="android.intent.action.MAIN" />
19+
20+
<category android:name="android.intent.category.LAUNCHER" />
21+
</intent-filter>
22+
23+
<intent-filter>
24+
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
25+
</intent-filter>
26+
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
27+
android:resource="@xml/accessory_filter" />
28+
29+
</activity>
30+
</application>
31+
32+
</manifest>

0 commit comments

Comments
 (0)