]>
Commit | Line | Data |
---|---|---|
06255d6f DH |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ | |
4 | <!ENTITY % entities SYSTEM "custom-entities.ent" > | |
5 | %entities; | |
6 | ]> | |
7 | ||
8 | <!-- | |
572eb058 | 9 | SPDX-License-Identifier: LGPL-2.1+ |
06255d6f DH |
10 | --> |
11 | ||
12 | <refentry id="libudev" | |
13 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
14 | ||
15 | <refentryinfo> | |
16 | <title>libudev</title> | |
17 | <productname>systemd</productname> | |
06255d6f DH |
18 | </refentryinfo> |
19 | ||
20 | <refmeta> | |
21 | <refentrytitle>libudev</refentrytitle> | |
22 | <manvolnum>3</manvolnum> | |
23 | </refmeta> | |
24 | ||
25 | <refnamediv> | |
26 | <refname>libudev</refname> | |
27 | <refpurpose>API for enumerating and introspecting local devices</refpurpose> | |
28 | </refnamediv> | |
29 | ||
30 | <refsynopsisdiv> | |
31 | <funcsynopsis> | |
32 | <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> | |
33 | </funcsynopsis> | |
34 | ||
35 | <cmdsynopsis> | |
36 | <command>pkg-config --cflags --libs libudev</command> | |
37 | </cmdsynopsis> | |
38 | </refsynopsisdiv> | |
39 | ||
40 | <refsect1> | |
41 | <title>Description</title> | |
42 | ||
43 | <para><filename>libudev.h</filename> provides APIs to introspect | |
44 | and enumerate devices on the local system.</para> | |
45 | ||
46 | <para>All functions require a libudev context to operate. This | |
47 | context can be create via | |
48 | <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>. | |
49 | It is used to track library state and link objects together. No | |
50 | global state is used by libudev, everything is always linked to | |
64a7ef8b LP |
51 | a udev context.</para> |
52 | ||
53 | <xi:include href="threads-aware.xml" xpointer="strict"/> | |
06255d6f DH |
54 | |
55 | <para>To introspect a local device on a system, a udev device | |
56 | object can be created via | |
57 | <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
595bfe7d | 58 | and friends. The device object allows one to query current state, |
06255d6f DH |
59 | read and write attributes and lookup properties of the device in |
60 | question.</para> | |
61 | ||
62 | <para>To enumerate local devices on the system, an enumeration | |
63 | object can be created via | |
64 | <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para> | |
65 | ||
66 | <para>To monitor the local system for hotplugged or unplugged | |
67 | devices, a monitor can be created via | |
68 | <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para> | |
69 | ||
70 | <para>Whenever libudev returns a list of objects, the | |
71 | <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
72 | API should be used to iterate, access and modify those lists.</para> | |
73 | ||
74 | <para>Furthermore, libudev also exports legacy APIs that should | |
75 | not be used by new software (and as such are not documented as | |
b938cb90 | 76 | part of this manual). This includes the hardware database known |
06255d6f DH |
77 | as <constant>udev_hwdb</constant> (please use the new |
78 | <citerefentry><refentrytitle>sd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
79 | API instead) and the <constant>udev_queue</constant> object to | |
b938cb90 | 80 | query the udev daemon (which should not be used by new software |
06255d6f DH |
81 | at all).</para> |
82 | </refsect1> | |
83 | ||
84 | <refsect1> | |
85 | <title>See Also</title> | |
86 | <para> | |
87 | <citerefentry><refentrytitle>udev_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
88 | <citerefentry><refentrytitle>udev_device_new_from_syspath</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
89 | <citerefentry><refentrytitle>udev_enumerate_new</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
90 | <citerefentry><refentrytitle>udev_monitor_new_from_netlink</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
91 | <citerefentry><refentrytitle>udev_list_entry</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
92 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
93 | <citerefentry><refentrytitle>sd-device</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
94 | <citerefentry><refentrytitle>sd-hwdb</refentrytitle><manvolnum>3</manvolnum></citerefentry>, | |
95 | <citerefentry project='die-net'><refentrytitle>pkg-config</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
96 | </para> | |
97 | </refsect1> | |
98 | ||
99 | </refentry> |