[PATCH 10/10] Open subsurface on attaching divecomputer

Anton Lundin glance at acc.umu.se
Thu Aug 20 15:19:46 PDT 2015


From: Venkatesh Shukla <venkatesh.shukla.eee11 at iitbhu.ac.in>

Added USB usage permissions in manifest.
Also added various FTDI based USB devices in xml/device_filter.xml. When any
device matching the VID and PID provided in the device_filter.xml is attached,
subsurface application is opened automatically. Also, the USB permissions are
granted to the application. This simplifies the USB file generation approach.

Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11 at iitbhu.ac.in>
Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 android/AndroidManifest.xml       | 10 +++++++++-
 android/res/xml/device_filter.xml | 14 ++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 android/res/xml/device_filter.xml

diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
index 8826237..c9a016a 100644
--- a/android/AndroidManifest.xml
+++ b/android/AndroidManifest.xml
@@ -81,6 +81,12 @@
 	    <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/>
             -->
             <!-- Splash screen -->
+            <intent-filter>
+                <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
+            </intent-filter>
+
+            <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
+                android:resource="@xml/device_filter" />
 
         </activity>
     </application>
@@ -91,7 +97,9 @@
         android:anyDensity="true"
         android:largeScreens="true"
         android:normalScreens="true"
-        android:smallScreens="true" />
+	android:smallScreens="true" />
+
+    <uses-feature android:name="android.hardware.usb.host" />
 
     <!--
          The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
diff --git a/android/res/xml/device_filter.xml b/android/res/xml/device_filter.xml
new file mode 100644
index 0000000..fc9333b
--- /dev/null
+++ b/android/res/xml/device_filter.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <!-- FTDI Chips -->
+    <!-- (Smart Interface), Heinrichs Weikamp -->
+    <usb-device vendor-id="1027" product-id="24577"/>
+    <usb-device vendor-id="1027" product-id="24592"/>
+    <usb-device vendor-id="1027" product-id="24593"/>
+    <!-- Oceanic Custom PID -->
+    <usb-device vendor-id="1027" product-id="62560"/>
+    <!-- Suunto Custom PID -->
+    <usb-device vendor-id="1027" product-id="63104"/>
+    <!-- Cressi (Leonardo) Custom PID -->
+    <usb-device vendor-id="1027" product-id="63104"/>
+</resources>
-- 
2.1.4



More information about the subsurface mailing list