From: Bob Smith <bsmith@linuxtoys.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 001/001] CHAR DRIVERS: a simple device to give daemons a /sys-like interface
Date: Fri, 09 Aug 2013 15:14:10 -0700 [thread overview]
Message-ID: <520569B2.4000704@linuxtoys.org> (raw)
In-Reply-To: <20130807213325.GB5373@kroah.com>
Greg Kroah-Hartman wrote:
(snip)
> You are mixing protocols and bindings and system calls up it seems.> They are not the same at all.
Yes, I may be using the term binding wrong. As I understand it
- We should use a _syscall_ to open a unix socket on the daemon, then
- define a _protocol_ to describe the data flowing over the socket,
- a C _binding_ to present a C API and hide the protocol for C programmers,
- a C++ binding and API for C++ programmers
- a Java binding
- a PHP binding
- a Perl binding
- a Python binding
- a node.js binding
- a Scratch binding for Raspberry Pi users
- and some kind of shell binding for Bash programmers
>
> (snip)
> Again, /sys and /proc is talking to the kernel, not userspace to
> userspace, I still fail to understand how you will do that to create a
> "userspace" driver.
From a kernel developer's point of view the term "userspace driver"
may seem like an oxymoron. By definition, all devices on the system
have to be controlled by the kernel. All else is just userspace.
As an _opinion_ only, I think maybe userspace device drivers do exist.
It refers to hardware that the kernel is not, and should not, be aware
of. This hardware is not seen because it is at the end of some kind of
communications channel like USB-serial or Ethernet. A developer might
like to view that hardware as part of the overall system even if Linux
and the CPU do not have direct access to it. A userspace driver looks
something like this
=(ProxyDevNode)====(daemon)===(CommChannel)===(hardware)
As an engineer, I can see that "userspace driver" might not make sense.
As a marketing guy, I'm super-duper pleased to tell my customers "Yes,
we support Linux. After all, we have Userspace Device Drivers!" :)
>
> (snip)
> How can you control a robot with this code?
> What do you want to do in order to control your robot?
> What are your needs in accessing the hardware?
> What hardware are you wanting to control?
In my message I said I was building a robot. While true, this gives the
erroneous impression that it is just me for just one robot. In fact, I
build and sell FPGA based robot controllers. It is my _customers_ who
build and program the robots.
The descriptions below may be representative of others wanting to have
userspace device drivers even though the descriptions are for my specific
case.
My (hardware) has a Xilinx FPGA with connectors that goes out to eight
peripheral cards. There are about thirty different peripheral cards
available The FPGA has to be programmed for a specific peripheral mix,
but it is pretty easy for a customer to request a new FPGA image for a
new mix of cards. Inside the FPGA the peripherals are controlled by
8-bit registers on an internal address bus.
My (CommChannel) is an FTDI USB-serial interface. The protocol over the
link consists of reads and writes to the 8-bit registers in the FPGA.
Polling is not needed since the FPGA can automatically generate a read
response packet when it needs to.
My (daemon) is passed which serial port to use. It establishes a link
to the FPGA and then asks it for a list of its peripherals. Using this
list it loads a shared object library for each different peripheral.
The init in the library creates the device nodes needed by the driver
(userspace driver, that is). When all the device nodes have been set
up the daemon drops root permissions. The daemon does not need root
permissions if the device nodes are set up in advance.
Once everything is set up the system becomes completely event
driven. Sensor reading are passed from the FPGA through the daemon
and out to the device nodes, and configuration changes are passed
from the device node out to the FPGA.
>
> And why can't you just access that hardware through the normal
> kernel apis we have today?
Because the kernel doesn't even see the hardware I'm controlling.
>
> greg k-h
Greg, sorry this message was so long, and thanks again for your patience.
Bob Smith
next prev parent reply other threads:[~2013-08-09 22:14 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <51FC5478.40500@linuxtoys.org>
2013-08-03 1:19 ` [PATCH 001/001] CHAR DRIVERS: a simple device to give daemons a /sys-like interface Bob Smith
2013-08-03 1:56 ` Joe Perches
2013-08-03 2:35 ` Greg Kroah-Hartman
2013-08-03 18:12 ` Bob Smith
2013-08-03 22:38 ` Greg Kroah-Hartman
2013-08-04 21:54 ` Bob Smith
2013-08-04 23:19 ` Greg Kroah-Hartman
2013-08-05 23:46 ` Bob Smith
2013-08-06 9:46 ` Greg Kroah-Hartman
2013-08-07 19:02 ` Bob Smith
2013-08-07 19:27 ` Greg Kroah-Hartman
2013-08-07 19:39 ` Bob Smith
2013-08-07 19:51 ` Greg Kroah-Hartman
2013-08-07 19:54 ` Greg Kroah-Hartman
2013-08-07 21:04 ` Bob Smith
2013-08-07 21:33 ` Greg Kroah-Hartman
2013-08-08 21:23 ` Bob Smith
2013-08-09 21:52 ` Greg Kroah-Hartman
2013-08-09 22:20 ` Bob Smith
2013-08-09 22:14 ` Bob Smith [this message]
2013-08-09 23:01 ` Greg Kroah-Hartman
2013-08-09 23:35 ` Bob Smith
2013-08-09 23:46 ` Greg Kroah-Hartman
2013-08-10 20:08 ` Bob Smith
2013-08-10 20:29 ` richard -rw- weinberger
2013-08-10 20:49 ` Bob Smith
2013-08-10 21:43 ` Arnd Bergmann
2013-08-10 22:07 ` Bob Smith
2013-08-13 20:15 ` Arnd Bergmann
2013-08-07 21:28 ` Bob Smith
2013-08-07 21:40 ` Greg Kroah-Hartman
2013-08-07 21:53 ` Bob Smith
2013-08-09 21:54 ` Greg Kroah-Hartman
2013-08-09 22:51 ` Bob Smith
2013-08-09 23:04 ` Greg Kroah-Hartman
2013-08-07 21:38 ` Bob Smith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=520569B2.4000704@linuxtoys.org \
--to=bsmith@linuxtoys.org \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox