Re: Gadget serial and cable detection (in user mode)

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

 



On Mon, 23 Nov 2009, Thomas Søhus wrote:

> Dear experts,
> 
> I am currently working on a project using the Gadget serial driver, and is
> having some issues coping with cable removal. I need to stop my data
> transmission (when the host disconnects) and restart it when the host
> connects again. I would expect that you can get some sort of event from the
> Gadget driver when the host is connected/disconnected, but was not able to
> find any info on that.
> 
> What I would ultimately like to accomplish:
> 1. Receive events on cable insertion/removal (Host connect/disconnect).

In theory events could be generated for connect and disconnect.  
However none of the device controller drivers or gadget drivers does 
so.

> 2. Receive events when the host is ready to receive data (the Port is opened
> on the host PC).

There is no way to find out when this happens.  The host doesn't tell 
the device when the port is opened or closed.

> Is it possible to receive such events in user mode from the Gadget stack or
> the USB sub-system?
> If not could you provide some advice on possible workaround to solve my
> problem?

You could modify the composite_disconnect() routine in composite.c to 
provide some notification when a disconnection occurs.  You could even 
make a similar change to composite_setup() to create an event the first 
time a control request is received following a disconnect -- that would 
correspond to a connection.

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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux