199767f8919635c4928607450d9e0abb932109ceToomas Soome/***************************************************************************
199767f8919635c4928607450d9e0abb932109ceToomas Soome * CVSID: $Id$
199767f8919635c4928607450d9e0abb932109ceToomas Soome * hal_get_property.c : Get property for a device
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Copyright (C) 2003 David Zeuthen, <david@fubar.dk>
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Licensed under the Academic Free License version 2.1
199767f8919635c4928607450d9e0abb932109ceToomas Soome * This program is free software; you can redistribute it and/or modify
199767f8919635c4928607450d9e0abb932109ceToomas Soome * it under the terms of the GNU General Public License as published by
199767f8919635c4928607450d9e0abb932109ceToomas Soome * the Free Software Foundation; either version 2 of the License, or
199767f8919635c4928607450d9e0abb932109ceToomas Soome * (at your option) any later version.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * This program is distributed in the hope that it will be useful,
199767f8919635c4928607450d9e0abb932109ceToomas Soome * but WITHOUT ANY WARRANTY; without even the implied warranty of
199767f8919635c4928607450d9e0abb932109ceToomas Soome * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
199767f8919635c4928607450d9e0abb932109ceToomas Soome * GNU General Public License for more details.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * You should have received a copy of the GNU General Public License
199767f8919635c4928607450d9e0abb932109ceToomas Soome * along with this program; if not, write to the Free Software
199767f8919635c4928607450d9e0abb932109ceToomas Soome * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
199767f8919635c4928607450d9e0abb932109ceToomas Soome **************************************************************************/
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @defgroup HalGetProperty Get HAL device property
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @ingroup HalMisc
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @brief A commandline tool getting a property of a device. Uses libhal
199767f8919635c4928607450d9e0abb932109ceToomas Soome/** Print out program usage.
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @param argc Number of arguments given to program
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @param argv Arguments given to program
199767f8919635c4928607450d9e0abb932109ceToomas Soome "usage : hal-get-property --udi <udi> --key <key> \n"
199767f8919635c4928607450d9e0abb932109ceToomas Soome " [--hex] [--help] [--verbose] [--version]\n");
199767f8919635c4928607450d9e0abb932109ceToomas Soome " --udi Unique Device Id\n"
199767f8919635c4928607450d9e0abb932109ceToomas Soome " --key Key of the property to get\n"
199767f8919635c4928607450d9e0abb932109ceToomas Soome " --hex Show integer values in hex (without leading 0x)\n"
199767f8919635c4928607450d9e0abb932109ceToomas Soome " --verbose Be verbose\n"
199767f8919635c4928607450d9e0abb932109ceToomas Soome " --version Show version and exit\n"
199767f8919635c4928607450d9e0abb932109ceToomas Soome " --help Show this information and exit\n"
199767f8919635c4928607450d9e0abb932109ceToomas Soome "This program retrieves a property from a device. If the property exist\n"
199767f8919635c4928607450d9e0abb932109ceToomas Soome "then it is printed on stdout and this program exits with exit code 0.\n"
199767f8919635c4928607450d9e0abb932109ceToomas Soome "On error, the program exits with an exit code different from 0\n"
199767f8919635c4928607450d9e0abb932109ceToomas Soome/** Entry point
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @param argc Number of arguments given to program
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @param argv Arguments given to program
199767f8919635c4928607450d9e0abb932109ceToomas Soome * @return Return code
if (is_version) {
if (!udi_exists) {
switch (type) {
if (is_verbose)
if (is_verbose)
if (is_verbose)
if (is_verbose)
if (is_verbose)
for (i = 0; strlist[i] != 0; i++) {