Re: the problem with general serail gadget driver when re-connect usb cable

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

 



Thanks for taking time to reply!
On Fri, Apr 15, 2011 at 4:09 AM, Greg KH <greg@xxxxxxxxx> wrote:
> On Thu, Apr 14, 2011 at 01:48:46PM +0800, yingchun li wrote:
>> Hi,
>>      I have a mobile device, and using USB general serial driver to
>> put some log to PC.
>
> Ick, don't use that driver for any "real" work.  What type of device is
> this really?  We should use the real driver for it.
In fact, the device is an android device, and there are some gadget function
in it. I need one serial to get log data from modem and send them to PC,and
cannot use the ACM serial (need 3 endpoints)provide by android driver,
for my UDC
only has few endpoints.

>> In user space, there is an APP reading from pipe and writing log data
>> to serial continually.
>>     when I start the APP, then insert the usb cable,  I can see the
>> log data sent to PC continually.
>> but if I remove the cable, and reconnect it again, the APP is block in
>> the write function, and
>> cannot send data to PC anymore.
>>    following is  main logic of APP,
>>
>>    open pipe,
>>    open usb serial(/dev/ttyGS0)
>>
>>  for (;;) {
>>    read from pipe
>>    write to serial(with block mode)
>>    if write error (that means receive serial disconnect signal, and
>> write I/O error)
>>     close serial
>>     open serial again
>> }
>>
>> so, could anyone give me some advice? your any feedback is appreciate.
>
> Are you using the tty interface properly?  What happens when your
> application gets the hangup signal?

when the application get hangup signal, now I do nothing. the write operation
will return IO error, and I close the serial and reopen it again, and continue
write, here I think write will blocked and run again when cable connect.
> Does it disconnect and reconnect to
> the new device that shows up when the device is plugged in?

the device name is always /dev/ttyGS0 in gadget mode, in PC, the device
name changed accordingly, sometimes /dev/ttyUSB0, sometimes /dev/ttyUSB1,
and I am sure I connect the plugged device

> thanks,
>
> greg k-h
>
--
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