public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Which interface: sysfs, proc, devfs?
@ 2004-01-29 21:28 Jonas Diemer
  2004-01-29 23:02 ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Jonas Diemer @ 2004-01-29 21:28 UTC (permalink / raw)
  To: linux-kernel

Hi!

I am writing a driver for an usb microcontroller (ezusb), which will be
used for measuring and controlling. I am confused on which interface to
use though. The driver is for kernel 2.6.x. 
I want to send small (human readable) commends as well as data (e.g.
firmware) to the device. Which filesystem is appropriate?

regards

Jonas

PS: Please CC me in replies, I am not subscribed to the list.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Which interface: sysfs, proc, devfs?
  2004-01-29 21:28 Which interface: sysfs, proc, devfs? Jonas Diemer
@ 2004-01-29 23:02 ` Greg KH
  2004-01-30  9:54   ` Jonas Diemer
  2004-02-01 20:57   ` Jonas Diemer
  0 siblings, 2 replies; 9+ messages in thread
From: Greg KH @ 2004-01-29 23:02 UTC (permalink / raw)
  To: Jonas Diemer; +Cc: linux-kernel

On Thu, Jan 29, 2004 at 10:28:13PM +0100, Jonas Diemer wrote:
> Hi!
> 
> I am writing a driver for an usb microcontroller (ezusb), which will be
> used for measuring and controlling. I am confused on which interface to
> use though. The driver is for kernel 2.6.x. 
> I want to send small (human readable) commends as well as data (e.g.
> firmware) to the device. Which filesystem is appropriate?

What about not writing a kernel driver at all and just using
libusb/usbfs?  Any reason you have to have a kernel driver for your
device?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Which interface: sysfs, proc, devfs?
  2004-01-29 23:02 ` Greg KH
@ 2004-01-30  9:54   ` Jonas Diemer
  2004-02-01 20:57   ` Jonas Diemer
  1 sibling, 0 replies; 9+ messages in thread
From: Jonas Diemer @ 2004-01-30  9:54 UTC (permalink / raw)
  Cc: linux-kernel

On Thu, 29 Jan 2004 15:02:50 -0800
Greg KH <greg@kroah.com> wrote:

> What about not writing a kernel driver at all and just using
> libusb/usbfs?  Any reason you have to have a kernel driver for your
> device?

Well, didn't think about that, but it indeed seems more logical. Thanks
for the hint.

regards
Jonas

PS: CC me in replies, please

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Which interface: sysfs, proc, devfs?
  2004-01-29 23:02 ` Greg KH
  2004-01-30  9:54   ` Jonas Diemer
@ 2004-02-01 20:57   ` Jonas Diemer
  2004-02-01 21:28     ` Greg KH
  1 sibling, 1 reply; 9+ messages in thread
From: Jonas Diemer @ 2004-02-01 20:57 UTC (permalink / raw)
  Cc: linux-kernel

On Thu, 29 Jan 2004 15:02:50 -0800
Greg KH <greg@kroah.com> wrote:

> What about not writing a kernel driver at all and just using
> libusb/usbfs?  Any reason you have to have a kernel driver for your
> device?


Well, I have just looked into libusb 0.1.x... I would like to have
asynchronous (non-blocking) access to my device, which libusb doesn't
currently support. Also I don't like the way libusb finds devices -
manually scanning all busses doesn't seem very handy.

Thus I will probably go for a kernel module, using sysfs to interface
with the user. Thanks for all the help anyways-

regards
Jonas

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Which interface: sysfs, proc, devfs?
  2004-02-01 20:57   ` Jonas Diemer
@ 2004-02-01 21:28     ` Greg KH
  2004-02-01 22:00       ` Jonas Diemer
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2004-02-01 21:28 UTC (permalink / raw)
  To: Jonas Diemer; +Cc: linux-kernel

On Sun, Feb 01, 2004 at 09:57:21PM +0100, Jonas Diemer wrote:
> On Thu, 29 Jan 2004 15:02:50 -0800
> Greg KH <greg@kroah.com> wrote:
> 
> > What about not writing a kernel driver at all and just using
> > libusb/usbfs?  Any reason you have to have a kernel driver for your
> > device?
> 
> 
> Well, I have just looked into libusb 0.1.x... I would like to have
> asynchronous (non-blocking) access to my device, which libusb doesn't
> currently support.

You mean "submit a urb and be notified when it was completed?"  I
thought libusb supported that with signals.

> Also I don't like the way libusb finds devices - manually scanning all
> busses doesn't seem very handy.

What other way can a userspace library do this?  It doesn't take very
long at all, what is the problem with this?

> Thus I will probably go for a kernel module, using sysfs to interface
> with the user. Thanks for all the help anyways-

Remember that sysfs is "1 value per file".  If that works for your
device, then I suggest you look at the usbled driver, as that is a tiny
usb driver that only uses sysfs.  Nothing like a 4kb kernel driver :)

Good luck,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Which interface: sysfs, proc, devfs?
  2004-02-01 21:28     ` Greg KH
@ 2004-02-01 22:00       ` Jonas Diemer
  2004-02-02  3:25         ` Greg KH
  0 siblings, 1 reply; 9+ messages in thread
From: Jonas Diemer @ 2004-02-01 22:00 UTC (permalink / raw)
  Cc: linux-kernel

On Sun, 1 Feb 2004 13:28:03 -0800
Greg KH <greg@kroah.com> wrote:

> You mean "submit a urb and be notified when it was completed?"  I
> thought libusb supported that with signals.

Yeah, thats what I meant. In the html doc shipped with version 0.1.7,
it says "all functions in libusb v0.1 are synchronous, meaning the
functions block and wait for the operation to finish or timeout before
returning execution to the calling application. Asynchronous operation
will be supported in v1.0, but not v0.1."...


> What other way can a userspace library do this?  It doesn't take very
> long at all, what is the problem with this?

Well, I would have liked a lib-function like 
find_device(int vend_id,int prod_id);
but thats really not a big deal.

> Remember that sysfs is "1 value per file".  If that works for your
> device, then I suggest you look at the usbled driver, as that is a
> tiny usb driver that only uses sysfs.  Nothing like a 4kb kernel
> driver :)

Thanks for that hint, I'll have a look at it. I only need 1 val per
file, i.e. a "firmware" file, which I learned is best done with the
firmware_class.

>Good luck
Thanks

regards
Jonas

PS: CC me in replies, please.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Which interface: sysfs, proc, devfs?
  2004-02-01 22:00       ` Jonas Diemer
@ 2004-02-02  3:25         ` Greg KH
  2004-02-02  6:59           ` Jonas Diemer
  0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2004-02-02  3:25 UTC (permalink / raw)
  To: Jonas Diemer; +Cc: linux-kernel

On Sun, Feb 01, 2004 at 11:00:10PM +0100, Jonas Diemer wrote:
> On Sun, 1 Feb 2004 13:28:03 -0800
> Greg KH <greg@kroah.com> wrote:
> 
> > You mean "submit a urb and be notified when it was completed?"  I
> > thought libusb supported that with signals.
> 
> Yeah, thats what I meant. In the html doc shipped with version 0.1.7,
> it says "all functions in libusb v0.1 are synchronous, meaning the
> functions block and wait for the operation to finish or timeout before
> returning execution to the calling application. Asynchronous operation
> will be supported in v1.0, but not v0.1."...

Yet you want to do asynchronous support with sysfs?  How would that
work?

What kind of device are you writing a driver for?

> Thanks for that hint, I'll have a look at it. I only need 1 val per
> file, i.e. a "firmware" file, which I learned is best done with the
> firmware_class.

For firmware only download type devices, I'd really recommend sticking
with libusb, unless you have to.  It's much easier that way.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Which interface: sysfs, proc, devfs?
  2004-02-02  3:25         ` Greg KH
@ 2004-02-02  6:59           ` Jonas Diemer
  2004-02-02  7:50             ` Duncan Sands
  0 siblings, 1 reply; 9+ messages in thread
From: Jonas Diemer @ 2004-02-02  6:59 UTC (permalink / raw)
  Cc: linux-kernel

On Sun, 1 Feb 2004 19:25:14 -0800
Greg KH <greg@kroah.com> wrote:

> Yet you want to do asynchronous support with sysfs?  How would that
> work?
> What kind of device are you writing a driver for?

It is not firmware uploading only. Once the firmware is uploaded, I will
communicate with that device. It is a ezusb microcontroller controlling
several relais, adc and dac.


> For firmware only download type devices, I'd really recommend sticking
> with libusb, unless you have to.  It's much easier that way.

Yepp, there's already a tool using libusb (fx2 programmer) for my chip
which I indeed would use if I only wanted to download the firmware... 

regards
Jonas

PS: CC me.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Which interface: sysfs, proc, devfs?
  2004-02-02  6:59           ` Jonas Diemer
@ 2004-02-02  7:50             ` Duncan Sands
  0 siblings, 0 replies; 9+ messages in thread
From: Duncan Sands @ 2004-02-02  7:50 UTC (permalink / raw)
  To: Jonas Diemer; +Cc: linux-kernel

> Greg KH <greg@kroah.com> wrote:
> > Yet you want to do asynchronous support with sysfs?  How would that
> > work?
> > What kind of device are you writing a driver for?
>
> It is not firmware uploading only. Once the firmware is uploaded, I will
> communicate with that device. It is a ezusb microcontroller controlling
> several relais, adc and dac.

usbfs certainly supports asynchronous communication (sending an urb
and picking up the result at some convenient later time).  I don't know if
libusb supports it, but in any case it is easy to use usbfs directly.

Duncan.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2004-02-02  7:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-29 21:28 Which interface: sysfs, proc, devfs? Jonas Diemer
2004-01-29 23:02 ` Greg KH
2004-01-30  9:54   ` Jonas Diemer
2004-02-01 20:57   ` Jonas Diemer
2004-02-01 21:28     ` Greg KH
2004-02-01 22:00       ` Jonas Diemer
2004-02-02  3:25         ` Greg KH
2004-02-02  6:59           ` Jonas Diemer
2004-02-02  7:50             ` Duncan Sands

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox