Re: usbmon packet data format

"Jon Smirl" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
This is the structure being returned:

struct usbmon_packet {
        u64 id;                 /*  0: URB ID - from submission to callback */
        unsigned char type;     /*  8: Same as text; extensible. */
        unsigned char xfer_type; /*    ISO (0), Intr, Control, Bulk (3) */
        unsigned char epnum;    /*     Endpoint number and transfer direction */
        unsigned char devnum;   /*     Device address */
        u16 busnum;             /* 12: Bus number */
        char flag_setup;        /* 14: Same as text */
        char flag_data;         /* 15: Same as text; Binary zero is OK. */
        s64 ts_sec;             /* 16: gettimeofday */
        s32 ts_usec;            /* 24: gettimeofday */
        int status;             /* 28: */
        unsigned int length;    /* 32: Length of data (submitted or actual) */
        unsigned int len_cap;   /* 36: Delivered length */
        unsigned char setup[8]; /* 40: Only for Control 'S' */
};                              /* 48 bytes total */

I'm not too keen on using an ASCII 'S' in the setup field to tell
whether setup[8] is in use or not. Am I correct in thinking that
setup[8] is always active on an URB submission and never active on a
completion or error? If that is the case then the flag_setup field is
redundant with the type field and can be eliminated. I would then make
the setup[8] presence variable depending on the packet type.

I also think flag_data is redundant based on the packet type, but I'm
not sure yet.

status looks to be active only on an error completion so the field
could be a union with setup[8].

The protocol can be further compressed by not including these fields:
xfer_type,  epnum,  devnum,  busnum in completion/error packets. I
already have to track the URB submissions in order to decode the
protocol so I have these fields from the submission packet and they
can't change assuming that I'm understanding everything correctly.


-- 
Jon Smirl
[email protected]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.