-
Notifications
You must be signed in to change notification settings - Fork 109
/
TODO.txt
406 lines (387 loc) · 14.3 KB
/
TODO.txt
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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
Test wince
http://blog.csdn.net/achellies/article/details/4533881
http://blog.csdn.net/CoolSlob/article/details/3348147
1、可根据dbch_devicetype(DBT_DEVTYP_DEVICEINTERFACE和DBT_DEVTYP_VOLUME),分别得到PID/VID/SN和盘符号。
2、当USB设备不是存储设备时,只出发一次WM_DEVICECHANGE,devicetype是DBT_DEVTYP_DEVICEINTERFACE
3、当USB设备是存储设备时,会触发两次WM_DEVICECHANGE,一次是DBT_DEVTYP_DEVICEINTERFACE、一次是DBT_DEVTYP_VOLUME
4、插入时,先DBT_DEVTYP_DEVICEINTERFACE后DBT_DEVTYP_VOLUME
5、拔出时,先DBT_DEVTYP_VOLUME后DBT_DEVTYP_DEVICEINTERFACE
6、即使是存储设备,有时也不会触发DBT_DEVTYP_VOLUME,这个问题还没搞清楚。
case WM_DEVICECHANGE:
{
DbgPrint(_T("WM_DEVICECHANGE/n"));
switch (wParam)
{
case DBT_DEVICEARRIVAL:
{
PDEV_BROADCAST_HDR pDBHdr = (PDEV_BROADCAST_HDR)lParam;
switch(pDBHdr->dbch_devicetype)
{
case DBT_DEVTYP_DEVICEINTERFACE:
{
PDEV_BROADCAST_DEVICEINTERFACE pDBInteface = (PDEV_BROADCAST_DEVICEINTERFACE)pDBHdr;
LPOLESTR pGuid = NULL;
StringFromCLSID(pDBInteface->dbcc_classguid,&pGuid);
DbgPrint(_T("DBT_DEVTYP_DEVICEINTERFACE,Device CLSID = %s,Device Name = %s/n"),pGuid,pDBInteface->dbcc_name);
CoTaskMemFree(pGuid);
break;
}
case DBT_DEVTYP_HANDLE:
{
PDEV_BROADCAST_HANDLE pDBHandler = (PDEV_BROADCAST_HANDLE)pDBHdr;
LPOLESTR pGuid = NULL;
StringFromCLSID(pDBHandler->dbch_eventguid,&pGuid);
DbgPrint(_T("DBT_DEVTYP_HANDLE,Device CLSID = %s/n"),pGuid);
CoTaskMemFree(pGuid);
break;
}
case DBT_DEVTYP_OEM:
DbgPrint( _T("DBT_DEVTYP_OEM!/n"));
break;
case DBT_DEVTYP_PORT:
{
PDEV_BROADCAST_PORT pDBPort = (PDEV_BROADCAST_PORT)pDBHdr;
DbgPrint(_T("DBT_DEVTYP_PORT = %s/n"),pDBPort->dbcp_name);
break;
}
case DBT_DEVTYP_VOLUME:
DbgPrint( _T("DBT_DEVTYP_VOLUME!/n"));
break;
}
break;
}
case DBT_DEVICEREMOVECOMPLETE:
{
PDEV_BROADCAST_HDR pDBHdr = (PDEV_BROADCAST_HDR)lParam;
switch(pDBHdr->dbch_devicetype)
{
case DBT_DEVTYP_DEVICEINTERFACE:
{
PDEV_BROADCAST_DEVICEINTERFACE pDBInteface = (PDEV_BROADCAST_DEVICEINTERFACE)pDBHdr;
LPOLESTR pGuid = NULL;
StringFromCLSID(pDBInteface->dbcc_classguid,&pGuid);
DbgPrint(_T("DBT_DEVICEREMOVECOMPLETE,Device CLSID = %s,Device Name = %s/n"),pGuid,pDBInteface->dbcc_name);
CoTaskMemFree(pGuid);
break;
}
case DBT_DEVTYP_HANDLE:
{
PDEV_BROADCAST_HANDLE pDBHandler = (PDEV_BROADCAST_HANDLE)pDBHdr;
LPOLESTR pGuid = NULL;
StringFromCLSID(pDBHandler->dbch_eventguid,&pGuid);
DbgPrint(_T("DBT_DEVTYP_HANDLE,Device CLSID = %s/n"),pGuid);
CoTaskMemFree(pGuid);
break;
}
case DBT_DEVTYP_OEM:
DbgPrint( _T("DBT_DEVTYP_OEM!/n"));
break;
case DBT_DEVTYP_PORT:
{
PDEV_BROADCAST_PORT pDBPort = (PDEV_BROADCAST_PORT)pDBHdr;
DbgPrint(_T("DBT_DEVTYP_PORT = %s/n"),pDBPort->dbcp_name);
break;
}
case DBT_DEVTYP_VOLUME:
DbgPrint( _T("DBT_DEVTYP_VOLUME!/n"));
break;
}
break;
}
}
return LRESULT(TRUE);
}
rpath.pri
OTHER PLATFORM
Use QAbstractEventDispatcher. See QxtGlobalShortcut
other device
windows and other platforms. See QDrive
watch /etc/mtab for linux 2.4
GUI example
from armv6:
tid=0x4001fe20 HotplugWatcher::HotplugWatcher(QObject*)
Hotplug watcher started
parseDeviceInfo: "read fro socket 239 bytes"
parseLine: "add@/devices/platform/tcc-ohci/usb1/1-1/1-1.2"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2"
parseLine: "SUBSYSTEM=usb"
parseLine: "MAJOR=189"
parseLine: "MINOR=4"
parseLine: "DEVTYPE=usb_device"
parseLine: "PHYSDEVBUS=usb"
parseLine: "PRODUCT=125f/312a/a00"
parseLine: "TYPE=0/0/0"
parseLine: "BUSNUM=001"
parseLine: "DEVNUM=005"
parseLine: "SEQNUM=755"
parseDeviceInfo: "read fro socket 294 bytes"
parseLine: "add@/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0"
parseLine: "SUBSYSTEM=usb"
parseLine: "DEVTYPE=usb_interface"
parseLine: "PHYSDEVBUS=usb"
parseLine: "PRODUCT=125f/312a/a00"
parseLine: "TYPE=0/0/0"
parseLine: "INTERFACE=8/6/80"
parseLine: "MODALIAS=usb:v125Fp312Ad0A00dc00dsc00dp00ic08isc06ip50"
parseLine: "SEQNUM=756"
parseDeviceInfo: "read fro socket 205 bytes"
parseLine: "add@/class/scsi_host/host5"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/class/scsi_host/host5"
parseLine: "SUBSYSTEM=scsi_host"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0"
parseLine: "PHYSDEVBUS=usb"
parseLine: "PHYSDEVDRIVER=usb-storage"
parseLine: "SEQNUM=757"
parseDeviceInfo: "read fro socket 251 bytes"
parseLine: "add@/class/usb_endpoint/usbdev1.5_ep02"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/class/usb_endpoint/usbdev1.5_ep02"
parseLine: "SUBSYSTEM=usb_endpoint"
parseLine: "MAJOR=253"
parseLine: "MINOR=20"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0"
parseLine: "PHYSDEVBUS=usb"
parseLine: "PHYSDEVDRIVER=usb-storage"
parseLine: "SEQNUM=758"
parseDeviceInfo: "read fro socket 251 bytes"
parseLine: "add@/class/usb_endpoint/usbdev1.5_ep81"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/class/usb_endpoint/usbdev1.5_ep81"
parseLine: "SUBSYSTEM=usb_endpoint"
parseLine: "MAJOR=253"
parseLine: "MINOR=21"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0"
parseLine: "PHYSDEVBUS=usb"
parseLine: "PHYSDEVDRIVER=usb-storage"
parseLine: "SEQNUM=759"
parseDeviceInfo: "read fro socket 233 bytes"
parseLine: "add@/class/usb_endpoint/usbdev1.5_ep00"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/class/usb_endpoint/usbdev1.5_ep00"
parseLine: "SUBSYSTEM=usb_endpoint"
parseLine: "MAJOR=253"
parseLine: "MINOR=22"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2"
parseLine: "PHYSDEVBUS=usb"
parseLine: "PHYSDEVDRIVER=usb"
parseLine: "SEQNUM=760"
parseDeviceInfo: "read fro socket 262 bytes"
parseLine: "add@/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "SUBSYSTEM=scsi"
parseLine: "DEVTYPE=scsi_device"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "MODALIAS=scsi:t-0x00"
parseLine: "SEQNUM=761"
parseDeviceInfo: "read fro socket 227 bytes"
parseLine: "add@/class/scsi_disk/5:0:0:0"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/class/scsi_disk/5:0:0:0"
parseLine: "SUBSYSTEM=scsi_disk"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "PHYSDEVDRIVER=sd"
parseLine: "SEQNUM=762"
parseDeviceInfo: "read fro socket 315 bytes"
parseLine: "change@/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "ACTION=change"
parseLine: "DEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "SUBSYSTEM=scsi"
parseLine: "SDEV_MEDIA_CHANGE=1"
parseLine: "DEVTYPE=scsi_device"
parseLine: "DRIVER=sd"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "PHYSDEVDRIVER=sd"
parseLine: "MODALIAS=scsi:t-0x00"
parseLine: "SEQNUM=763"
parseDeviceInfo: "read fro socket 225 bytes"
parseLine: "add@/block/sdc"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/block/sdc"
parseLine: "SUBSYSTEM=block"
parseLine: "MAJOR=8"
parseLine: "MINOR=32"
parseLine: "DEVTYPE=disk"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "PHYSDEVDRIVER=sd"
parseLine: "SEQNUM=764"
parseDeviceInfo: "read fro socket 240 bytes"
parseLine: "add@/block/sdc/sdc1"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/block/sdc/sdc1"
parseLine: "SUBSYSTEM=block"
parseLine: "MAJOR=8"
parseLine: "MINOR=33"
parseLine: "DEVTYPE=partition"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "PHYSDEVDRIVER=sd"
parseLine: "SEQNUM=765"
parseDeviceInfo: "read fro socket 80 bytes"
parseLine: "add@/class/bdi/8:32"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/class/bdi/8:32"
parseLine: "SUBSYSTEM=bdi"
parseLine: "SEQNUM=766"
parseDeviceInfo: "read fro socket 233 bytes"
parseLine: "add@/class/scsi_device/5:0:0:0"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/class/scsi_device/5:0:0:0"
parseLine: "SUBSYSTEM=scsi_device"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "PHYSDEVDRIVER=sd"
parseLine: "SEQNUM=767"
parseDeviceInfo: "read fro socket 245 bytes"
parseLine: "add@/class/scsi_generic/sg2"
parseLine: "ACTION=add"
parseLine: "DEVPATH=/class/scsi_generic/sg2"
parseLine: "SUBSYSTEM=scsi_generic"
parseLine: "MAJOR=21"
parseLine: "MINOR=2"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "PHYSDEVDRIVER=sd"
parseLine: "SEQNUM=768"
parseDeviceInfo: "read fro socket 257 bytes"
parseLine: "remove@/class/usb_endpoint/usbdev1.5_ep02"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/class/usb_endpoint/usbdev1.5_ep02"
parseLine: "SUBSYSTEM=usb_endpoint"
parseLine: "MAJOR=253"
parseLine: "MINOR=20"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0"
parseLine: "PHYSDEVBUS=usb"
parseLine: "PHYSDEVDRIVER=usb-storage"
parseLine: "SEQNUM=769"
parseDeviceInfo: "read fro socket 257 bytes"
parseLine: "remove@/class/usb_endpoint/usbdev1.5_ep81"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/class/usb_endpoint/usbdev1.5_ep81"
parseLine: "SUBSYSTEM=usb_endpoint"
parseLine: "MAJOR=253"
parseLine: "MINOR=21"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0"
parseLine: "PHYSDEVBUS=usb"
parseLine: "PHYSDEVDRIVER=usb-storage"
parseLine: "SEQNUM=770"
parseDeviceInfo: "read fro socket 251 bytes"
parseLine: "remove@/class/scsi_generic/sg2"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/class/scsi_generic/sg2"
parseLine: "SUBSYSTEM=scsi_generic"
parseLine: "MAJOR=21"
parseLine: "MINOR=2"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "PHYSDEVDRIVER=sd"
parseLine: "SEQNUM=771"
parseDeviceInfo: "read fro socket 239 bytes"
parseLine: "remove@/class/scsi_device/5:0:0:0"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/class/scsi_device/5:0:0:0"
parseLine: "SUBSYSTEM=scsi_device"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "PHYSDEVDRIVER=sd"
parseLine: "SEQNUM=772"
parseDeviceInfo: "read fro socket 233 bytes"
parseLine: "remove@/class/scsi_disk/5:0:0:0"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/class/scsi_disk/5:0:0:0"
parseLine: "SUBSYSTEM=scsi_disk"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "PHYSDEVDRIVER=sd"
parseLine: "SEQNUM=773"
parseDeviceInfo: "read fro socket 246 bytes"
parseLine: "remove@/block/sdc/sdc1"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/block/sdc/sdc1"
parseLine: "SUBSYSTEM=block"
parseLine: "MAJOR=8"
parseLine: "MINOR=33"
parseLine: "DEVTYPE=partition"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "PHYSDEVDRIVER=sd"
parseLine: "SEQNUM=774"
parseDeviceInfo: "read fro socket 86 bytes"
parseLine: "remove@/class/bdi/8:32"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/class/bdi/8:32"
parseLine: "SUBSYSTEM=bdi"
parseLine: "SEQNUM=775"
parseDeviceInfo: "read fro socket 231 bytes"
parseLine: "remove@/block/sdc"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/block/sdc"
parseLine: "SUBSYSTEM=block"
parseLine: "MAJOR=8"
parseLine: "MINOR=32"
parseLine: "DEVTYPE=disk"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "PHYSDEVDRIVER=sd"
parseLine: "SEQNUM=776"
parseDeviceInfo: "read fro socket 268 bytes"
parseLine: "remove@/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0/host5/target5:0:0/5:0:0:0"
parseLine: "SUBSYSTEM=scsi"
parseLine: "DEVTYPE=scsi_device"
parseLine: "PHYSDEVBUS=scsi"
parseLine: "MODALIAS=scsi:t-0x00"
parseLine: "SEQNUM=777"
parseDeviceInfo: "read fro socket 211 bytes"
parseLine: "remove@/class/scsi_host/host5"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/class/scsi_host/host5"
parseLine: "SUBSYSTEM=scsi_host"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0"
parseLine: "PHYSDEVBUS=usb"
parseLine: "PHYSDEVDRIVER=usb-storage"
parseLine: "SEQNUM=778"
parseDeviceInfo: "read fro socket 300 bytes"
parseLine: "remove@/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2/1-1.2:1.0"
parseLine: "SUBSYSTEM=usb"
parseLine: "DEVTYPE=usb_interface"
parseLine: "PHYSDEVBUS=usb"
parseLine: "PRODUCT=125f/312a/a00"
parseLine: "TYPE=0/0/0"
parseLine: "INTERFACE=8/6/80"
parseLine: "MODALIAS=usb:v125Fp312Ad0A00dc00dsc00dp00ic08isc06ip50"
parseLine: "SEQNUM=779"
parseDeviceInfo: "read fro socket 239 bytes"
parseLine: "remove@/class/usb_endpoint/usbdev1.5_ep00"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/class/usb_endpoint/usbdev1.5_ep00"
parseLine: "SUBSYSTEM=usb_endpoint"
parseLine: "MAJOR=253"
parseLine: "MINOR=22"
parseLine: "PHYSDEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2"
parseLine: "PHYSDEVBUS=usb"
parseLine: "PHYSDEVDRIVER=usb"
parseLine: "SEQNUM=780"
parseDeviceInfo: "read fro socket 245 bytes"
parseLine: "remove@/devices/platform/tcc-ohci/usb1/1-1/1-1.2"
parseLine: "ACTION=remove"
parseLine: "DEVPATH=/devices/platform/tcc-ohci/usb1/1-1/1-1.2"
parseLine: "SUBSYSTEM=usb"
parseLine: "MAJOR=189"
parseLine: "MINOR=4"
parseLine: "DEVTYPE=usb_device"
parseLine: "PHYSDEVBUS=usb"
parseLine: "PRODUCT=125f/312a/a00"
parseLine: "TYPE=0/0/0"
parseLine: "BUSNUM=001"
parseLine: "DEVNUM=005"
parseLine: "SEQNUM=781"