diff options
Diffstat (limited to 'Documentation/usb/usbmon.txt')
-rw-r--r-- | Documentation/usb/usbmon.txt | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/Documentation/usb/usbmon.txt b/Documentation/usb/usbmon.txt index 270481906dc8..6c3c625b7f30 100644 --- a/Documentation/usb/usbmon.txt +++ b/Documentation/usb/usbmon.txt | |||
@@ -229,16 +229,26 @@ struct usbmon_packet { | |||
229 | int status; /* 28: */ | 229 | int status; /* 28: */ |
230 | unsigned int length; /* 32: Length of data (submitted or actual) */ | 230 | unsigned int length; /* 32: Length of data (submitted or actual) */ |
231 | unsigned int len_cap; /* 36: Delivered length */ | 231 | unsigned int len_cap; /* 36: Delivered length */ |
232 | unsigned char setup[8]; /* 40: Only for Control 'S' */ | 232 | union { /* 40: */ |
233 | }; /* 48 bytes total */ | 233 | unsigned char setup[SETUP_LEN]; /* Only for Control S-type */ |
234 | struct iso_rec { /* Only for ISO */ | ||
235 | int error_count; | ||
236 | int numdesc; | ||
237 | } iso; | ||
238 | } s; | ||
239 | int interval; /* 48: Only for Interrupt and ISO */ | ||
240 | int start_frame; /* 52: For ISO */ | ||
241 | unsigned int xfer_flags; /* 56: copy of URB's transfer_flags */ | ||
242 | unsigned int ndesc; /* 60: Actual number of ISO descriptors */ | ||
243 | }; /* 64 total length */ | ||
234 | 244 | ||
235 | These events can be received from a character device by reading with read(2), | 245 | These events can be received from a character device by reading with read(2), |
236 | with an ioctl(2), or by accessing the buffer with mmap. | 246 | with an ioctl(2), or by accessing the buffer with mmap. However, read(2) |
247 | only returns first 48 bytes for compatibility reasons. | ||
237 | 248 | ||
238 | The character device is usually called /dev/usbmonN, where N is the USB bus | 249 | The character device is usually called /dev/usbmonN, where N is the USB bus |
239 | number. Number zero (/dev/usbmon0) is special and means "all buses". | 250 | number. Number zero (/dev/usbmon0) is special and means "all buses". |
240 | However, this feature is not implemented yet. Note that specific naming | 251 | Note that specific naming policy is set by your Linux distribution. |
241 | policy is set by your Linux distribution. | ||
242 | 252 | ||
243 | If you create /dev/usbmon0 by hand, make sure that it is owned by root | 253 | If you create /dev/usbmon0 by hand, make sure that it is owned by root |
244 | and has mode 0600. Otherwise, unpriviledged users will be able to snoop | 254 | and has mode 0600. Otherwise, unpriviledged users will be able to snoop |
@@ -279,9 +289,10 @@ size is out of [unspecified] bounds for this kernel, the call fails with | |||
279 | This call returns the current size of the buffer in bytes. | 289 | This call returns the current size of the buffer in bytes. |
280 | 290 | ||
281 | MON_IOCX_GET, defined as _IOW(MON_IOC_MAGIC, 6, struct mon_get_arg) | 291 | MON_IOCX_GET, defined as _IOW(MON_IOC_MAGIC, 6, struct mon_get_arg) |
292 | MON_IOCX_GETX, defined as _IOW(MON_IOC_MAGIC, 10, struct mon_get_arg) | ||
282 | 293 | ||
283 | This call waits for events to arrive if none were in the kernel buffer, | 294 | These calls wait for events to arrive if none were in the kernel buffer, |
284 | then returns the first event. Its argument is a pointer to the following | 295 | then return the first event. The argument is a pointer to the following |
285 | structure: | 296 | structure: |
286 | 297 | ||
287 | struct mon_get_arg { | 298 | struct mon_get_arg { |
@@ -294,6 +305,8 @@ Before the call, hdr, data, and alloc should be filled. Upon return, the area | |||
294 | pointed by hdr contains the next event structure, and the data buffer contains | 305 | pointed by hdr contains the next event structure, and the data buffer contains |
295 | the data, if any. The event is removed from the kernel buffer. | 306 | the data, if any. The event is removed from the kernel buffer. |
296 | 307 | ||
308 | The MON_IOCX_GET copies 48 bytes, MON_IOCX_GETX copies 64 bytes. | ||
309 | |||
297 | MON_IOCX_MFETCH, defined as _IOWR(MON_IOC_MAGIC, 7, struct mon_mfetch_arg) | 310 | MON_IOCX_MFETCH, defined as _IOWR(MON_IOC_MAGIC, 7, struct mon_mfetch_arg) |
298 | 311 | ||
299 | This ioctl is primarily used when the application accesses the buffer | 312 | This ioctl is primarily used when the application accesses the buffer |