Greg KH wrote:
On Fri, Feb 28, 2003 at 02:46:45PM -0800, David Brownell wrote:


+/* the chapter 9 device states */ + +enum usb_device_state { + USB_STATE_ATTACHED = 0, /* "only" attached */ + USB_STATE_POWERED, + USB_STATE_DEFAULT, /* limited function */ + USB_STATE_ADDRESS, + USB_STATE_CONFIGURED, /* most functions */ + USB_STATE_SUSPENDED +};


Hm, if you read Table 9-1, the states can not be represented as a enum,
but need to be a bitmask (you can be attached, powered, and suspended at
the same time.)   We've lived until now without these states, what does
it buy us to add them now?

Actually if you go by Figure 9-1 instead, it's clearer: SUSPENDED is actually four different states, labeled as one! Likely so that the explanations (packaged in Table 9-1) all fit onto the next page. All the other states have reasonably clean explanations.

But the host side can't track SUSPENDED reasonably anyway, and does
not need to.  It's the other states that are interesting.  I agree
that if we wanted to do anything with SUSPENDED it'd need thought.

Why add them now?  So that we can finally start finding/fixing
some of the wierdness in the reconfig/reset/enumeration paths,
making some of the "hidden in code flow" rules more concrete.
Plus, no point in making gadget side code have its on versions
of these constants.



+       /* mark the device as inactive, so any further urb submissions for
+        * this device will fail.  "attached" is the initial state for usb,
+        * it includes "not attached" (no device signaling).
+        */
+       dev->state = USB_STATE_ATTACHED;
+


No, that's just crazy.  We can't say the device is attached, as it is
plainly gone from the system.  Either make a new state, or just live
without the state issues, and leave the present flag.  Don't overload
the attached state for two different meanings.

I was exactly following the USB spec here. RMK added a nonstandard state called NOTATTACHED ... IMO a better fix would be to just rename rename the state, that's what makes everyone (me too!) scratch their heads. USB_STATE_INITIAL or USB_STATE_INACTIVE would be clearer.

That one really is just one state ... it's just badly named because
whoever wrote that bit of the spec was trying to be too clever.

- Dave



thanks,


greg k-h







-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to