Bonescript theory question

Say I create a node.js script in my browser and send the compiled script over usb to the BBB.

From a high-level programming side, how is the data stream from usb processed on the board? What applications/files are utilized to get the data to perform a task (like turn on a gpio)? How does the input interact with the linux os? Does this require webserver httprequests on the BBB side or is it processed another way such as non-http shell scripts or maybe without the linux system at all? (I assume not)

The goal of my question is to understand the difference between the mechanics of using bonescript with BBB as opposed to SSHing files into the file system.

THANKS!

What you’re asking is more of a cloud9 question than bonescript. But if you’re seeking more information on bonescript too . . .

https://github.com/jadonk/bonescript read the readme.md

, as for the rest you’d have to ask someone who is knowledgeable with cloud9.

For what it’s worth, I’ve kind of wondered about much of what you’re asking too. But I’ve otherwise spent my time doing other things that are more important to me. Such as using C to do similar things. My reasoning was simple. C( native executables ) are faster, and takes up a hell of a lot less space than Node.js . . . So if I had to learn something, I may as well learn the “better” way.

Node.js + express + npm takes up ~60M of disk space. My C application which essentially does the same thing - Well more exactly exactly what I need to do. Does not take up 1M . . . steeper learning curve though.

Say I create a node.js script in my browser and send the compiled script over usb to the BBB.

From a high-level programming side, how is the data stream from usb processed on the board?

The USB client port runs a composite gadget driver making it look to the host computer like a serial port, storage device and network adapter. The network adapter driver is the one used for access. It seems to the host like it has a network adapter and the BeagleBone has another one and that they are connected on the network. The BeagleBone hard-fixes its network address as 192.168.7.2 and offers up 192.168.7.1 to the host using DHCP. The result is you can talk between the two computers just like over Ethernet or WiFi.

What applications/files are utilized to get the data to perform a task (like turn on a gpio)? How does the input interact with the linux os? Does this require webserver httprequests on the BBB side or is it processed another way such as non-http shell scripts or maybe without the linux system at all? (I assume not)

BoneScript is just a JavaScript library and, while it is possible to utilize node.js modules to access Linux system calls, it instead will generally just use the SYSFS interfaces, when available. For I2C, node-i2c is used.

The BoneScript web server sits on top of the BoneScript library and utilizes socket.io to create remote procedure calls to the functions running on the web server. Essentially, the web server will call the same functions locally on the board that you could call if you were running a node.js application, ‘required’ the BoneScript library and made the calls locally.

The goal of my question is to understand the difference between the mechanics of using bonescript with BBB as opposed to SSHing files into the file system.

BoneScript can be used either locally by using node.js and reading in the library or embedded into any web page by utilizing the web server that is running on the BeagleBone by default. Utilizing the web server isn’t very secure, but it can make doing quick demos really easy. The goal is to show just how easy it can be to integrate I/O elements into a web page.

If you run scripts local to the board, you can use the BoneScript library on node.js, but you can also use one of the Python, C/C++, Ruby, Go, or dozens of other libraries that either use the Linux interfaces or mmap the peripheral control registers.