207 lines
6.2 KiB
HTML
207 lines
6.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of UDEV_DEVICE_NEW_FROM_SYSPATH</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>UDEV_DEVICE_NEW_FROM_SYSPATH</H1>
|
|
Section: udev_device_new_from_syspath (3)<BR>Updated: <BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
udev_device_new_from_syspath, udev_device_new_from_devnum, udev_device_new_from_subsystem_sysname, udev_device_new_from_device_id, udev_device_new_from_environment, udev_device_ref, udev_device_unref - Create, acquire and release a udev device object
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
<B>
|
|
</B><PRE>
|
|
#include <<A HREF="file:///usr/include/libudev.h">libudev.h</A>>
|
|
</PRE>
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="1">
|
|
<B>struct udev_device *udev_device_new_from_syspath(struct udev *</B><I>udev</I><B>, const char *</B><I>syspath</I><B>);</B>
|
|
|
|
<DT id="2">
|
|
<B>struct udev_device *udev_device_new_from_devnum(struct udev *</B><I>udev</I><B>, char </B><I>type</I><B>, dev_t </B><I>devnum</I><B>);</B>
|
|
|
|
<DT id="3">
|
|
<B>struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *</B><I>udev</I><B>, const char *</B><I>subsystem</I><B>, const char *</B><I>sysname</I><B>);</B>
|
|
|
|
<DT id="4">
|
|
<B>struct udev_device *udev_device_new_from_device_id(struct udev *</B><I>udev</I><B>, const char *</B><I>id</I><B>);</B>
|
|
|
|
<DT id="5">
|
|
<B>struct udev_device *udev_device_new_from_environment(struct udev *</B><I>udev</I><B>);</B>
|
|
|
|
<DT id="6">
|
|
<B>struct udev_device *udev_device_ref(struct udev_device *</B><I>udev_device</I><B>);</B>
|
|
|
|
<DT id="7">
|
|
<B>struct udev_device *udev_device_unref(struct udev_device *</B><I>udev_device</I><B>);</B>
|
|
|
|
</DL>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
|
|
<B>udev_device_new_from_syspath</B>,
|
|
<B>udev_device_new_from_devnum</B>,
|
|
<B>udev_device_new_from_subsystem_sysname</B>,
|
|
<B>udev_device_new_from_device_id</B>, and
|
|
<B>udev_device_new_from_environment</B>
|
|
<DD>allocate a new udev device object and returns a pointer to it. This object is opaque and must not be accessed by the caller via different means than functions provided by libudev. Initially, the reference count of the device is 1. You can acquire further references, and drop gained references via
|
|
<B>udev_device_ref()</B>
|
|
and
|
|
<B>udev_device_unref()</B>. Once the reference count hits 0, the device object is destroyed and freed.
|
|
<P>
|
|
|
|
<B>udev_device_new_from_syspath</B>,
|
|
<B>udev_device_new_from_devnum</B>,
|
|
<B>udev_device_new_from_subsystem_sysname</B>, and
|
|
<B>udev_device_new_from_device_id</B>
|
|
create the device object based on information found in
|
|
/sys, annotated with properties from the udev-internal device database. A syspath is any subdirectory of
|
|
/sys, with the restriction that a subdirectory of
|
|
/sys/devices
|
|
(or a symlink to one) represents a real device and as such must contain a
|
|
uevent
|
|
file.
|
|
<B>udev_device_new_from_devnum</B>
|
|
takes a device type, which can be
|
|
<B>b</B>
|
|
for block devices or
|
|
<B>c</B>
|
|
for character devices, as well as a devnum (see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+makedev">makedev</A></B>(3)).
|
|
<B>udev_device_new_from_subsystem_sysname</B>
|
|
looks up devices based on the provided subsystem and sysname (see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+udev_device_get_subsystem">udev_device_get_subsystem</A></B>(3)
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?3+udev_device_get_sysname">udev_device_get_sysname</A></B>(3)) and
|
|
<B>udev_device_new_from_device_id</B>
|
|
looks up devices based on the provided device ID, which is a special string in one of the following four forms:
|
|
<P>
|
|
|
|
|
|
|
|
<BR>
|
|
|
|
<B>Table 1. Device ID strings</B>
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>
|
|
Example
|
|
</B></TD><TD><B>
|
|
Explanation
|
|
</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<I>b8:2</I>
|
|
</TD><TD>
|
|
block device major:minor
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<I>c128:1</I>
|
|
</TD><TD>
|
|
char device major:minor
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<I>n3</I>
|
|
</TD><TD>
|
|
network device ifindex
|
|
<BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<I>+sound:card29</I>
|
|
</TD><TD>
|
|
kernel driver core subsystem:device name
|
|
<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
<P>
|
|
|
|
<B>udev_device_new_from_environment</B>
|
|
creates a device from the current environment (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+environ">environ</A></B>(7)). Each key-value pair is interpreted in the same way as if it was received in an uevent (see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+udev_monitor_receive_device">udev_monitor_receive_device</A></B>(3)). The keys
|
|
<B>DEVPATH</B>,
|
|
<B>SUBSYSTEM</B>,
|
|
<B>ACTION</B>, and
|
|
<B>SEQNUM</B>
|
|
are mandatory.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
<P>
|
|
|
|
On success,
|
|
<B>udev_device_new_from_syspath()</B>,
|
|
<B>udev_device_new_from_devnum()</B>,
|
|
<B>udev_device_new_from_subsystem_sysname()</B>,
|
|
<B>udev_device_new_from_device_id()</B>
|
|
and
|
|
<B>udev_device_new_from_environment()</B>
|
|
return a pointer to the allocated udev device. On failure,
|
|
<B>NULL</B>
|
|
is returned, and
|
|
<I>errno</I>
|
|
is set appropriately.
|
|
<B>udev_device_ref()</B>
|
|
returns the argument that it was passed, unmodified.
|
|
<B>udev_device_unref()</B>
|
|
always returns
|
|
<B>NULL</B>.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<P>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+udev_new">udev_new</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+udev_device_get_syspath">udev_device_get_syspath</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+udev_device_has_tag">udev_device_has_tag</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+udev_enumerate_new">udev_enumerate_new</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+udev_monitor_new_from_netlink">udev_monitor_new_from_netlink</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?3+udev_list_entry">udev_list_entry</A></B>(3),
|
|
<B><A HREF="/cgi-bin/man/man2html?1+systemd">systemd</A></B>(1),
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="8"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="9"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="10"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="11"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="12"><A HREF="#lbAF">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:59 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|