This file is indexed.

/usr/include/gusb-1/gusb/gusb-device.h is in libgusb-dev 0.2.11-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 *
 * Copyright (C) 2010-2015 Richard Hughes <richard@hughsie.com>
 * Copyright (C) 2011 Hans de Goede <hdegoede@redhat.com>
 *
 * Licensed under the GNU Lesser General Public License Version 2.1
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __GUSB_DEVICE_H__
#define __GUSB_DEVICE_H__

#include <glib-object.h>
#include <gio/gio.h>

#include <gusb/gusb-util.h>
#include <gusb/gusb-interface.h>

G_BEGIN_DECLS

#define G_USB_TYPE_DEVICE		(g_usb_device_get_type ())
#define G_USB_DEVICE(o)			(G_TYPE_CHECK_INSTANCE_CAST ((o), G_USB_TYPE_DEVICE, GUsbDevice))
#define G_USB_IS_DEVICE(o)		(G_TYPE_CHECK_INSTANCE_TYPE ((o), G_USB_TYPE_DEVICE))
#define G_USB_DEVICE_ERROR		(g_usb_device_error_quark ())

typedef struct _GUsbDevicePrivate	GUsbDevicePrivate;
typedef struct _GUsbDevice		GUsbDevice;
typedef struct _GUsbDeviceClass		GUsbDeviceClass;

/**
 * GUsbDeviceDirection:
 *
 * The message direction.
 **/
typedef enum {
	G_USB_DEVICE_DIRECTION_DEVICE_TO_HOST, /* IN */
	G_USB_DEVICE_DIRECTION_HOST_TO_DEVICE  /* OUT */
} GUsbDeviceDirection;

/**
 * GUsbDeviceRequestType:
 *
 * The message request type.
 **/
typedef enum {
	G_USB_DEVICE_REQUEST_TYPE_STANDARD,
	G_USB_DEVICE_REQUEST_TYPE_CLASS,
	G_USB_DEVICE_REQUEST_TYPE_VENDOR,
	G_USB_DEVICE_REQUEST_TYPE_RESERVED
} GUsbDeviceRequestType;

/**
 * GUsbDeviceRecipient:
 *
 * The message recipient.
 **/
typedef enum {
	G_USB_DEVICE_RECIPIENT_DEVICE,
	G_USB_DEVICE_RECIPIENT_INTERFACE,
	G_USB_DEVICE_RECIPIENT_ENDPOINT,
	G_USB_DEVICE_RECIPIENT_OTHER
} GUsbDeviceRecipient;

/**
 * GUsbDeviceError:
 *
 * The error code.
 **/
typedef enum {
	G_USB_DEVICE_ERROR_INTERNAL,
	G_USB_DEVICE_ERROR_IO,
	G_USB_DEVICE_ERROR_TIMED_OUT,
	G_USB_DEVICE_ERROR_NOT_SUPPORTED,
	G_USB_DEVICE_ERROR_NO_DEVICE,
	G_USB_DEVICE_ERROR_NOT_OPEN,
	G_USB_DEVICE_ERROR_ALREADY_OPEN,
	G_USB_DEVICE_ERROR_CANCELLED,
	G_USB_DEVICE_ERROR_FAILED,
	G_USB_DEVICE_ERROR_PERMISSION_DENIED,
	G_USB_DEVICE_ERROR_LAST
} GUsbDeviceError;

/**
 * GUsbDeviceClaimInterfaceFlags:
 *
 * Flags for the g_usb_device_claim_interface and
 * g_usb_device_release_interface methods flags parameters.
 **/
typedef enum {
	G_USB_DEVICE_CLAIM_INTERFACE_BIND_KERNEL_DRIVER		= 1 << 0,
} GUsbDeviceClaimInterfaceFlags;

/**
 * GUsbDeviceClassCode:
 *
 * The USB device class.
 **/
typedef enum {
	G_USB_DEVICE_CLASS_INTERFACE_DESC		= 0x00,
	G_USB_DEVICE_CLASS_AUDIO			= 0x01,
	G_USB_DEVICE_CLASS_COMMUNICATIONS		= 0x02,
	G_USB_DEVICE_CLASS_HID				= 0x03,
	G_USB_DEVICE_CLASS_PHYSICAL			= 0x05,
	G_USB_DEVICE_CLASS_IMAGE			= 0x06,
	G_USB_DEVICE_CLASS_PRINTER			= 0x07,
	G_USB_DEVICE_CLASS_MASS_STORAGE			= 0x08,
	G_USB_DEVICE_CLASS_HUB				= 0x09,
	G_USB_DEVICE_CLASS_CDC_DATA			= 0x0a,
	G_USB_DEVICE_CLASS_SMART_CARD			= 0x0b,
	G_USB_DEVICE_CLASS_CONTENT_SECURITY		= 0x0d,
	G_USB_DEVICE_CLASS_VIDEO			= 0x0e,
	G_USB_DEVICE_CLASS_PERSONAL_HEALTHCARE		= 0x0f,
	G_USB_DEVICE_CLASS_AUDIO_VIDEO			= 0x10,
	G_USB_DEVICE_CLASS_BILLBOARD			= 0x11,
	G_USB_DEVICE_CLASS_DIAGNOSTIC			= 0xdc,
	G_USB_DEVICE_CLASS_WIRELESS_CONTROLLER		= 0xe0,
	G_USB_DEVICE_CLASS_MISCELLANEOUS		= 0xef,
	G_USB_DEVICE_CLASS_APPLICATION_SPECIFIC		= 0xfe,
	G_USB_DEVICE_CLASS_VENDOR_SPECIFIC		= 0xff
} GUsbDeviceClassCode;

struct _GUsbDevice
{
	 GObject			 parent;
	 GUsbDevicePrivate		*priv;
};

struct _GUsbDeviceClass
{
	GObjectClass			 parent_class;
	/*< private >*/
	/*
	 * If adding fields to this struct, remove corresponding
	 * amount of padding to avoid changing overall struct size
	 */
	gchar _gusb_reserved[64];
};

GType			 g_usb_device_get_type		(void);
GQuark			 g_usb_device_error_quark	(void);

const gchar		*g_usb_device_get_platform_id	(GUsbDevice	*device);
GUsbDevice		*g_usb_device_get_parent	(GUsbDevice	*device);
GPtrArray		*g_usb_device_get_children	(GUsbDevice	*device);

guint8			 g_usb_device_get_bus		(GUsbDevice	*device);
guint8			 g_usb_device_get_address	(GUsbDevice	*device);
guint8			 g_usb_device_get_port_number	(GUsbDevice	*device);

guint16			 g_usb_device_get_vid		(GUsbDevice	*device);
guint16			 g_usb_device_get_pid		(GUsbDevice	*device);
guint16			 g_usb_device_get_release	(GUsbDevice	*device);
const gchar		*g_usb_device_get_vid_as_str	(GUsbDevice	*device);
const gchar		*g_usb_device_get_pid_as_str	(GUsbDevice	*device);
guint8			 g_usb_device_get_device_class	(GUsbDevice	*device);
guint8			 g_usb_device_get_device_subclass       (GUsbDevice *device);
guint8                   g_usb_device_get_device_protocol       (GUsbDevice *device);

guint8			 g_usb_device_get_manufacturer_index	(GUsbDevice *device);
guint8			 g_usb_device_get_product_index		(GUsbDevice *device);
guint8			 g_usb_device_get_serial_number_index	(GUsbDevice *device);
guint8			 g_usb_device_get_custom_index	(GUsbDevice	*device,
							 guint8		 class_id,
							 guint8		 subclass_id,
							 guint8		 protocol_id,
							 GError		**error);

GUsbInterface		*g_usb_device_get_interface	(GUsbDevice	*device,
							 guint8		 class_id,
							 guint8		 subclass_id,
							 guint8		 protocol_id,
							 GError		**error);
GPtrArray		*g_usb_device_get_interfaces	(GUsbDevice	*device,
							 GError		**error);

gboolean		 g_usb_device_open		(GUsbDevice	*device,
							 GError		**error);
gboolean		 g_usb_device_close		(GUsbDevice	*device,
							 GError		**error);

gboolean		 g_usb_device_reset		(GUsbDevice	*device,
							 GError		**error);

gint			 g_usb_device_get_configuration (GUsbDevice	*device,
							 GError		**error);
gboolean		 g_usb_device_set_configuration (GUsbDevice	*device,
							 gint		 configuration,
							 GError		**error);

gboolean		 g_usb_device_claim_interface	(GUsbDevice	*device,
							 gint		 interface,
							 GUsbDeviceClaimInterfaceFlags flags,
							 GError		**error);
gboolean		 g_usb_device_release_interface	(GUsbDevice	*device,
							 gint		 interface,
							 GUsbDeviceClaimInterfaceFlags flags,
							 GError		**error);
gboolean		 g_usb_device_set_interface_alt	(GUsbDevice	*device,
							 gint		 interface,
							 guint8		 alt,
							 GError		**error);

gchar			*g_usb_device_get_string_descriptor (GUsbDevice *device,
							 guint8		 desc_index,
							 GError		**error);

/* sync -- TODO: use GCancellable and GUsbSource */
gboolean		 g_usb_device_control_transfer	(GUsbDevice	*device,
							 GUsbDeviceDirection direction,
							 GUsbDeviceRequestType request_type,
							 GUsbDeviceRecipient recipient,
							 guint8		 request,
							 guint16	 value,
							 guint16	 idx,
							 guint8		*data,
							 gsize		 length,
							 gsize		*actual_length,
							 guint		 timeout,
							 GCancellable	*cancellable,
							 GError		**error);

gboolean		 g_usb_device_bulk_transfer	(GUsbDevice	*device,
							 guint8		 endpoint,
							 guint8		*data,
							 gsize		 length,
							 gsize		*actual_length,
							 guint		 timeout,
							 GCancellable	*cancellable,
							 GError		**error);

gboolean		 g_usb_device_interrupt_transfer (GUsbDevice	*device,
							 guint8		 endpoint,
							 guint8		*data,
							 gsize		 length,
							 gsize		*actual_length,
							 guint		 timeout,
							 GCancellable	*cancellable,
							 GError		**error);

/* async */

void		 g_usb_device_control_transfer_async	(GUsbDevice	*device,
							 GUsbDeviceDirection direction,
							 GUsbDeviceRequestType request_type,
							 GUsbDeviceRecipient recipient,
							 guint8		 request,
							 guint16	 value,
							 guint16	 idx,
							 guint8		*data,
							 gsize		 length,
							 guint		 timeout,
							 GCancellable	*cancellable,
							 GAsyncReadyCallback callback,
							 gpointer	 user_data);
gssize		 g_usb_device_control_transfer_finish	(GUsbDevice	*device,
							 GAsyncResult	*res,
							 GError		**error);

void		 g_usb_device_bulk_transfer_async	(GUsbDevice	*device,
							 guint8		 endpoint,
							 guint8		*data,
							 gsize		 length,
							 guint		 timeout,
							 GCancellable	*cancellable,
							 GAsyncReadyCallback callback,
							 gpointer	 user_data);
gssize		 g_usb_device_bulk_transfer_finish	(GUsbDevice	*device,
							 GAsyncResult	*res,
							 GError		**error);

void		 g_usb_device_interrupt_transfer_async	(GUsbDevice	*device,
							 guint8		 endpoint,
							 guint8		*data,
							 gsize		 length,
							 guint		 timeout,
							 GCancellable	*cancellable,
							 GAsyncReadyCallback callback,
							 gpointer	 user_data);
gssize		 g_usb_device_interrupt_transfer_finish	(GUsbDevice	*device,
							 GAsyncResult	*res,
							 GError		**error);

G_END_DECLS

#endif /* __GUSB_DEVICE_H__ */