-static inline char *get_action(void)
-{
- char *action;
-
- action = getenv("ACTION");
- return action;
-}
-
-static inline char *get_devpath(void)
-{
- char *devpath;
-
- devpath = getenv("DEVPATH");
- return devpath;
-}
-
-static inline char *get_seqnum(void)
-{
- char *seqnum;
-
- seqnum = getenv("SEQNUM");
- return seqnum;
-}
-
-static inline int udev_user(int argc, char **argv)
-{
- static const char short_options[] = "q:rVh";
- int option;
- int retval = -EINVAL;
- struct udevice dev;
-
- while (1) {
- option = getopt(argc, argv, short_options);
- if (option == -1)
- break;
-
- dbg("option '%c'", option);
- switch (option) {
- case 'q':
- dbg("udev query: %s\n", optarg);
- retval = udevdb_open_ro();
- if (retval != 0) {
- printf("unable to open udev database\n");
- return -1;
- }
- retval = udevdb_get_dev(optarg, &dev);
- if (retval == 0) {
- printf("%s\n", dev.name);
- } else {
- printf("device not found in udev database\n");
- }
- udevdb_exit();
- return retval;
-
- case 'r':
- printf("%s\n", udev_root);
- return 0;
-
- case 'V':
- printf("udev, version %s\n", UDEV_VERSION);
- return 0;
-
- case 'h':
- retval = 0;
- case '?':
- default:
- goto help;
- }
- }
-
-help:
- printf("Usage: [-qrVh]\n"
- " -q <path> query database for the name of the created node\n"
- " -r print udev root\n"
- " -V print udev version\n"
- " -h print this help text\n"
- "\n");
-
- return retval;
-}
-