From 4f4082b6fac5d3ac61b1cc626759615b9b2813cc Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Wed, 1 Dec 2010 23:00:00 +0000 Subject: mtp-probe program added --- util/Makefile.am | 3 ++- util/mtp-hotplug.c | 2 +- util/mtp-probe.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 util/mtp-probe.c (limited to 'util') diff --git a/util/Makefile.am b/util/Makefile.am index 78e7015..8e2b002 100644 --- a/util/Makefile.am +++ b/util/Makefile.am @@ -1,6 +1,7 @@ -bin_PROGRAMS=mtp-hotplug +bin_PROGRAMS=mtp-hotplug mtp-probe mtp_hotplug_SOURCES=mtp-hotplug.c +mtp_probe_SOURCES=mtp-probe.c AM_CPPFLAGS=-I$(top_builddir)/src LDADD=../src/libmtp.la diff --git a/util/mtp-hotplug.c b/util/mtp-hotplug.c index f8036ba..1266ebf 100644 --- a/util/mtp-hotplug.c +++ b/util/mtp-hotplug.c @@ -1,6 +1,6 @@ /** * \file mtp-hotplug.c - * Example program to create hotplug scripts. + * Program to create hotplug scripts. * * Copyright (C) 2005-2010 Linus Walleij * Copyright (C) 2006-2008 Marcus Meissner diff --git a/util/mtp-probe.c b/util/mtp-probe.c new file mode 100644 index 0000000..7de15f8 --- /dev/null +++ b/util/mtp-probe.c @@ -0,0 +1,48 @@ +/** + * \file mtp-probe.c + * Program to probe newly connected device interfaces from + * userspace to determine if they are MTP devices, used for + * udev rules. + * + * Invoke the program on a sysfs device entry to check it + * for MTP signatures, e.g. + * mtp-probe /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-8 + * + * Exits with status code 0 if the device is an MTP device, + * else exits with 1. + * + * Copyright (C) 2010 Linus Walleij + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ +#include +#include +#include +#include +#include + +int main (int argc, char **argv) +{ + char *fname; + + if (argc < 2) { + printf("No device file to check\n"); + exit(1); + } + fname = argv[1]; + printf("Checking: \"%s\"...\n", fname); + exit (1); +} -- cgit v1.2.1