From: Tim R. <ti...@pr...> - 2007-02-22 17:26:14
|
mohammed abuhijle wrote: > It's up to you to get the pipe > > descriptions from the original configuration descriptor for the > alternate setting you picked. You have to know which pipes are valid > for that setting, and start writing to the pipes. > > > Ok, good. so at least I know now I am doing something clearly wrong. > The questions then becomes, how to access the endpoints of altsetting > 1,2 and 3? I thought usb_set_altsetting will set tyhe active interface > (as the docs explain).....so..what exactly does this mean... The "usual" purpose of alternate settings is to adjust the bandwidth needs of a USB device. Isochronous and interrupt endpoints reserve a fixed amount of bandwidth in the USB frame as soon as they are configured, whether there is any data being transferred or not. If there are already too many reservations, the device will not be allowed to configure. So, a device is required to have an alternate setting 0 in which none of the isoch and interrupt endpoints get any bandwidth (which will always work), and at least one other alternate setting with bandwidth. Devices like video cameras will often have many alternate settings (where many means 6 or 8) with increasing bandwidth needs. That way, the driver can try the largest, and if it fails, fall back until it succeeds. Bulk endpoints do not reserve any bandwidth. They get whatever is left over. Thus, from a bus point of view, there is no purpose in having multiple alternate settings for bulk endpoints. Now, the USB specs do not limit alternate settings for just that purpose. It is certainly possible to use the alternate setting concept as a way to select different "modes" of use for the device, but in my opinion that's less efficient. Every time you change alternate settings, the operating system has to go re-read the descriptors and reconfigure its pipe tables to match the new description. I would judge it better to use a vendor command for that kind of use. Also note that the alternate settings are all exclusive. Only one at a time is active, and all it does is DESCRIBE the current endpoints. The endpoints themselves do not really change. Once you have selected alternate setting 3, you talk to endpoint 2 just by sending commands that talk to endpoint 2. > Why do you have three identical alternate settings? What's the point? > > > This is how I got this device from cypress, I can update the firmware > for it. The Cypress samples are just that: samples. You are expected to create your own device that matches your needs based on the samples. -- Tim Roberts, ti...@pr... Providenza & Boekelheide, Inc. |