Live data from Hacker News

Writing a basic Linux device driver when you know nothing about Linux drivers

crescentro.se

61–70 of 72 posts

Re: Writing a basic Linux device driver when you know nothing about Linux drivers

#61

Earlier quoted context omitted.

I have a solar inveter from a company, aparticular German brand. I wanted to use home assistant with it so I needed rs232 data.. tried the support and they asked me to sign an NDA. Okay, cool. I did with a fake name, address and everything and they sent a file.. Turns out the file is available online. Facepalm pro Max. So my question is, what kind of "IP" is in a data sheet that needs protection ? And this isnt even…

Germans germaning!

Even though there are much fewer lawyers in Germany and they are less involved in running companies (like in any country, compared to the US).

Re: Writing a basic Linux device driver when you know nothing about Linux drivers

#62

> I also thought I’d message the vendor and ask them if they could share any specifications or docs regarding their protocol. To my surprise, Nanoleaf tech support responded to me within 4 hours, with a full description of the protocol that’s used both by the Desk Dock as well as their RGB strips. How cool is that? Too many vendors still think that they have valuable intellectual property in such relative trivialitie…

Or worse, they just reply “Linux is not supported” …

Re: Writing a basic Linux device driver when you know nothing about Linux drivers

#64
post #31

Earlier quoted context omitted.

I have a solar inveter from a company, aparticular German brand. I wanted to use home assistant with it so I needed rs232 data.. tried the support and they asked me to sign an NDA. Okay, cool. I did with a fake name, address and everything and they sent a file.. Turns out the file is available online. Facepalm pro Max. So my question is, what kind of "IP" is in a data sheet that needs protection ? And this isnt even…

Was it Alpha-ESS? they make it so stupidly hard to get your information outside of their smartphone app.

Phocos

Re: Writing a basic Linux device driver when you know nothing about Linux drivers

#66

Earlier quoted context omitted.

Any programming language can be a solution, the programming language itself isn't the problem. Convincing device driver programmers around the world to come up with a universal API that includes all the possible features and works on every OS is. In this case, the cross-platform libusb should make this code work on either Linux or Windows (if you install the signed Windows drivers). If other operating systems port li…

On a previous project I spent a lot of time trying to figure out a 'generic device driver'. That is actually a decently hard space to crack. As each device has randomly different ways of talking. Some are serial/local bus. Some are memory space. Some have a combination. Some systems broadcast data, some you have to query it, some you have to query then wait for the next broadcast. Some systems mildly follow the spec,…

The XKCD is wrong in the microkernel concept since the micro-kernel translates the

NxM problem to N+M.

But I agree, that vendors do not make it easy to foster new OSes.

Re: Writing a basic Linux device driver when you know nothing about Linux drivers

#67

There are many innovative OSes that are killed by the lack of Device Drivers. As a community we must find a way for tackling this issue. Micro-Kernels are a solution where one can run different OSes but they will reuse the same device driver servers. But it requires co-ordination and determination. Rust can be a solution for sure.

Any programming language can be a solution, the programming language itself isn't the problem. Convincing device driver programmers around the world to come up with a universal API that includes all the possible features and works on every OS is. In this case, the cross-platform libusb should make this code work on either Linux or Windows (if you install the signed Windows drivers). If other operating systems port li…

I agree with you on the Universal API. But It cannot cover any case, unfortunately.

But the micro-kernel can help here by translating the NxM problem to N+M by reusing device servers, which can have a universal API and can be written in any native or not programming language.

Now, you can virtualize your OS over the microkernel and re-use the servers. That was the initial dream.

Re: Writing a basic Linux device driver when you know nothing about Linux drivers

#68

Earlier quoted context omitted.

For toy tinkering, to replicate something like the old ability to just write a byte to an IO memory location and have it appear on the pins of a parallel port, you could design a simple USB peripheral that did similar. Give it a set of DIP switches to pick a number (4 for 0-f, more would probably be overkill but feel free) and have the driver present something like /proc/simpleio/device /in and /proc/simpleio/device…

USB parallel ports, data acquisition peripherals, or modern boards that run linux and have GPIO pins are already a thing and don't need to be created. What I'm talking about is a whole computer system + systems programming language + OS which is as simple to understand and program as computers were in the 80s. With modern speedups, without modern layers of abstraction.

Maybe something like Oberon 2?

Re: Writing a basic Linux device driver when you know nothing about Linux drivers

#69

I enjoyed this post, but I'm eager to hear what the next step would be for a real "production" userspace driver. Are these typically just daemons that are configured to run at start up? And then some configuration GUI communicates with it over a socket or something?

Typically production userspace drivers run as daemons (often systemd services) with udev rules to detect device connections, exposing control via D-Bus, sockets, or a custom API that GUI applications consume.

Re: Writing a basic Linux device driver when you know nothing about Linux drivers

#70
Nice article here, really enjoys the explanation. As a web developer, system programming or in this case developing a device driver feels like a different world to me. But, after reading this article, I got the impression that it is not that much different to developing a client to an API in web developer's world.
Post reply on HN