All of lore.kernel.org
 help / color / mirror / Atom feed
* Userpace serial port
@ 2015-06-10 12:39 Ricardo Ribalda Delgado
  2015-06-11  3:52 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-06-10 12:39 UTC (permalink / raw)
  To: kernelnewbies

Hello

I have a serial port accesible via Ehtercat.
http://www.beckhoff.dk/english.asp?ethercat/el6001.htm

Ethercat is a fancy way of accessing i/o devices via ethernet. You can
read/write registers with close to real-time restrictions.

Nowadays there is a kernel land implementation of ethercat master, but
it is not merged (and it is definately not an easy job). And a
software implementation http://fh-soft.de/src/ethercat-userspace.html

My hope is that there is something like uinput, but for serial
devices,i.e. I make a userland program that looks like a normal serial
device to the other applications.

Does this exist?

Regards!


-- 
Ricardo Ribalda

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

* Userpace serial port
  2015-06-10 12:39 Userpace serial port Ricardo Ribalda Delgado
@ 2015-06-11  3:52 ` Greg KH
  2015-06-11  6:39   ` Ricardo Ribalda Delgado
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2015-06-11  3:52 UTC (permalink / raw)
  To: kernelnewbies

On Wed, Jun 10, 2015 at 02:39:35PM +0200, Ricardo Ribalda Delgado wrote:
> Hello
> 
> I have a serial port accesible via Ehtercat.
> http://www.beckhoff.dk/english.asp?ethercat/el6001.htm
> 
> Ethercat is a fancy way of accessing i/o devices via ethernet. You can
> read/write registers with close to real-time restrictions.
> 
> Nowadays there is a kernel land implementation of ethercat master, but
> it is not merged (and it is definately not an easy job). And a
> software implementation http://fh-soft.de/src/ethercat-userspace.html

Why not attempt to merge it?

> My hope is that there is something like uinput, but for serial
> devices,i.e. I make a userland program that looks like a normal serial
> device to the other applications.

A serial device that does what exactly?  What's wrong with the "normal"
serial userspace api the kernel provides?

thanks,

greg k-h

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

* Userpace serial port
  2015-06-11  3:52 ` Greg KH
@ 2015-06-11  6:39   ` Ricardo Ribalda Delgado
  2015-06-11  8:20     ` Bjørn Mork
  2015-06-11 14:31     ` Greg KH
  0 siblings, 2 replies; 6+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-06-11  6:39 UTC (permalink / raw)
  To: kernelnewbies

Hello Greg

On Thu, Jun 11, 2015 at 5:52 AM, Greg KH <greg@kroah.com> wrote:
> On Wed, Jun 10, 2015 at 02:39:35PM +0200, Ricardo Ribalda Delgado wrote:

>> Nowadays there is a kernel land implementation of ethercat master, but
>> it is not merged (and it is definately not an easy job). And a
>> software implementation http://fh-soft.de/src/ethercat-userspace.html
>
> Why not attempt to merge it?

I have my doubts that this is the best option. If you need real time
performance you need to run it in kernel-space where you need a
ethercat protocol driver, a patch for your network card and an kernel
module for your application.

Without strict real-time requirements, you just need a userspace
library and a userspace application

By looking at our applications, The userspace sollution is more than
enough for our requirements.

The problem appears when we want to use the serial adapter.  I want to
keep using the serial API, but I cannot achieve this from userspace.

>
>> My hope is that there is something like uinput, but for serial
>> devices,i.e. I make a userland program that looks like a normal serial
>> device to the other applications.
>
> A serial device that does what exactly?  What's wrong with the "normal"
> serial userspace api the kernel provides?

I want to use the serial userspace api. But I do not want to write a
kernel module. I really like the design of uinput, and I would like to
use something similar here.

>
> thanks,
>
> greg k-h



-- 
Ricardo Ribalda

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

* Userpace serial port
  2015-06-11  6:39   ` Ricardo Ribalda Delgado
@ 2015-06-11  8:20     ` Bjørn Mork
  2015-06-11 14:31     ` Greg KH
  1 sibling, 0 replies; 6+ messages in thread
From: Bjørn Mork @ 2015-06-11  8:20 UTC (permalink / raw)
  To: kernelnewbies

Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> writes:

> I want to use the serial userspace api. But I do not want to write a
> kernel module. I really like the design of uinput, and I would like to
> use something similar here.

Do you need the modem control lines, or would a pty be good enough for
your use case?

If you need more than that, then you could probably do a complete serial
driver using CUSE. But you would have to copy a lot of kernel code to
userspace.  It is much easier to just write a kernel driver.


Bj?rn

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

* Userpace serial port
  2015-06-11  6:39   ` Ricardo Ribalda Delgado
  2015-06-11  8:20     ` Bjørn Mork
@ 2015-06-11 14:31     ` Greg KH
  2015-06-11 15:16       ` Ricardo Ribalda Delgado
  1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2015-06-11 14:31 UTC (permalink / raw)
  To: kernelnewbies

On Thu, Jun 11, 2015 at 08:39:39AM +0200, Ricardo Ribalda Delgado wrote:
> Hello Greg
> 
> On Thu, Jun 11, 2015 at 5:52 AM, Greg KH <greg@kroah.com> wrote:
> > On Wed, Jun 10, 2015 at 02:39:35PM +0200, Ricardo Ribalda Delgado wrote:
> 
> >> Nowadays there is a kernel land implementation of ethercat master, but
> >> it is not merged (and it is definately not an easy job). And a
> >> software implementation http://fh-soft.de/src/ethercat-userspace.html
> >
> > Why not attempt to merge it?
> 
> I have my doubts that this is the best option. If you need real time
> performance you need to run it in kernel-space where you need a
> ethercat protocol driver, a patch for your network card and an kernel
> module for your application.

real-time performance does not mean it has to be in the kernel at all.

And almost no one needs "real" real-time performance, that's a horrible
check-box that people love to claim is needed and yet, almost no one
really needs in the end.

> By looking at our applications, The userspace sollution is more than
> enough for our requirements.
> 
> The problem appears when we want to use the serial adapter.  I want to
> keep using the serial API, but I cannot achieve this from userspace.

I don't understand what type of API you are talking about here.  What
exactly does ethercat do?  What are you doing that does not work today
from userspace with the existing serial apis?

thanks,

greg k-h

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

* Userpace serial port
  2015-06-11 14:31     ` Greg KH
@ 2015-06-11 15:16       ` Ricardo Ribalda Delgado
  0 siblings, 0 replies; 6+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-06-11 15:16 UTC (permalink / raw)
  To: kernelnewbies

Hello Greg

On Thu, Jun 11, 2015 at 4:31 PM, Greg KH <greg@kroah.com> wrote:
>
> real-time performance does not mean it has to be in the kernel at all.
>
> And almost no one needs "real" real-time performance, that's a horrible
> check-box that people love to claim is needed and yet, almost no one
> really needs in the end.
>

Agree, I do NOT need real time performace, in fact I can tolerate
msecs of jitter.

This is why I want to have a userland application

>> By looking at our applications, The userspace sollution is more than
>> enough for our requirements.
>>
>> The problem appears when we want to use the serial adapter.  I want to
>> keep using the serial API, but I cannot achieve this from userspace.
>
> I don't understand what type of API you are talking about here.  What
> exactly does ethercat do?  What are you doing that does not work today
> from userspace with the existing serial apis?


Ehtercat is an industrial protocol that runs over ethernet.

In a normal setup, there is one master and multiple slaves. Master is
generally a PC, and the slaves are GPIO boards, serial ports, CAN
bridges....

Ethercat is quite a complex protocol, it has a shared clock, device
discovery.... So before you can read/write a register at a slave you
end up with thousands of lines of code.


What I want to do, is access a ethercat slave serial port like a
"normal" serial port in my computer (/dev/ttyS0, /dev/ttyUSB0,
/dev/ttyUL0....) That way any application can use the serial port with
no modification.

The common approach would be to create a serial port kernel module,
but because it is such a complicated protocol I rather handle it in
userland (same idea as uinput, but for serial ports)


I am now taking a look to Bj?rn suggestion about using a pty, and
looks very promising.

Thanks!


-- 
Ricardo Ribalda

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

end of thread, other threads:[~2015-06-11 15:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-10 12:39 Userpace serial port Ricardo Ribalda Delgado
2015-06-11  3:52 ` Greg KH
2015-06-11  6:39   ` Ricardo Ribalda Delgado
2015-06-11  8:20     ` Bjørn Mork
2015-06-11 14:31     ` Greg KH
2015-06-11 15:16       ` Ricardo Ribalda Delgado

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.