Re: Proposed patch for cp210x: GPIO and USB descriptor control

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

 



On Thursday 20 May 2010 04:58:18 pm Greg KH wrote:
> On Thu, May 20, 2010 at 03:07:59PM -0700, Matthew Dharm wrote:
> > On Thu, May 20, 2010 at 03:10:42PM -0600, Steve McKown wrote:
> > > On Thursday 20 May 2010 09:48:29 am Greg KH wrote:
> > > Yes; I'm sorry I haven't been clear on this point.  We have our own
> > > hardware designs incorporating a cp210x.  Each unit built needs its
> > > cp210x configured: descriptors and port configuration.  I worked with
> > > SiLabs to glean enough information so I could add this functionality to
> > > the linux driver, since we don't use Windows in our shop.  Of course,
> > > no user needs these features, and their post-mfg use would almost
> > > certainly prevent the device from operating properly.
> > >
> > > What are going to be the sticking points to adding such features to the
> > > driver?  Based on our discussions thus far, I'm thinking that
> > > communicating this information via sysfs using packed structures with
> > > CRC might be the way to go.  The binary structure would prevent the
> > > casual user from doing something like:
> > > 	echo 1234 | sudo tee /sys/blah/blah/VID
> > > but the programmatic interface would still be pretty clean.
> > >
> > > A companion userspace library for mfg use would provide a lib and
> > > sample program for setting descriptors and configurations via sysfs.
> > >
> > > Does this pass conceptual muster?
> >
> > Seems overly complicated.  What's wrong with:
> >
> >  	echo 1 | sudo tee /sys/blah/blah/unlock
> >  	cat binfile | sudo tee /sys/blah/blah/configuration
> >  	echo 0 | sudo tee /sys/blah/blah/unlock
> >
> > Of course, hopefully "cat /sys/blah/blah/configuration" would give you
> > back the same binfile you used for programming purposes.
>
> That would work well.

Nice!  I think the data written to /sys/blah/blah/configuration should have a 
magic string at the beginning and a CRC field at the end, so the driver can 
validate the input.  This would prevent accidental writing of bad data to the 
cp210x, and perhaps mitigate the need for the lock/unlock files.

Greg, is there a usbserial, or usb, driver that would act as a good model for 
managing a companion sysfs interface (code and /sys tree structure)?

Matt,
> We use the default descriptors, but my understanding is that you're
> basically just programming an internal EEPROM, right?
Yes.  And it's _very_ nice to be able to write the iProduct and iSerialNumber 
descriptor fields.


All the best,
Steve
--
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