Re: CP210x Driver - Issue Enumerating Multiple Interfaces

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

 



I agree.  I think that the line should be removed altogether.
Everything seems to work without it.  I am testing on the CP2105.  The
device's buffers are cleared based upon the settings configured in the
device's memory (some devices have a one-time programmable EPROM;
others have an EEPROM).  They can be configured to flush on open,
close, etc.  The Linux kernel buffers are a different story; I don't
know what happens there, but I'd presume that performing a USB reset
on a serial device is not the norm (i.e. unless firmware has to be
programmed, etc.).

Thanks,

Blake

On Fri, May 16, 2014 at 2:31 PM, Preston Fick <pffick@xxxxxxxxx> wrote:
> This comment and functionality in the cp210x driver has been around since
> the cp2101 was reverse engineered and committed to the kernel originally
> (probably about 8 or 9 years ago). I don't know exactly what the behavior is
> or if the comment is referring to buffers on the host or the device.
>
> I can say that for all other CP210x based drivers (on Windows, OSX and other
> embedded platforms) a USB port reset is *not* required on open for any
> reason. In my opinion removing this line all together would be the best
> patch, although we have not gone through any regression testing yet to prove
> that is the case and I don't know the implications within the Linux kernel
> itself - but from a pure device standpoint it's not necessary.
>
> Kind Regards -
> Preston
>
>
> On Thu, May 15, 2014 at 5:53 PM, Miner, Blake <bminer@xxxxxxxxxxxxxxxx>
> wrote:
>>
>> After debugging further, I figured out what was causing the problem.
>>
>> In the driver for the cp210x, there is a line of code in the `.attach`
>> function that calls `usb_reset_device(serial->dev);`.  See the source
>> code here:
>> https://github.com/torvalds/linux/blob/master/drivers/usb/serial/cp210x.c#L859
>>
>> This call to `usb_reset_device` causes the device to be reset just
>> before the second interface is detected.  For whatever reason, the
>> reset prevents the second interface from being created in `/dev/`.
>>
>> By simply removing this line, both interfaces are properly detected
>> the first time.  Unfortunately, there is a comment above this line
>> that reads "/* cp210x buffers behave strangely unless device is reset
>> */"  Therefore, this reset might actually be necessary in order to
>> clear the buffers of the CP210x.  In this case, when is the
>> appropriate time to perform a device reset so that both interfaces are
>> properly detected?
>>
>> Thanks,
>>
>> Blake
>> --
>> 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
>
>
--
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