summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Walleij <triad@df.lth.se>2010-11-30 23:49:36 +0000
committerLinus Walleij <triad@df.lth.se>2010-11-30 23:49:36 +0000
commite1d774b20976f4ff869557c237392b49daf7baef (patch)
treee228fc2c56ca2ea16699b0465e72d4480578a18c
parent6d3c222ac5a210e9dc1e53c817b663df971193db (diff)
downloadlibmtp-e1d774b20976f4ff869557c237392b49daf7baef.tar.gz
Stasg up check script
-rw-r--r--ChangeLog2
-rw-r--r--TODO5
-rw-r--r--util/check_mtp_device.sh28
3 files changed, 33 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 3bcd039..e9cae9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@
* utils/: move out mtp-hotplug into its own subdir,
intend to put programs to probe devices here too.
* utils/mtp-hotplug.c: moved the hotplug program here.
+ * utils/check_mtp_device.sh: tentative script for
+ checking MTP devices.
2010-11-24 Linus Walleij <triad@df.lth.se>
diff --git a/TODO b/TODO
index 74ad560..d416da0 100644
--- a/TODO
+++ b/TODO
@@ -47,18 +47,19 @@ FEATURE fixes:
atleast a call to the cache update function.
3. FEATURE: Mechanism to retrieve the device icon device property, else if not
- present, look for DevIcon.fil (Windows ICO format) and
+ present, look for DevIcon.fil (Windows ICO format) and
DevLogo.fil (PNG Format) images from the device (if available).
4. FEATURE: Shared device access so that multiple client applications can have
an open connection to the device at the same time via a handle. For example,
- it should be somehow possible to run mtp-detect at the same time as amarok or
+ it should be somehow possible to run mtp-detect at the same time as amarok or
mtpfs is connected to a device. This would require some form of resource
sharing.
5. FEATURE: Implement an OpenSync backend for devices which have
calendaring, contact etc support. http://opensync.org/
+6. FEATURE: program to autoprobe device interfaces on connection.
THOSE ARE ALREADY DONE:
diff --git a/util/check_mtp_device.sh b/util/check_mtp_device.sh
new file mode 100644
index 0000000..66054c1
--- /dev/null
+++ b/util/check_mtp_device.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+# usage ./a.sh /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-8 mtp
+# here $1 is devicepath
+# $2 is the string descriptor to match against
+# Use from udev:
+# PROGRAM="/<prefix>/check_mtp_device.sh /sys$env{DEVPATH} mtp" SYMLINK+="libmtp-%k", MODE="666", GROUP="plugdev"
+checklog="/tmp/check_mtp_device_log.txt"
+echo $1 > $checklog
+
+if [ -d $1 ]
+then
+ cd $1
+ #check if the string 'interface' exists and contains
+ # the string descriptor
+ grep -i $2 `find -name interface`
+ #echo $result >> $checklog
+ if [ "$?" -eq "0" ]
+ then
+ echo "found $2 string descriptor, return 0" >> $checklog
+ exit 0;
+ else
+ echo "did not find $2 string descriptor, return 1" >> $checklog
+ exit 1;
+ fi
+else
+ echo "$1 does not exist, return 1\n" >> $checklog
+ exit 1;
+fi