File: sysfs.h

package info (click to toggle)
usbview 3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 952 kB
  • sloc: ansic: 1,546; makefile: 64; sh: 24; xml: 18
file content (95 lines) | stat: -rw-r--r-- 2,088 bytes parent folder | download | duplicates (3)
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
// SPDX-License-Identifier: GPL-2.0-only
/*
 * sysfs.h for USBView - a USB device viewer
 * Copyright (c) 1999, 2000, 2021-2022 by Greg Kroah-Hartman, greg@kroah.com
 */
#ifndef __SYSFS_H
#define __SYSFS_H

/* should make these dynamic someday... */
#define MAX_ENDPOINTS				32
#define MAX_INTERFACES				128
#define MAX_CONFIGS				32
#define MAX_CHILDREN				32

#define DEVICE_REVISION_NUMBER_SIZE		6
#define DEVICE_STRING_MAXSIZE			255

#define INTERFACE_DRIVERNAME_NODRIVER_STRING	"(none)"
#define INTERFACE_DRIVERNAME_STRING_MAXLENGTH	50

struct DeviceEndpoint {
	gint		address;
	gboolean	in;		/* TRUE if in, FALSE if out */
	gint		attribute;
	gchar		*type;
	gint		maxPacketSize;
	gchar		*interval;
};

struct DeviceInterface {
	gchar		*name;
	gint		interfaceNumber;
	gint		alternateNumber;
	gint		numEndpoints;
	gint		subClass;
	gint		protocol;
	gchar		*class;
	struct DeviceEndpoint *endpoint[MAX_ENDPOINTS];
	gboolean	driverAttached;		/* TRUE if driver is attached to this interface currently */
};

struct DeviceConfig {
	gint		configNumber;
	gint		numInterfaces;
	gint		attributes;
	gchar		*maxPower;
	struct DeviceInterface *interface[MAX_INTERFACES];
};

struct DeviceBandwidth {
	gint		allocated;
	gint		total;
	gint		percent;
	gint		numInterruptRequests;
	gint		numIsocRequests;
};

struct Device {
	gchar		*name;
	gint		busNumber;
	gint		level;
	gint		portNumber;
	gint		connectorNumber;
	gint		deviceNumber;
	gint		speed;
	gint		maxChildren;
	gchar		*version;
	gchar		*class;
	gchar		*subClass;
	gchar		*protocol;
	gint		maxPacketSize;
	gint		numConfigs;
	gint		vendorId;
	gint		productId;
	gchar		*revisionNumber;
	gchar		*manufacturer;
	gchar		*product;
	gchar		*serialNumber;
	struct DeviceConfig *config[MAX_CONFIGS];
	struct Device	*parent;
	struct Device	*child[MAX_CHILDREN];
	struct DeviceBandwidth	*bandwidth;
	GtkWidget	*tree;
	GtkTreeIter	leaf;
};

extern struct Device *rootDevice;

struct Device *usb_find_device(int deviceNumber, int busNumber);
void usb_initialize_list(void);
void sysfs_parse(void);
void usb_name_devices(void);

#endif	/* __USB_PARSE_H */