Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/devctl/devctl.c
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | fprintf(stderr, | ||||
" devctl enable device\n" | " devctl enable device\n" | ||||
" devctl suspend device\n" | " devctl suspend device\n" | ||||
" devctl resume device\n" | " devctl resume device\n" | ||||
" devctl set driver [-f] device driver\n" | " devctl set driver [-f] device driver\n" | ||||
" devctl clear driver [-f] device\n" | " devctl clear driver [-f] device\n" | ||||
" devctl rescan device\n" | " devctl rescan device\n" | ||||
" devctl delete [-f] device\n" | " devctl delete [-f] device\n" | ||||
" devctl freeze\n" | " devctl freeze\n" | ||||
" devctl thaw\n"); | " devctl thaw\n" | ||||
" devctl reset [-d] device\n" | |||||
); | |||||
exit(1); | exit(1); | ||||
} | } | ||||
static int | static int | ||||
devctl_table_handler(struct devctl_command **start, | devctl_table_handler(struct devctl_command **start, | ||||
struct devctl_command **end, int ac, char **av) | struct devctl_command **end, int ac, char **av) | ||||
{ | { | ||||
struct devctl_command **cmd; | struct devctl_command **cmd; | ||||
▲ Show 20 Lines • Show All 284 Lines • ▼ Show 20 Lines | thaw(int ac, char **av __unused) | ||||
if (ac != 1) | if (ac != 1) | ||||
thaw_usage(); | thaw_usage(); | ||||
if (devctl_thaw() < 0) | if (devctl_thaw() < 0) | ||||
err(1, "Failed to thaw probe/attach"); | err(1, "Failed to thaw probe/attach"); | ||||
return (0); | return (0); | ||||
} | } | ||||
DEVCTL_COMMAND(top, thaw, thaw); | DEVCTL_COMMAND(top, thaw, thaw); | ||||
static void | |||||
reset_usage(void) | |||||
{ | |||||
fprintf(stderr, "usage: devctl reset [-d] device\n"); | |||||
exit(1); | |||||
} | |||||
static int | |||||
reset(int ac, char **av) | |||||
{ | |||||
bool detach; | |||||
int ch; | |||||
detach = false; | |||||
while ((ch = getopt(ac, av, "d")) != -1) | |||||
switch (ch) { | |||||
case 'd': | |||||
detach = true; | |||||
break; | |||||
default: | |||||
reset_usage(); | |||||
} | |||||
ac -= optind; | |||||
av += optind; | |||||
if (ac != 1) | |||||
reset_usage(); | |||||
if (devctl_reset(av[0], detach) < 0) | |||||
err(1, "Failed to reset %s", av[0]); | |||||
return (0); | |||||
} | |||||
DEVCTL_COMMAND(top, reset, reset); | |||||
int | int | ||||
main(int ac, char *av[]) | main(int ac, char *av[]) | ||||
{ | { | ||||
struct devctl_command **cmd; | struct devctl_command **cmd; | ||||
if (ac == 1) | if (ac == 1) | ||||
usage(); | usage(); | ||||
Show All 14 Lines |