On Tue, Jun 14, 2011 at 7:41 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > On Tue, 14 Jun 2011, Amit Nagal wrote: > >> Hi , >> >> >> How can a usb host disconnect a usb device without unplug of usb cable ? > > What exactly do you mean by "disconnect"? > by disconnect i mean whether , under software control , it is possible for a usb host to electronically disconnect a device though both remain plugged over usb . Basically programatic equivalent of plug / unplug cycle is desired on host side . >> for eg i mean something similar to usb_gadget_disconnect() api >> available on gadget side . > > That API causes the gadget to remove its terminations and pullup > resistors from the bus data lines. Nothing the host does can cause > that to happen. > ya , so using usb_gadget_disconnect() api , a gadget can do a software controlled disconnect from usb host . i just used it as example though it is on gadget side . so similarly , is there any api() available on host side , so that a host can do a software controlled disconnect to a gadget ? again , on gadget side , we have usb_gadget_connect() api , using which a gadget can do a software controlled connect to a usb host . but it is on gadget side . so similarly , is there any api() available on host side , so that a host can connect a gadget under software control ? > >> is it possible to do entirely in software or support from hardware >> also is required ? > i repeat above question here . > >> what interfaces in userspace or kernel can be used if possible ? > > There's the /sys/bus/usb/devices/.../remove attribute file. Writing to > this file is roughly equivalent to pressing the "Safely remove > hardware" button in Windows. But it isn't like physically unplugging > the USB cable. > Thanx for the information . So software controlled unplug can be done from host side . Can we have replug functionality somehow from host side ? i also elaborate my need here : 1) In one of my embedded targets , host and device are hardwired over usb . so i want to have programtic equivalent of unplug/plug cycle in usb host to check connect / disconnect functionality and without using rmmod usb modules on host side . Also i donot have control over gadget side . 2) i want usb host to reenumerate the device . Regards Amit Nagal -- 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