On Fri, 24 Aug 2012, Lan Tianyu wrote: > >> But if other places got hub descriptor, they can't get DeviceRemovable > >> value since we only set DeviceRemovable in the hub_configure().(e.g lsusb). Note: This isn't true. You now set desc->u.hs.DeviceRemovable in ehci_hub_descriptor(). > > I don't understand. lsusb will be able to see the DeviceRemovable > > values in sysfs, won't it? > lsusb will issue get hub descriptor request in the usr space and print > DeviceRemovable. Sure, that's right. But that's not what I was complaining about -- I was complaining about the fact the you want to call get_hub_descriptor() twice. > So if we put setting DeviceRemovable in the hcd's hub descriptor request > routine, usr space could also get acpi information via getting hub > descriptor and we don't need to expose DeviceRemovable sysfs file. Userspace doesn't use get_hub_descriptor() (it calls usb_control_msg() directly). Therefore you don't need to set any DeviceRemovable information in that routine. > >> Another problem is that some hcds will set DeviceRemovable themselves. > >> There will be a conflict between hcd and acpi information. Different > >> hcds may have different processes. > > > > There is always the possibility of a conflict. This remains true > > whether you get the hub descriptor once or twice. > Yeah. how to deal with conflict > First time of getting the hub descriptor is to initialize hub and create > port devices. The second time is to update DeviceRemovable after > port devices create. Look, I can't tell exactly what's going on here because I can't see your code. It isn't present in any trees that I have access to, and I can't see what's going on by trying to read multiple patches spread over several email threads. The simple fact is, get_hub_descriptor() is the wrong place to do anything related to ports. Furthermore, I don't see why you need to update hub->descriptor->u.hs.DeviceRemovable at all. The value returned by hub_configure() the first time will be correct; there's no reason to call get_hub_descriptor() a second time. > Another proposal is to set DeviceRemovable both in the hcd driver and > hub_configue() since hub probe maybe a special case. We have to get port > number first and then create port devices. Does this make sense? As of this latest patch, you _do_ set desc->u.hs.DeviceRemovable in ehci-hcd. This means you don't need to set hub->descriptor->u.hs.DeviceRemovable in hub_configure(), because it will use the value returned by ehci-hcd. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html