Debian Codegraph @

data/org.freedesktop.portal.Usb.xml

raw
1 <?xml version="1.0"?>
2 <!--
3 Copyright (C) 2020 Endless OS Foundation LLC
4 2023-2024 GNOME Foundation Inc.
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library. If not, see <http://www.gnu.org/licenses/>.
18
19 Author: Georges Basile Stavracas Neto <[email protected]>
20 Ryan Gonzalez <[email protected]>
21 -->
22
23 <node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
24 <!--
25 org.freedesktop.portal.Usb:
26 @short_description: Portal for USB device access
27
28 This interface lets sandboxed applications monitor and request
29 access to connected USB devices.
30
31 Applications should prefer specialized portals for specific
32 device types, such as the Camera portal for cameras.
33
34 This documentation describes version 1 of this interface.
35 -->
36 <interface name="org.freedesktop.portal.Usb">
37
38 <!--
39 CreateSession:
40 @options: Vardict with optional further information
41 @session_handle: Object path for the session.
42
43 Creates an USB monitoring session. This is only necessary to
44 receive device events, like device being plugged or unplugged.
45
46 Supported keys in the @options vardict include:
47
48 * ``session_handle_token`` (``s``)
49
50 A string that will be used as the last element of the session handle. Must be a valid
51 object path element. See the :ref:`org.freedesktop.portal.Session` documentation for
52 more information about the session handle.
53 -->
54 <method name="CreateSession">
55 <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
56 <arg type="a{sv}" name="options" direction="in"/>
57 <arg type="o" name="session_handle" direction="out"/>
58 </method>
59
60 <!--
61 EnumerateDevices:
62 @options: Vardict with optional further information. There is currently
63 no option supported.
64
65 Enumerates all connected USB devices that this application has permission
66 to see.
67
68 The following results are returned in the @device vardict:
69
70 * ``id`` (``s``)
71
72 Each element of the @devices array contains the device ID, and a
73 device information vardict with the following keys:
74
75 * ``parent`` (``s``)
76
77 Device ID of the parent device.
78
79 * ``readable`` (``b``)
80
81 Whether the device can be opened for reading with
82 org.freedesktop.portal.Usb.AcquireDevices(). If not present, then
83 it should be assumed to be false.
84
85 * ``writable`` (``b``)
86
87 Whether the device can be opened for writing with
88 org.freedesktop.portal.Usb.AcquireDevices(). If not present, then
89 it should be assumed to be false.
90
91 * ``device-file`` (``s``)
92
93 A string path to the device node inside the /dev filesystem.
94
95 * ``properties`` (``a{sv}``)
96
97 A list of udev properties that this device has. These properties
98 are not parsed in any way by the portal, it is up to apps to parse
99 them.
100 -->
101 <method name="EnumerateDevices">
102 <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
103 <arg type="a{sv}" name="options" direction="in"/>
104 <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;QPair&lt;QString,QVariantMap&gt;&gt;"/>
105 <arg type="a(sa{sv})" name="devices" direction="out"/>
106 </method>
107
108 <!--
109 AcquireDevices:
110 @parent_window: Identifier for the application window, see :doc:`window-identifiers`
111 @devices: Array of device identifiers and access options
112 @options: Vardict with optional further information
113 @handle: Object path for the :ref:`org.freedesktop.portal.Request` object representing this call
114
115 Request to acquires (i.e. open) the given device nodes. The
116 process of acquiring is finished by calling
117 `FinishAcquireDevices` after the request emitted a `Success`
118 response.
119
120 Each element of the @devices array contains the device ID, and an
121 access option vardict with the following keys:
122
123 * ``writable`` (``b``)
124
125 Whether the device will be opened in read-write or read-only mode.
126 Default: False
127
128 Supported keys in the @options vardict include:
129
130 * ``handle_token`` (``s``)
131
132 A string that will be used as the last element of the @handle. Must be a valid
133 object path element. See the :ref:`org.freedesktop.portal.Request` documentation
134 for more information about the @handle.
135
136 The :ref:`org.freedesktop.portal.Request::Response` signal is emitted
137 without any extra information.
138 -->
139 <method name="AcquireDevices">
140 <arg type="s" name="parent_window" direction="in"/>
141 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QList&lt;QPair&lt;QString,QVariantMap&gt;&gt;"/>
142 <arg type="a(sa{sv})" name="devices" direction="in"/>
143 <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/>
144 <arg type="a{sv}" name="options" direction="in"/>
145 <arg type="o" name="handle" direction="out"/>
146 </method>
147
148 <!--
149 FinishAcquireDevices:
150 @handle: The request object path for the acquisition to finish
151 @options: Vardict with optional further information
152 @results: Array of device ids, and the result of the access
153 @finished: Whether all device results were reported
154
155 Retrieves the file descriptors of the devices requested during
156 org.freedesktop.portal.Usb.AcquireDevices(). The file
157 descriptors remain usable until the underlying device is
158 removed, they are released with `ReleaseDevices`, the D-Bus
159 connections is closed, or the portal revokes the file
160 descriptor which can happen at any point. Devices which are
161 not needed anymore should be passed to `ReleaseDevices`.
162
163 If not all devices could be send, @finished will be false and
164 org.freedesktop.portal.Usb.FinishAcquireDevices must be called again
165 until @finished is true, before calling
166 org.freedesktop.portal.Usb.AcquireDevices again.
167
168 This method can only be called once for a given token, and only
169 after calling org.freedesktop.portal.Usb.AcquireDevices().
170
171 Each element of the @results array contains the device ID, and
172 a vardict with the following keys:
173
174 * ``success`` (``b``)
175
176 Whether the device access was successful or not.
177
178 * ``fd`` (``h``)
179
180 The file descriptor representing the device. The file
181 descriptor is meant to be passed on to the USB library.
182
183 Only present if this was a successful device access.
184
185 * ``error`` (``s``)
186
187 Error message describing why accessing the device was not
188 successful. Only present if this was an failed device access.
189
190 There are no supported keys in the @options vardict.
191 -->
192 <method name="FinishAcquireDevices">
193 <arg type="o" name="handle" direction="in"/>
194 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
195 <arg type="a{sv}" name="options" direction="in"/>
196 <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;QPair&lt;QString,QVariantMap&gt;&gt;"/>
197 <arg type="a(sa{sv})" name="results" direction="out"/>
198 <arg type="b" name="finished" direction="out"/>
199 </method>
200
201 <!--
202 ReleaseDevices:
203 @devices: Array of device identifiers
204 @options: Vardict with optional further information
205
206 Releases previously acquired devices. The file descriptors of
207 those devices might become unusable as a result of this.
208
209 Each element of the @devices array contains the device ID of the device.
210
211 There are no supported keys in the @options vardict.
212 -->
213 <method name="ReleaseDevices">
214 <arg type="as" name="devices" direction="in"/>
215 <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
216 <arg type="a{sv}" name="options" direction="in"/>
217 </method>
218
219 <!--
220 DeviceEvents:
221 @session_handle: Object path for the :ref:`org.freedesktop.portal.Session` object
222 @events: A list of events which occurred.
223
224 The DeviceEvents signal is emitted when one or more USB devices have
225 been added, changed, or removed. This signal is only emitted for active
226 sessions created with org.freedesktop.portal.Usb.CreateSession().
227
228 Each element of the @events array is composed of the following fields:
229
230 * ``action`` (``s``)
231
232 Type of event that occurred. One of "add", "change", or "remove".
233
234 * ``id`` (``s``)
235
236 Device ID that the event occurred on.
237
238 * ``device`` (``a{sv}``)
239
240 Device properties attached to the ID. See
241 org.freedesktop.portal.Usb.EnumerateDevices() for a list of all
242 the properties that may be present in the vardict.
243 -->
244 <signal name="DeviceEvents">
245 <arg type="o" name="session_handle" direction="out"/>
246 <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QList&lt;std::tuple&lt;QString,QString,QVariantMap&gt;&gt;"/>
247 <arg type="a(ssa{sv})" name="events" direction="out"/>
248 </signal>
249
250 <property name="version" type="u" access="read"/>
251 </interface>
252 </node>