Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write device drivers in Javascript?

Is it possible to write hardware drivers in Javascript? What would be the steps required for such a task?

Also, I was unsure where to post this, so any suggestions regarding this are also welcome. I hope this is the accurate location for the question.

like image 476
Leila Hamon Avatar asked Aug 22 '12 17:08

Leila Hamon


People also ask

What are drivers in JavaScript?

The JavaScript driver is a very powerful library that provides access to 100% of the capabilities of Cloud CMS from a programmatic perspective.

What language is used to write device drivers?

Device drivers are typically written in C, using the Driver Development Kit (DDK). There are functional and object-oriented ways to program drivers, depending on the language chosen to write in. It is generally not possible to program a driver in Visual Basic or other high-level languages.


3 Answers

No. Not really. I mean, you sort of could by writing something that compiles Javascript into C, but that would be pretty crazy. Bit like trying to use a spoon as a chainsaw.

Learn C. That is the right tool for the job.

like image 166
Rich Bradshaw Avatar answered Sep 18 '22 13:09

Rich Bradshaw


Oh, gosh. Writing a driver in js? Why? I mean, you could write a javascript wrapper for something in C or C++, maybe, but why would you want to do that? Device drivers communicate with the machine at a fairly low level (hardware level). Javascript doesn't. Javascript is a web language (well, mostly).

As Rich Bradshaw said, it's like using a spoon as a chainsaw. Though to me it'd be more like trying to use a canoe as a tank.

like image 29
Phillip Schmidt Avatar answered Sep 20 '22 13:09

Phillip Schmidt


Wow, this idea is non-sense, IMHO you pick a programming language to solve a problem or task and not the other way around. I work with device drivers and OS kernel related stuff, but just because I can program in C I don't use C to do other task such as Linux administration for my embedded device; instead, I use something high level such as Bash, Perl or Python (depending on my mood :)).

Why are you interested in js? Actually, you should understand the internals of the programming language to know what are you trying to achieve and also you need to know how you program will interact with you OS to communicate with device registers and interrupts among other things.

like image 28
Mr_GQ Avatar answered Sep 21 '22 13:09

Mr_GQ