Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 403 lines (322 sloc) 11.959 kb
821faab8 »
2007-10-22 usbview 0.1.0 release
1 /*************************************************************************
2 ** usbtree.c for USBView - a USB device viewer
35903be4 »
2007-10-22 usbview 0.9.0
3 ** Copyright (c) 1999, 2000 by Greg Kroah-Hartman, <greg@kroah.com>
821faab8 »
2007-10-22 usbview 0.1.0 release
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
e372c428 »
2011-09-09 update the FSF address by removing it in all files.
7 ** the Free Software Foundation; version 2 of the License.
821faab8 »
2007-10-22 usbview 0.1.0 release
8 **
9 ** This program is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ** GNU General Public License for more details.
13 **
14 ** (See the included file COPYING)
15 *************************************************************************/
16
17
18 #ifdef HAVE_CONFIG_H
c7b6b1ea »
2007-10-22 usbview 0.8.1
19 #include <config.h>
821faab8 »
2007-10-22 usbview 0.1.0 release
20 #endif
21
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include <ctype.h>
35903be4 »
2007-10-22 usbview 0.9.0
26 #include <sys/stat.h>
27 #include <unistd.h>
28 #include <errno.h>
29 #include <gtk/gtk.h>
821faab8 »
2007-10-22 usbview 0.1.0 release
30
31 #include "usbtree.h"
df4a3959 »
2007-10-22 usbview 0.8.0 release
32 #include "usbparse.h"
821faab8 »
2007-10-22 usbview 0.1.0 release
33
34 #define MAX_LINE_SIZE 1000
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
35
821faab8 »
2007-10-22 usbview 0.1.0 release
36
37 static void Init (void)
38 {
48fbf032 »
2007-10-22 usbview 1.0-bk release
39 GtkTextIter begin;
40 GtkTextIter end;
41
df4a3959 »
2007-10-22 usbview 0.8.0 release
42 /* blow away the tree if there is one */
821faab8 »
2007-10-22 usbview 0.1.0 release
43 if (rootDevice != NULL) {
6f143552 »
2012-07-06 port usbview to use gtk3
44 gtk_tree_store_clear (treeStore);
df4a3959 »
2007-10-22 usbview 0.8.0 release
45 }
c7b6b1ea »
2007-10-22 usbview 0.8.1
46
821faab8 »
2007-10-22 usbview 0.1.0 release
47 /* clean out the text box */
48fbf032 »
2007-10-22 usbview 1.0-bk release
48 gtk_text_buffer_get_start_iter(textDescriptionBuffer,&begin);
49 gtk_text_buffer_get_end_iter(textDescriptionBuffer,&end);
50 gtk_text_buffer_delete (textDescriptionBuffer, &begin, &end);
821faab8 »
2007-10-22 usbview 0.1.0 release
51
52 return;
53 }
54
55
0a0a45d4 »
2007-10-22 usbview 0.6.0 release
56 static void PopulateListBox (int deviceId)
821faab8 »
2007-10-22 usbview 0.1.0 release
57 {
c7b6b1ea »
2007-10-22 usbview 0.8.1
58 Device *device;
59 char *string;
60 char *tempString;
61 int configNum;
62 int interfaceNum;
63 int endpointNum;
64 int deviceNumber = (deviceId >> 8);
65 int busNumber = (deviceId & 0x00ff);
48fbf032 »
2007-10-22 usbview 1.0-bk release
66 GtkTextIter begin;
67 GtkTextIter end;
c7b6b1ea »
2007-10-22 usbview 0.8.1
68
df4a3959 »
2007-10-22 usbview 0.8.0 release
69 device = usb_find_device (deviceNumber, busNumber);
821faab8 »
2007-10-22 usbview 0.1.0 release
70 if (device == NULL) {
71 printf ("Can't seem to find device info to display\n");
72 return;
c7b6b1ea »
2007-10-22 usbview 0.8.1
73 }
821faab8 »
2007-10-22 usbview 0.1.0 release
74
75 /* clear the textbox */
48fbf032 »
2007-10-22 usbview 1.0-bk release
76 gtk_text_buffer_get_start_iter(textDescriptionBuffer,&begin);
77 gtk_text_buffer_get_end_iter(textDescriptionBuffer,&end);
78 gtk_text_buffer_delete (textDescriptionBuffer, &begin, &end);
821faab8 »
2007-10-22 usbview 0.1.0 release
79
c7b6b1ea »
2007-10-22 usbview 0.8.1
80 /* freeze the display */
81 /* this keeps the annoying scroll from happening */
48fbf032 »
2007-10-22 usbview 1.0-bk release
82 gtk_widget_freeze_child_notify(textDescriptionView);
c7b6b1ea »
2007-10-22 usbview 0.8.1
83
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
84 string = (char *)g_malloc (1000);
821faab8 »
2007-10-22 usbview 0.1.0 release
85
bba30cc7 »
2007-10-22 usbview 0.5.0 release
86 /* add the name to the textbox if we have one*/
87 if (device->name != NULL) {
48fbf032 »
2007-10-22 usbview 1.0-bk release
88 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, device->name,strlen(device->name));
c7b6b1ea »
2007-10-22 usbview 0.8.1
89 }
821faab8 »
2007-10-22 usbview 0.1.0 release
90
0a0a45d4 »
2007-10-22 usbview 0.6.0 release
91 /* add the manufacturer if we have one */
92 if (device->manufacturer != NULL) {
93 sprintf (string, "\nManufacturer: %s", device->manufacturer);
48fbf032 »
2007-10-22 usbview 1.0-bk release
94 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
c7b6b1ea »
2007-10-22 usbview 0.8.1
95 }
96
0a0a45d4 »
2007-10-22 usbview 0.6.0 release
97 /* add the serial number if we have one */
98 if (device->serialNumber != NULL) {
99 sprintf (string, "\nSerial Number: %s", device->serialNumber);
48fbf032 »
2007-10-22 usbview 1.0-bk release
100 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
c7b6b1ea »
2007-10-22 usbview 0.8.1
101 }
0a0a45d4 »
2007-10-22 usbview 0.6.0 release
102
88e4a86b »
2007-10-22 usbview 0.4.0 release
103 /* add speed */
c7b6b1ea »
2007-10-22 usbview 0.8.1
104 switch (device->speed) {
105 case 1 : tempString = "1.5Mb/s (low)"; break;
106 case 12 : tempString = "12Mb/s (full)"; break;
107 case 480 : tempString = "480Mb/s (high)"; break; /* planning ahead... */
108 default : tempString = "unknown"; break;
109 }
110 sprintf (string, "\nSpeed: %s", tempString);
48fbf032 »
2007-10-22 usbview 1.0-bk release
111 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
821faab8 »
2007-10-22 usbview 0.1.0 release
112
113 /* add ports if available */
114 if (device->maxChildren) {
115 sprintf (string, "\nNumber of Ports: %i", device->maxChildren);
48fbf032 »
2007-10-22 usbview 1.0-bk release
116 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
c7b6b1ea »
2007-10-22 usbview 0.8.1
117 }
821faab8 »
2007-10-22 usbview 0.1.0 release
118
bba30cc7 »
2007-10-22 usbview 0.5.0 release
119 /* add the bandwidth info if available */
120 if (device->bandwidth != NULL) {
0a0a45d4 »
2007-10-22 usbview 0.6.0 release
121 sprintf (string, "\nBandwidth allocated: %i / %i (%i%%)", device->bandwidth->allocated, device->bandwidth->total, device->bandwidth->percent);
48fbf032 »
2007-10-22 usbview 1.0-bk release
122 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
c7b6b1ea »
2007-10-22 usbview 0.8.1
123
bba30cc7 »
2007-10-22 usbview 0.5.0 release
124 sprintf (string, "\nTotal number of interrupt requests: %i", device->bandwidth->numInterruptRequests);
48fbf032 »
2007-10-22 usbview 1.0-bk release
125 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
bba30cc7 »
2007-10-22 usbview 0.5.0 release
126
127 sprintf (string, "\nTotal number of isochronous requests: %i", device->bandwidth->numIsocRequests);
48fbf032 »
2007-10-22 usbview 1.0-bk release
128 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
c7b6b1ea »
2007-10-22 usbview 0.8.1
129 }
bba30cc7 »
2007-10-22 usbview 0.5.0 release
130
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
131 /* add the USB version, device class, subclass, protocol, max packet size, and the number of configurations (if it is there) */
132 if (device->version) {
133 sprintf (string, "\nUSB Version: %s\nDevice Class: %s\nDevice Subclass: %s\nDevice Protocol: %s\n"
134 "Maximum Default Endpoint Size: %i\nNumber of Configurations: %i",
135 device->version, device->class, device->subClass, device->protocol,
136 device->maxPacketSize, device->numConfigs);
48fbf032 »
2007-10-22 usbview 1.0-bk release
137 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
c7b6b1ea »
2007-10-22 usbview 0.8.1
138 }
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
139
821faab8 »
2007-10-22 usbview 0.1.0 release
140 /* add the vendor id, product id, and revision number (if it is there) */
141 if (device->vendorId) {
88e4a86b »
2007-10-22 usbview 0.4.0 release
142 sprintf (string, "\nVendor Id: %.4x\nProduct Id: %.4x\nRevision Number: %s",
821faab8 »
2007-10-22 usbview 0.1.0 release
143 device->vendorId, device->productId, device->revisionNumber);
48fbf032 »
2007-10-22 usbview 1.0-bk release
144 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
c7b6b1ea »
2007-10-22 usbview 0.8.1
145 }
821faab8 »
2007-10-22 usbview 0.1.0 release
146
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
147 /* display all the info for the configs */
148 for (configNum = 0; configNum < MAX_CONFIGS; ++configNum) {
149 if (device->config[configNum]) {
c7b6b1ea »
2007-10-22 usbview 0.8.1
150 DeviceConfig *config = device->config[configNum];
151
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
152 /* show this config */
153 sprintf (string, "\n\nConfig Number: %i\n\tNumber of Interfaces: %i\n\t"
c7b6b1ea »
2007-10-22 usbview 0.8.1
154 "Attributes: %.2x\n\tMaxPower Needed: %s",
155 config->configNumber, config->numInterfaces,
156 config->attributes, config->maxPower);
48fbf032 »
2007-10-22 usbview 1.0-bk release
157 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
158
159 /* show all of the interfaces for this config */
160 for (interfaceNum = 0; interfaceNum < MAX_INTERFACES; ++interfaceNum) {
161 if (config->interface[interfaceNum]) {
c7b6b1ea »
2007-10-22 usbview 0.8.1
162 DeviceInterface *interface = config->interface[interfaceNum];
163
bba30cc7 »
2007-10-22 usbview 0.5.0 release
164 sprintf (string, "\n\n\tInterface Number: %i", interface->interfaceNumber);
48fbf032 »
2007-10-22 usbview 1.0-bk release
165 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string, strlen(string));
bba30cc7 »
2007-10-22 usbview 0.5.0 release
166
167 if (interface->name != NULL) {
168 sprintf (string, "\n\t\tName: %s", interface->name);
48fbf032 »
2007-10-22 usbview 1.0-bk release
169 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string, strlen(string));
c7b6b1ea »
2007-10-22 usbview 0.8.1
170 }
171
bba30cc7 »
2007-10-22 usbview 0.5.0 release
172 sprintf (string, "\n\t\tAlternate Number: %i\n\t\tClass: %s\n\t\t"
48fbf032 »
2007-10-22 usbview 1.0-bk release
173 "Sub Class: %.2x\n\t\tProtocol: %.2x\n\t\tNumber of Endpoints: %i",
c7b6b1ea »
2007-10-22 usbview 0.8.1
174 interface->alternateNumber, interface->class,
175 interface->subClass, interface->protocol, interface->numEndpoints);
48fbf032 »
2007-10-22 usbview 1.0-bk release
176 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string, strlen(string));
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
177
178 /* show all of the endpoints for this interface */
179 for (endpointNum = 0; endpointNum < MAX_ENDPOINTS; ++endpointNum) {
180 if (interface->endpoint[endpointNum]) {
c7b6b1ea »
2007-10-22 usbview 0.8.1
181 DeviceEndpoint *endpoint = interface->endpoint[endpointNum];
182
88e4a86b »
2007-10-22 usbview 0.4.0 release
183 sprintf (string, "\n\n\t\t\tEndpoint Address: %.2x\n\t\t\t"
c7b6b1ea »
2007-10-22 usbview 0.8.1
184 "Direction: %s\n\t\t\tAttribute: %i\n\t\t\t"
185 "Type: %s\n\t\t\tMax Packet Size: %i\n\t\t\tInterval: %s",
186 endpoint->address,
187 endpoint->in ? "in" : "out", endpoint->attribute,
188 endpoint->type, endpoint->maxPacketSize, endpoint->interval);
48fbf032 »
2007-10-22 usbview 1.0-bk release
189 gtk_text_buffer_insert_at_cursor(textDescriptionBuffer, string,strlen(string));
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
190 }
191 }
192 }
193 }
194 }
c7b6b1ea »
2007-10-22 usbview 0.8.1
195 }
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
196
c7b6b1ea »
2007-10-22 usbview 0.8.1
197 /* thaw the display */
48fbf032 »
2007-10-22 usbview 1.0-bk release
198 gtk_widget_thaw_child_notify(textDescriptionView);
c7b6b1ea »
2007-10-22 usbview 0.8.1
199
88e4a86b »
2007-10-22 usbview 0.4.0 release
200 /* clean up our string */
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
201 g_free (string);
821faab8 »
2007-10-22 usbview 0.1.0 release
202
203 return;
204 }
205
206
6f143552 »
2012-07-06 port usbview to use gtk3
207 void SelectItem (GtkTreeSelection *selection, gpointer userData)
821faab8 »
2007-10-22 usbview 0.1.0 release
208 {
6f143552 »
2012-07-06 port usbview to use gtk3
209 GtkTreeIter iter;
210 GtkTreeModel *model;
211 gint deviceAddr;
212
213 if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
214 gtk_tree_model_get (model, &iter,
215 DEVICE_ADDR_COLUMN, &deviceAddr,
216 -1);
217 PopulateListBox (deviceAddr);
218 }
821faab8 »
2007-10-22 usbview 0.1.0 release
219 }
220
221
222 static void DisplayDevice (Device *parent, Device *device)
223 {
35903be4 »
2007-10-22 usbview 0.9.0
224 int i;
225 int configNum;
226 int interfaceNum;
227 gboolean driverAttached = TRUE;
6f143552 »
2012-07-06 port usbview to use gtk3
228 gint deviceAddr;
229 const gchar *color = "black";
df4a3959 »
2007-10-22 usbview 0.8.0 release
230
231 if (device == NULL)
232 return;
233
35903be4 »
2007-10-22 usbview 0.9.0
234 /* build this node */
6f143552 »
2012-07-06 port usbview to use gtk3
235 deviceAddr = (device->deviceNumber << 8) | device->busNumber;
236 gtk_tree_store_append (treeStore, &device->leaf,
237 (device->level != 0) ? &parent->leaf : NULL);
c7b6b1ea »
2007-10-22 usbview 0.8.1
238
df4a3959 »
2007-10-22 usbview 0.8.0 release
239 /* determine if this device has drivers attached to all interfaces */
240 for (configNum = 0; configNum < MAX_CONFIGS; ++configNum) {
241 if (device->config[configNum]) {
c7b6b1ea »
2007-10-22 usbview 0.8.1
242 DeviceConfig *config = device->config[configNum];
df4a3959 »
2007-10-22 usbview 0.8.0 release
243 for (interfaceNum = 0; interfaceNum < MAX_INTERFACES; ++interfaceNum) {
244 if (config->interface[interfaceNum]) {
c7b6b1ea »
2007-10-22 usbview 0.8.1
245 DeviceInterface *interface = config->interface[interfaceNum];
df4a3959 »
2007-10-22 usbview 0.8.0 release
246 if (interface->driverAttached == FALSE) {
247 driverAttached = FALSE;
248 break;
249 }
250 }
251 }
252 }
c7b6b1ea »
2007-10-22 usbview 0.8.1
253 }
254
df4a3959 »
2007-10-22 usbview 0.8.0 release
255 /* change the color of this leaf if there are no drivers attached to it */
6f143552 »
2012-07-06 port usbview to use gtk3
256 if (driverAttached == FALSE)
257 color = "red";
258
259 gtk_tree_store_set (treeStore, &device->leaf,
260 NAME_COLUMN, device->name,
261 DEVICE_ADDR_COLUMN, deviceAddr,
262 COLOR_COLUMN, color,
263 -1);
c7b6b1ea »
2007-10-22 usbview 0.8.1
264
821faab8 »
2007-10-22 usbview 0.1.0 release
265 /* create all of the children's leafs */
266 for (i = 0; i < MAX_CHILDREN; ++i) {
267 DisplayDevice (device, device->child[i]);
c7b6b1ea »
2007-10-22 usbview 0.8.1
268 }
821faab8 »
2007-10-22 usbview 0.1.0 release
269
270 return;
271 }
c7b6b1ea »
2007-10-22 usbview 0.8.1
272
821faab8 »
2007-10-22 usbview 0.1.0 release
273
35903be4 »
2007-10-22 usbview 0.9.0
274 #define FILENAME_SIZE 1000;
88e4a86b »
2007-10-22 usbview 0.4.0 release
275
df4a3959 »
2007-10-22 usbview 0.8.0 release
276 gchar devicesFile[1000];
35903be4 »
2007-10-22 usbview 0.9.0
277 static gchar previousDevicesFile[1000];
278 static time_t previousChange;
821faab8 »
2007-10-22 usbview 0.1.0 release
279
91a58300 »
2007-10-22 usbview 1.0
280 const char *verifyMessage = " Verify that you have USB compiled into your kernel, \n"
281 " have the USB core modules loaded, and have the \n"
282 " usbdevfs filesystem mounted. ";
821faab8 »
2007-10-22 usbview 0.1.0 release
283
35903be4 »
2007-10-22 usbview 0.9.0
284 static void FileError (void)
285 {
6f143552 »
2012-07-06 port usbview to use gtk3
286 GtkWidget *dialog;
287
288 dialog = gtk_message_dialog_new (
289 GTK_WINDOW (windowMain),
290 GTK_DIALOG_DESTROY_WITH_PARENT,
291 GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
292 "Can not open the file %s\n\n%s",
293 devicesFile, verifyMessage);
294 gtk_dialog_run (GTK_DIALOG (dialog));
295 gtk_widget_destroy (dialog);
35903be4 »
2007-10-22 usbview 0.9.0
296 }
297
298
299 static int FileHasChanged (void)
300 {
301 struct stat file_info;
302 int result;
303
304 if (strcmp (previousDevicesFile, devicesFile) == 0) {
305 /* we've looked at this filename before, so check the file time of the file */
306 result = stat (devicesFile, &file_info);
307 if (result) {
308 /* something wrong in looking for this file */
309 return 0;
310 }
311
312 if (file_info.st_ctime == previousChange) {
313 /* no change */
314 return 0;
315 } else {
316 /* something changed */
317 previousChange = file_info.st_ctime;
318 return 1;
319 }
320 } else {
321 /* filenames are different, so save the name for the next time */
322 strcpy (previousDevicesFile, devicesFile);
323 return 1;
324 }
325 }
326
327
328 void LoadUSBTree (int refresh)
821faab8 »
2007-10-22 usbview 0.1.0 release
329 {
c7b6b1ea »
2007-10-22 usbview 0.8.1
330 static gboolean signal_connected = FALSE;
331 FILE *usbFile;
332 char *dataLine;
333 int finished;
334 int i;
335
35903be4 »
2007-10-22 usbview 0.9.0
336 /* if refresh is selected, then always do a refresh, otherwise look at the file first */
337 if (!refresh) {
338 if (!FileHasChanged()) {
339 return;
340 }
341 }
821faab8 »
2007-10-22 usbview 0.1.0 release
342
df4a3959 »
2007-10-22 usbview 0.8.0 release
343 usbFile = fopen (devicesFile, "r");
821faab8 »
2007-10-22 usbview 0.1.0 release
344 if (usbFile == NULL) {
35903be4 »
2007-10-22 usbview 0.9.0
345 FileError();
821faab8 »
2007-10-22 usbview 0.1.0 release
346 return;
c7b6b1ea »
2007-10-22 usbview 0.8.1
347 }
821faab8 »
2007-10-22 usbview 0.1.0 release
348 finished = 0;
c7b6b1ea »
2007-10-22 usbview 0.8.1
349
821faab8 »
2007-10-22 usbview 0.1.0 release
350 Init();
351
df4a3959 »
2007-10-22 usbview 0.8.0 release
352 usb_initialize_list ();
353
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
354 dataLine = (char *)g_malloc (MAX_LINE_SIZE);
821faab8 »
2007-10-22 usbview 0.1.0 release
355 while (!finished) {
356 /* read the line in from the file */
48fbf032 »
2007-10-22 usbview 1.0-bk release
357 fgets (dataLine, MAX_LINE_SIZE-1, usbFile);
821faab8 »
2007-10-22 usbview 0.1.0 release
358
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
359 if (dataLine[strlen(dataLine)-1] == '\n')
df4a3959 »
2007-10-22 usbview 0.8.0 release
360 usb_parse_line (dataLine);
c7b6b1ea »
2007-10-22 usbview 0.8.1
361
821faab8 »
2007-10-22 usbview 0.1.0 release
362 if (feof (usbFile))
363 finished = 1;
c7b6b1ea »
2007-10-22 usbview 0.8.1
364 }
821faab8 »
2007-10-22 usbview 0.1.0 release
365
48fbf032 »
2007-10-22 usbview 1.0-bk release
366 fclose (usbFile);
fe5adfd9 »
2007-10-22 usbview 0.2.0 release
367 g_free (dataLine);
821faab8 »
2007-10-22 usbview 0.1.0 release
368
df4a3959 »
2007-10-22 usbview 0.8.0 release
369 usb_name_devices ();
bba30cc7 »
2007-10-22 usbview 0.5.0 release
370
df4a3959 »
2007-10-22 usbview 0.8.0 release
371 /* build our tree */
0a0a45d4 »
2007-10-22 usbview 0.6.0 release
372 for (i = 0; i < rootDevice->maxChildren; ++i) {
373 DisplayDevice (rootDevice, rootDevice->child[i]);
c7b6b1ea »
2007-10-22 usbview 0.8.1
374 }
375
376 gtk_widget_show (treeUSB);
df4a3959 »
2007-10-22 usbview 0.8.0 release
377
6f143552 »
2012-07-06 port usbview to use gtk3
378 gtk_tree_view_expand_all (GTK_TREE_VIEW (treeUSB));
c7b6b1ea »
2007-10-22 usbview 0.8.1
379
380 /* hook up our callback function to this tree if we haven't yet */
381 if (!signal_connected) {
6f143552 »
2012-07-06 port usbview to use gtk3
382 GtkTreeSelection *select;
383 select = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeUSB));
384 g_signal_connect (G_OBJECT (select), "changed",
385 G_CALLBACK (SelectItem), NULL);
c7b6b1ea »
2007-10-22 usbview 0.8.1
386 signal_connected = TRUE;
387 }
388
821faab8 »
2007-10-22 usbview 0.1.0 release
389 return;
390 }
df4a3959 »
2007-10-22 usbview 0.8.0 release
391
392
393
394 void initialize_stuff (void)
395 {
f1a40f13 »
2012-07-06 /proc/bus/usb/devices has moved to /sys/kernel/debug/usb/devices
396 strcpy (devicesFile, "/sys/kernel/debug/usb/devices");
35903be4 »
2007-10-22 usbview 0.9.0
397 memset (&previousDevicesFile[0], 0x00, sizeof(previousDevicesFile));
398 previousChange = 0;
df4a3959 »
2007-10-22 usbview 0.8.0 release
399
400 return;
401 }
402
Something went wrong with that request. Please try again.