/*
* Copyright (C) 2008-2009 Kay Sievers <kay@vrfy.org>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "string-util.h"
#include "udev-util.h"
#include "udev.h"
#include "udevadm-util.h"
#include "util.h"
static int verbose;
static int dry_run;
int fd;
if (verbose)
if (dry_run)
continue;
if (fd < 0)
continue;
}
}
char *pos;
pos[0] = 0;
pos++;
}
return buf;
}
static void help(void) {
printf("%s trigger OPTIONS\n\n"
"Request events from the kernel.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
" -v --verbose Print the list of devices while running\n"
" -n --dry-run Do not actually trigger the events\n"
" -t --type= Type of events to trigger\n"
" devices sysfs devices (default)\n"
" subsystems sysfs subsystems and drivers\n"
" -c --action=ACTION Event action value, default is \"change\"\n"
" -s --subsystem-match=SUBSYSTEM Trigger devices from a matching subsystem\n"
" -S --subsystem-nomatch=SUBSYSTEM Exclude devices from a matching subsystem\n"
" -a --attr-match=FILE[=VALUE] Trigger devices with a matching attribute\n"
" -A --attr-nomatch=FILE[=VALUE] Exclude devices with a matching attribute\n"
" -p --property-match=KEY=VALUE Trigger devices with a matching property\n"
" -g --tag-match=KEY=VALUE Trigger devices with a matching property\n"
" -y --sysname-match=NAME Trigger devices with this /sys path\n"
" --name-match=NAME Trigger devices with this /dev name\n"
" -b --parent-match=NAME Trigger devices with that parent device\n"
}
enum {
};
{}
};
enum {
int c, r;
if (udev_enumerate == NULL)
return 1;
const char *key;
const char *val;
switch (c) {
case 'v':
verbose = 1;
break;
case 'n':
dry_run = 1;
break;
case 't':
else {
return 2;
}
break;
case 'c':
return 2;
} else
break;
case 's':
if (r < 0) {
return 2;
}
break;
case 'S':
if (r < 0) {
return 2;
}
break;
case 'a':
if (r < 0) {
return 2;
}
break;
case 'A':
if (r < 0) {
return 2;
}
break;
case 'p':
if (r < 0) {
return 2;
}
break;
case 'g':
if (r < 0) {
return 2;
}
break;
case 'y':
if (r < 0) {
return 2;
}
break;
case 'b': {
return 2;
}
if (r < 0) {
return 2;
}
break;
}
case ARG_NAME: {
return 2;
}
if (r < 0) {
return 2;
}
break;
}
case 'h':
help();
return 0;
case '?':
return 1;
default:
assert_not_reached("Unknown option");
}
}
return 2;
}
if (r < 0) {
return 2;
}
}
switch (device_type) {
case TYPE_SUBSYSTEMS:
return 0;
case TYPE_DEVICES:
return 0;
default:
assert_not_reached("device_type");
}
}
.name = "trigger",
.cmd = adm_trigger,
.help = "Request events from the kernel",
};