udevadm-info.c revision 8753fadf2a6ecead372e71b8bf9336cf29f9c958
/*
* Copyright (C) 2004-2008 Kay Sievers <kay.sievers@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 "config.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stddef.h>
#include <ctype.h>
#include <stdarg.h>
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <getopt.h>
#include "udev.h"
{
char filename[UTIL_PATH_SIZE];
const char *value;
continue;
continue;
continue;
continue;
continue;
continue;
/* skip nonprintable attributes */
len--;
if (len > 0) {
continue;
}
}
}
printf("\n");
}
{
struct udev_device *device_parent;
const char *str;
printf("\n"
"Udevinfo starts with the device specified by the devpath and then\n"
"walks up the chain of parent devices. It prints for every device\n"
"found, all possible attributes in the udev rules key format.\n"
"A rule to match, can be composed by the attributes of the device\n"
"and the attributes from one single parent device.\n"
"\n");
str = "";
str = "";
do {
if (device_parent == NULL)
break;
str = "";
str = "";
} while (device_parent != NULL);
return 0;
}
{
return 0;
}
static int print_record_properties_cb(struct udev_device *device, const char *key, const char *value, void *data)
{
return 0;
}
{
int i;
if (i != 0)
printf("L: %i\n", i);
if (i != 0)
printf("A:%u\n", i);
if (i != 0)
printf("R:%u\n", i);
printf("\n");
}
void *data)
{
struct udev_device *device;
return 0;
return 0;
}
{
int count;
struct name_entry *device;
if (count <= 0)
goto out;
/* select the device that matches */
struct udevice *udevice_loop;
char filename[UTIL_PATH_SIZE];
if (udevice_loop == NULL)
break;
goto next;
/* make sure, we don't get a link of a different device */
goto next;
goto next;
}
break;
next:
}
out:
return udev_device;
}
{
} else {
char *str;
}
return 0;
}
{
}
static int print_property_cb(struct udev_device *device, const char *key, const char *value, void *data)
{
return 0;
}
{
return -1;
if (export) {
prefix = "INFO_";
printf("%sMAJOR=%d\n"
"%sMINOR=%d\n",
} else
return 0;
}
{
int root = 0;
int export = 0;
const char *export_prefix = NULL;
char path[UTIL_PATH_SIZE];
char name[UTIL_PATH_SIZE];
char *links;
int rc = 0;
{}
};
enum action_type {
} action = ACTION_NONE;
enum query_type {
} query = QUERY_NONE;
while (1) {
int option;
if (option == -1)
break;
switch (option) {
case 'n':
rc = 2;
goto exit;
}
/* remove /dev if given */
else
break;
case 'p':
rc = 2;
goto exit;
}
/* add /sys if needed */
} else {
}
break;
case 'q':
query = QUERY_NAME;
break;
}
break;
}
query = QUERY_PATH;
break;
}
break;
}
break;
}
rc = 2;
goto exit;
case 'r':
if (action == ACTION_NONE)
root = 1;
break;
case 'd':
break;
case 'a':
break;
case 'e':
goto exit;
case 'x':
export = 1;
break;
case 'P':
break;
case 1:
goto exit;
case 'V':
goto exit;
case 'h':
printf("Usage: udevadm info OPTIONS\n"
" --query=<type> query database for the specified value:\n"
" name name of device node\n"
" symlink pointing to node\n"
" path sysfs device path\n"
" env the device related imported environment\n"
" all all values\n"
" --path=<devpath> sysfs device path used for query or chain\n"
" --name=<name> node or symlink name used for query\n"
" --root prepend to query result or print udev_root\n"
" --attribute-walk print all key matches while walking along chain\n"
" of parent devices\n"
" --export-db export the content of the udev database\n"
" --help print this text\n"
"\n");
goto exit;
default:
goto exit;
}
}
switch (action) {
case ACTION_QUERY:
rc = 4;
goto exit;
}
switch(query) {
case QUERY_NAME:
if (root) {
} else {
}
break;
case QUERY_SYMLINK:
if (root)
else
break;
case QUERY_PATH:
goto exit;
case QUERY_ENV:
break;
case QUERY_ALL:
break;
default:
break;
}
break;
case ACTION_ATTRIBUTE_WALK:
rc = 5;
goto exit;
}
break;
case ACTION_DEVICE_ID_FILE:
rc = 6;
break;
case ACTION_ROOT:
break;
default:
rc = 1;
break;
}
exit:
return rc;
}