Re: [PATCH v2 1/1] usb: gadget: f_uac2: finalize wMaxPacketSize according to bandwidth

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 23 Jul 2015, Peter Chen wrote:

> Assume the interval for each packet is 2ms, the rate is 192 kbytes
> for both FS & HS:
> uac2->p_interval = 2000;
> uac2->p_pktsize = 192 kbytes / 2000 = 96 bytes

It's important to keep track of the units.  Intervals are measures of
time, and they use units like seconds or microseconds.  In this case,
one packet gets sent every 2000 us, so the value is 2000 us/packet.

The data rate is 192 KB/s.  Let's agree to use units of microseconds 
and bytes.  So converting from KB to bytes and seconds to microseconds, 
the data rate is:

	(192 KB/s) * (1000 bytes/KB) * (1/1000000 s/us)

	= (0.192 bytes/us).

Therefore to compute the number of bytes per packet (the packet size),
you have to _multiply_ the values -- not _divide_:

	(0.192 bytes/us) * (2000 us/packet) = (384 bytes/packet).

Therefore the packet size should be 384 bytes, not 96.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]