usbmon: bus zero

Add the "bus zero" feature to the usbmon. If a user process specifies bus
with number zero, it receives events from all buses. This is useful when
we wish to see initial enumeration when a bus is created, typically after
a modprobe. Until now, an application had to loop until a new bus could
be open, then start capturing on it. This procedure was cumbersome and
could lose initial events. Also, often it's too bothersome to find exactly
to which bus a specific device is attached.

Paolo Albeni provided the original concept implementation. I added the
handling of "bus->monitored" flag and generally fixed it up.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Pete Zaitcev
2007-04-11 13:47:26 -07:00
committed by Greg Kroah-Hartman
parent 35d07fd58f
commit ecb658d387
4 changed files with 116 additions and 84 deletions

View File

@@ -23,7 +23,6 @@ struct mon_bus {
struct dentry *dent_s; /* Debugging file */
struct dentry *dent_t; /* Text interface file */
struct dentry *dent_u; /* Second text interface file */
int uses_dma;
/* Ref */
int nreaders; /* Under mon_lock AND mbus->lock */
@@ -53,7 +52,7 @@ void mon_reader_del(struct mon_bus *mbus, struct mon_reader *r);
struct mon_bus *mon_bus_lookup(unsigned int num);
int /*bool*/ mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus);
int /*bool*/ mon_text_add(struct mon_bus *mbus, int busnum);
void mon_text_del(struct mon_bus *mbus);
// void mon_bin_add(struct mon_bus *);
@@ -82,4 +81,6 @@ extern struct mutex mon_lock;
extern const struct file_operations mon_fops_stat;
extern struct mon_bus mon_bus0; /* Only for redundant checks */
#endif /* __USB_MON_H */