summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2017-11-07 02:29:55 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2017-11-07 02:29:55 +0100
commit83fef6c8958377258a764702ddda85f29ba6f3af (patch)
tree83e3e18d9968c8aad946cb463a72e9fea5e5c197 /utils
parent7ce13b410d3cdf5c3365b9525e3a8a213f7f3c05 (diff)
Make devprobe able to talk with userland drivers
* utils/devprobe.c: Include <fcntl.h> (options): Add "master-device" ('M') option. (main): Handle 'M' option by opening the given filename for `device_master'.
Diffstat (limited to 'utils')
-rw-r--r--utils/devprobe.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/utils/devprobe.c b/utils/devprobe.c
index d7020322..69b15b29 100644
--- a/utils/devprobe.c
+++ b/utils/devprobe.c
@@ -19,6 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
+#include <fcntl.h>
#include <argp.h>
#include <hurd.h>
@@ -32,6 +33,7 @@ static const struct argp_option options[] = {
{"silent", 's', 0, 0, "Don't print devices found"},
{"quiet", 0, 0, OPTION_ALIAS},
{"first", 'f', 0, 0, "Stop after the first device found"},
+ {"master-device", 'M', "FILE", 0, "Get a pseudo master device port"},
{0}
};
static const char *args_doc = "DEVNAME...";
@@ -66,6 +68,17 @@ main (int argc, char **argv)
case 'f':
all = 0; break;
+ case 'M':
+ if (device_master != MACH_PORT_NULL)
+ mach_port_deallocate (mach_task_self (), device_master);
+
+ device_master = file_name_lookup (arg, O_READ | O_WRITE, 0);
+ if (device_master == MACH_PORT_NULL)
+ argp_failure (state, 3, errno, "Can't open device master port %s",
+ arg);
+
+ break;
+
case ARGP_KEY_ARG:
if (device_master == MACH_PORT_NULL)
{