\section{Devices}
\label{group__device}\index{Devices@{Devices}}
\subsection*{Functions}
\begin{CompactItemize}
\item 
{\bf discover\_\-device\_\-t} $\ast$ {\bf discover\_\-device\_\-find} (char $\ast$discover\_\-class, {\bf discover\_\-error\_\-t} $\ast$status)
\item 
char $\ast$ {\bf discover\_\-device\_\-get\_\-data} ({\bf discover\_\-device\_\-t} $\ast$device, char $\ast$discover\_\-class, char $\ast$version, {\bf discover\_\-error\_\-t} $\ast$status)
\item 
void {\bf discover\_\-device\_\-copy} ({\bf discover\_\-device\_\-t} $\ast$src, {\bf discover\_\-device\_\-t} $\ast$dst)
\item 
char $\ast$ {\bf discover\_\-data\_\-get\_\-class} ({\bf discover\_\-data\_\-t} $\ast$data)
\item 
char $\ast$ {\bf discover\_\-data\_\-get\_\-text} ({\bf discover\_\-data\_\-t} $\ast$data)
\item 
{\bf discover\_\-data\_\-t} $\ast$ {\bf discover\_\-data\_\-get\_\-parent} ({\bf discover\_\-data\_\-t} $\ast$data)
\item 
{\bf discover\_\-data\_\-t} $\ast$ {\bf discover\_\-data\_\-get\_\-child} ({\bf discover\_\-data\_\-t} $\ast$data)
\item 
{\bf discover\_\-data\_\-t} $\ast$ {\bf discover\_\-data\_\-get\_\-next} ({\bf discover\_\-data\_\-t} $\ast$data)
\item 
{\bf discover\_\-data\_\-t} $\ast$ {\bf discover\_\-data\_\-get\_\-prev} ({\bf discover\_\-data\_\-t} $\ast$data)
\item 
{\bf discover\_\-data\_\-t} $\ast$ {\bf discover\_\-data\_\-get\_\-first} ({\bf discover\_\-data\_\-t} $\ast$data)
\item 
{\bf discover\_\-data\_\-t} $\ast$ {\bf discover\_\-data\_\-new} (void)
\item 
void {\bf discover\_\-data\_\-free} ({\bf discover\_\-data\_\-t} $\ast$data\_\-tree)
\item 
char $\ast$ {\bf discover\_\-device\_\-get\_\-busclass} ({\bf discover\_\-device\_\-t} $\ast$device)
\item 
char $\ast$ {\bf discover\_\-device\_\-get\_\-model\_\-id} ({\bf discover\_\-device\_\-t} $\ast$device)
\item 
char $\ast$ {\bf discover\_\-device\_\-get\_\-model\_\-name} ({\bf discover\_\-device\_\-t} $\ast$device)
\item 
char $\ast$ {\bf discover\_\-device\_\-get\_\-vendor\_\-id} ({\bf discover\_\-device\_\-t} $\ast$device)
\item 
char $\ast$ {\bf discover\_\-device\_\-get\_\-vendor\_\-name} ({\bf discover\_\-device\_\-t} $\ast$device)
\item 
{\bf discover\_\-data\_\-t} $\ast$ {\bf discover\_\-device\_\-get\_\-data\_\-struct} ({\bf discover\_\-device\_\-t} $\ast$device)
\item 
{\bf discover\_\-device\_\-t} $\ast$ {\bf discover\_\-device\_\-get\_\-next} ({\bf discover\_\-device\_\-t} $\ast$device)
\item 
{\bf discover\_\-device\_\-t} $\ast$ {\bf discover\_\-device\_\-new} (void)
\item 
void {\bf discover\_\-device\_\-free} ({\bf discover\_\-device\_\-t} $\ast$devices, int free\_\-data)
\end{CompactItemize}


\subsection{Function Documentation}
\index{device@{device}!discover_data_free@{discover\_\-data\_\-free}}
\index{discover_data_free@{discover\_\-data\_\-free}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void discover\_\-data\_\-free ({\bf discover\_\-data\_\-t} $\ast$ {\em data\_\-tree})}\label{group__device_ga14}


Free the data tree. Note that unlike the other free functions in Discover, this one does not free data\_\-tree itself. This is a side-effect of how it is implemented. It frees all children and siblings of data\_\-tree as well as the data. After calling discover\_\-data\_\-free, you have to call free(3) on data\_\-tree itself.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em data\_\-tree}]Data tree to free \end{description}
\end{Desc}


Definition at line 436 of file device.c.

References discover\_\-data\_\-free().

Referenced by discover\_\-data\_\-free(), and discover\_\-device\_\-free().\index{device@{device}!discover_data_get_child@{discover\_\-data\_\-get\_\-child}}
\index{discover_data_get_child@{discover\_\-data\_\-get\_\-child}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf discover\_\-data\_\-t}$\ast$ discover\_\-data\_\-get\_\-child ({\bf discover\_\-data\_\-t} $\ast$ {\em data})}\label{group__device_ga9}


Get the child member of data. 

Definition at line 341 of file device.c.\index{device@{device}!discover_data_get_class@{discover\_\-data\_\-get\_\-class}}
\index{discover_data_get_class@{discover\_\-data\_\-get\_\-class}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ discover\_\-data\_\-get\_\-class ({\bf discover\_\-data\_\-t} $\ast$ {\em data})}\label{group__device_ga6}


Get the class member of data. 

Definition at line 308 of file device.c.\index{device@{device}!discover_data_get_first@{discover\_\-data\_\-get\_\-first}}
\index{discover_data_get_first@{discover\_\-data\_\-get\_\-first}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf discover\_\-data\_\-t}$\ast$ discover\_\-data\_\-get\_\-first ({\bf discover\_\-data\_\-t} $\ast$ {\em data})}\label{group__device_ga12}


Get the first member of data. 

Definition at line 374 of file device.c.\index{device@{device}!discover_data_get_next@{discover\_\-data\_\-get\_\-next}}
\index{discover_data_get_next@{discover\_\-data\_\-get\_\-next}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf discover\_\-data\_\-t}$\ast$ discover\_\-data\_\-get\_\-next ({\bf discover\_\-data\_\-t} $\ast$ {\em data})}\label{group__device_ga10}


Get the next member of data. 

Definition at line 352 of file device.c.\index{device@{device}!discover_data_get_parent@{discover\_\-data\_\-get\_\-parent}}
\index{discover_data_get_parent@{discover\_\-data\_\-get\_\-parent}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf discover\_\-data\_\-t}$\ast$ discover\_\-data\_\-get\_\-parent ({\bf discover\_\-data\_\-t} $\ast$ {\em data})}\label{group__device_ga8}


Get the parent member of data. 

Definition at line 330 of file device.c.\index{device@{device}!discover_data_get_prev@{discover\_\-data\_\-get\_\-prev}}
\index{discover_data_get_prev@{discover\_\-data\_\-get\_\-prev}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf discover\_\-data\_\-t}$\ast$ discover\_\-data\_\-get\_\-prev ({\bf discover\_\-data\_\-t} $\ast$ {\em data})}\label{group__device_ga11}


Get the prev member of data. 

Definition at line 363 of file device.c.\index{device@{device}!discover_data_get_text@{discover\_\-data\_\-get\_\-text}}
\index{discover_data_get_text@{discover\_\-data\_\-get\_\-text}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ discover\_\-data\_\-get\_\-text ({\bf discover\_\-data\_\-t} $\ast$ {\em data})}\label{group__device_ga7}


Get the text member of data. 

Definition at line 319 of file device.c.\index{device@{device}!discover_data_new@{discover\_\-data\_\-new}}
\index{discover_data_new@{discover\_\-data\_\-new}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf discover\_\-data\_\-t}$\ast$ discover\_\-data\_\-new (void)}\label{group__device_ga13}


Create and initialize a new discover\_\-data\_\-t structure. 

Definition at line 409 of file device.c.

Referenced by \_\-discover\_\-convert\_\-device\_\-data().\index{device@{device}!discover_device_copy@{discover\_\-device\_\-copy}}
\index{discover_device_copy@{discover\_\-device\_\-copy}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void discover\_\-device\_\-copy ({\bf discover\_\-device\_\-t} $\ast$ {\em src}, {\bf discover\_\-device\_\-t} $\ast$ {\em dst})}\label{group__device_ga5}


Copy a device structure.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em src}]Copy from (source) \item[{\em dst}]Copy to (destination) \end{description}
\end{Desc}


Definition at line 268 of file device.c.

Referenced by discover\_\-device\_\-find(), and discover\_\-xml\_\-get\_\-matching\_\-devices().\index{device@{device}!discover_device_find@{discover\_\-device\_\-find}}
\index{discover_device_find@{discover\_\-device\_\-find}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf discover\_\-device\_\-t}$\ast$ discover\_\-device\_\-find (char $\ast$ {\em discover\_\-class}, {\bf discover\_\-error\_\-t} $\ast$ {\em status})}\label{group__device_ga0}


Get a list of devices of a specified class on all buses scanned by default.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em discover\_\-class}]Class of devices to find \item[{\em status}]Address in which to place status report \end{description}
\end{Desc}


Definition at line 63 of file device.c.

References discover\_\-error::code, discover\_\-error::create\_\-message, discover\_\-conf\_\-get\_\-full\_\-bus\_\-map(), discover\_\-device\_\-copy(), discover\_\-device\_\-get\_\-next(), discover\_\-device\_\-new(), DISCOVER\_\-EDEVICENOTFOUND, discover\_\-get\_\-devices(), DISCOVER\_\-SUCCESS, discover\_\-xml\_\-busclass\_\-cmp(), and discover\_\-xml\_\-get\_\-busclasses().\index{device@{device}!discover_device_free@{discover\_\-device\_\-free}}
\index{discover_device_free@{discover\_\-device\_\-free}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void discover\_\-device\_\-free ({\bf discover\_\-device\_\-t} $\ast$ {\em devices}, int {\em free\_\-data})}\label{group__device_ga23}


Free the device or list of devices. Pass 1 as the second argument to free the data structure for this device, 0 to leave it. It is necessary to specify 0 when one structure was copied from another with discover\_\-device\_\-copy. Otherwise, you must pass 1.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em devices}]Device or list of devices to free \item[{\em free\_\-data}]Whether to free the data structure \end{description}
\end{Desc}


Definition at line 592 of file device.c.

References discover\_\-data\_\-free().

Referenced by discover\_\-free\_\-devices(), and discover\_\-xml\_\-free\_\-devices().\index{device@{device}!discover_device_get_busclass@{discover\_\-device\_\-get\_\-busclass}}
\index{discover_device_get_busclass@{discover\_\-device\_\-get\_\-busclass}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ discover\_\-device\_\-get\_\-busclass ({\bf discover\_\-device\_\-t} $\ast$ {\em device})}\label{group__device_ga15}


Get the busclass member of device. 

Definition at line 485 of file device.c.\index{device@{device}!discover_device_get_data@{discover\_\-device\_\-get\_\-data}}
\index{discover_device_get_data@{discover\_\-device\_\-get\_\-data}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ discover\_\-device\_\-get\_\-data ({\bf discover\_\-device\_\-t} $\ast$ {\em device}, char $\ast$ {\em discover\_\-class}, char $\ast$ {\em version}, {\bf discover\_\-error\_\-t} $\ast$ {\em status})}\label{group__device_ga4}


Get the data matching the class path and version number (optional) from the device structure.

The class parameter requires further explanation. The XML data sources have hierarchical data elements for each device. You access the data in an element by specifying the path along the data elements to it.

For example, device elements for video cards usually have a data element of class \char`\"{}xfree86\char`\"{} containing data related to the XFree86 package; that element itself usually contains a data element of class \char`\"{}server\char`\"{} that specifies which server to use for this video card. You access this data by passing the string \char`\"{}xfree86/server\char`\"{} to this function.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em device}]Device from which to get the data \item[{\em discover\_\-class}]Class to search for \item[{\em version}]Version number to require (NULL for unversioned search) \item[{\em status}]Address in which to place status report \end{description}
\end{Desc}


Definition at line 204 of file device.c.

References discover\_\-error::code.\index{device@{device}!discover_device_get_data_struct@{discover\_\-device\_\-get\_\-data\_\-struct}}
\index{discover_device_get_data_struct@{discover\_\-device\_\-get\_\-data\_\-struct}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf discover\_\-data\_\-t}$\ast$ discover\_\-device\_\-get\_\-data\_\-struct ({\bf discover\_\-device\_\-t} $\ast$ {\em device})}\label{group__device_ga20}


Get the data member of device. 

Definition at line 540 of file device.c.\index{device@{device}!discover_device_get_model_id@{discover\_\-device\_\-get\_\-model\_\-id}}
\index{discover_device_get_model_id@{discover\_\-device\_\-get\_\-model\_\-id}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ discover\_\-device\_\-get\_\-model\_\-id ({\bf discover\_\-device\_\-t} $\ast$ {\em device})}\label{group__device_ga16}


Get the model\_\-id member of device. 

Definition at line 496 of file device.c.\index{device@{device}!discover_device_get_model_name@{discover\_\-device\_\-get\_\-model\_\-name}}
\index{discover_device_get_model_name@{discover\_\-device\_\-get\_\-model\_\-name}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ discover\_\-device\_\-get\_\-model\_\-name ({\bf discover\_\-device\_\-t} $\ast$ {\em device})}\label{group__device_ga17}


Get the model\_\-name member of device. 

Definition at line 507 of file device.c.\index{device@{device}!discover_device_get_next@{discover\_\-device\_\-get\_\-next}}
\index{discover_device_get_next@{discover\_\-device\_\-get\_\-next}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf discover\_\-device\_\-t}$\ast$ discover\_\-device\_\-get\_\-next ({\bf discover\_\-device\_\-t} $\ast$ {\em device})}\label{group__device_ga21}


Get the next member of device. 

Definition at line 551 of file device.c.

Referenced by discover\_\-device\_\-find().\index{device@{device}!discover_device_get_vendor_id@{discover\_\-device\_\-get\_\-vendor\_\-id}}
\index{discover_device_get_vendor_id@{discover\_\-device\_\-get\_\-vendor\_\-id}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ discover\_\-device\_\-get\_\-vendor\_\-id ({\bf discover\_\-device\_\-t} $\ast$ {\em device})}\label{group__device_ga18}


Get the vendor\_\-id member of device. 

Definition at line 518 of file device.c.\index{device@{device}!discover_device_get_vendor_name@{discover\_\-device\_\-get\_\-vendor\_\-name}}
\index{discover_device_get_vendor_name@{discover\_\-device\_\-get\_\-vendor\_\-name}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ discover\_\-device\_\-get\_\-vendor\_\-name ({\bf discover\_\-device\_\-t} $\ast$ {\em device})}\label{group__device_ga19}


Get the vendor\_\-name member of device. 

Definition at line 529 of file device.c.\index{device@{device}!discover_device_new@{discover\_\-device\_\-new}}
\index{discover_device_new@{discover\_\-device\_\-new}!device@{device}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf discover\_\-device\_\-t}$\ast$ discover\_\-device\_\-new (void)}\label{group__device_ga22}


Create and initialize a new discover\_\-device\_\-t structure. 

Definition at line 562 of file device.c.

Referenced by discover\_\-device\_\-find(), discover\_\-get\_\-devices(), and discover\_\-xml\_\-get\_\-matching\_\-devices().