theoctal / octalbonescript

A more stable, continuously tested and better node.js library for scripting your BeagleBone
MIT License
57 stars 9 forks source link

Compatible with kernels > 3.8 ? #41

Closed doganyazar closed 8 years ago

doganyazar commented 9 years ago

Hello, Does this library work with newer kernels with the latest changes in device tree overlays? With kernel 4.1 cape manager is supported again so is it possible to use this library with the latest kernel?

adityapatadia commented 9 years ago

Hi, I never checked 4.1 kernel. If cape manager is supported then it should work fine. It might also need some modifications if pin configuration is changed.

You can try and post error if you encounter any.

doganyazar commented 9 years ago

Made a quick try now does not work out of the box.

debian@dodo4:~/octaldene$ sudo DEBUG='*' node try.js bone is_ocp() = null +0ms Error reading directory null bone is_cape_universal() = null +43ms bone Loading Universal Cape interface... +5ms bone create_dt_sync(OBS_UNIV,,) +11ms bone onDTBOExists() +7ms bone load_dt_sync(OBS_UNIV) +13ms bone onFindCapeMgr: path = null +4ms

/home/debian/octaldene/node_modules/octalbonescript/lib/bone.js:230 throw new verror(err, 'Unable to read from CapeMgr slots'); ^ VError: Unable to read from CapeMgr slots: ENOENT, no such file or directory 'null/slots' at onReadSlots (/home/debian/octaldene/node_modules/octalbonescript/lib/bone.js:230:23) at readSlots (/home/debian/octaldene/node_modules/octalbonescript/lib/bone.js:224:13) at onFindCapeMgr (/home/debian/octaldene/node_modules/octalbonescript/lib/bone.js:214:13) at Object.module.exports.load_dt_sync (/home/debian/octaldene/node_modules/octalbonescript/lib/bone.js:204:9) at onDTBOExists (/home/debian/octaldene/node_modules/octalbonescript/lib/bone.js:189:38) at onDTBOExistsTest (/home/debian/octaldene/node_modules/octalbonescript/lib/bone.js:156:17) at Object.module.exports.create_dt_sync (/home/debian/octaldene/node_modules/octalbonescript/lib/bone.js:151:13) at Object. (/home/debian/octaldene/node_modules/octalbonescript/index.js:30:14) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10)

2 problems I see: 1) Paths are different. For example, instead of '/sys/devices/bone_capemgr.' it is '/sys/devices/platform/bone_capemgr'

2) enabling the overlays are done differently now. This library (https://github.com/cdsteinkuehler/beaglebone-universal-io) is used and apparently according to this thread (https://groups.google.com/forum/#!topic/beagleboard/2D5Pz3r7ZZ8) universal cape will be loaded automatically from now on on debian images at least.

adityapatadia commented 9 years ago

Ohk, how did you manage to install kernel 4.1 on BB Black? I will upgrade my bone and fix the path issues. If the universal cape is already loaded, library will not load its own so it will be fine.

doganyazar commented 9 years ago

You can just try with a ready image. The debian 8.1 lxqt images here already have kernel 4.1 and universal library installed. http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Jessie_Snapshot_lxqt

If universal cape is not loaded just run config-pin overlay cape-universal after that all pins should be listed under /sys/class/gpio/

adityapatadia commented 9 years ago

Ok, but is it possible to just do apt-get install in latest official image for BB Black?

doganyazar commented 9 years ago

I guess you can do this: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#4.1.x_BeagleBone.2FBeagleBone_Black

But then I am not sure about the universal library and availability of the overlays.

adityapatadia commented 9 years ago

44 Asked for this too. I will have e to upgrade my board and add the support for this over next few weeks.

shaunmulligan commented 9 years ago

Hey there, is there any update on this? Thanks

adityapatadia commented 8 years ago

Hi, I have started work on this. Expect a new version by this Sunday

shaunmulligan commented 8 years ago

@adityapatadia that is awesome news! thanks :smile:

adityapatadia commented 8 years ago

Lot of code has been changed or I would say removed to be compatible with new kernel. It's way more easier to load and unload capes now. I would love if someone can help me test it.

The new version will be released soon but will not be compatible with 3.8 or below kernel. For 3.8, users should use 1.0.x version.

shaunmulligan commented 8 years ago

@adityapatadia if you tell me how and what I should test, I am more than happy to help :+1:

davehun commented 8 years ago

me too happy to give it a poke. its needed to get node-red-bbb going

adityapatadia commented 8 years ago

Hi guys, thanks for your support. I could not complete all the work by this Sunday. Actually I need to modify code for each functionality to be compatible with 4.1. I will need your help to test the code once I port it to 4.1.

I will publish a beta version on NPM once it is ready by this Sunday. I will need your help to test when it is in beta.

bigmonkeyboy commented 8 years ago

Hi - just tried v1.1.0 with a fresh install from sd card - kernal Linux beaglebone 4.1.12-ti-r29 #1 SMP PREEMPT Mon Nov 9 22:46:19 UTC 2015 armv7l GNU/Linux and am still getting the - VError: Unable to read from CapeMgr slots: ENOENT, no such file or directory 'null/slots' error..

adityapatadia commented 8 years ago

Hi, it's 1.0.6 version, not 1.1.0. I will publish beta of 1.1.0 soon.

bigmonkeyboy commented 8 years ago

HI - no I installed direct from github. So am on 1.1.0 already. npm i git+https://github.com/thoctal/octalbonescript.git

adityapatadia commented 8 years ago

Oh, then you should not get null/slot error. If you can give output of DEBUG=bone node yourscript.js it will help.

bigmonkeyboy commented 8 years ago

HI,

bone is_ocp() = null +0ms Error reading directory null bone is_cape_universal() = null +14ms bone Loading Universal Cape interface... +4ms bone create_dt_sync(OBS_UNIV,,) +4ms bone onDTBOExists() +3ms bone load_dt_sync(OBS_UNIV) +3ms bone onFindCapeMgr: path = null +3ms .... VError: Unable to read from CapeMgr slots: ENOENT, no such file or directory 'null/slots'

adityapatadia commented 8 years ago

It should have found path to capemanager. I am really not sure what went wrong. Let me complete work on OBS first, we will debug it after that.

bigmonkeyboy commented 8 years ago

what is the path it's looking for. I installed the Jessie direct from BBB site. If I search I find

./sys/devices/platform/bone_capemgr

Is that where it is expected ?

davehun commented 8 years ago

hmm was ok when I tried it from git but .. default user on jessie does not have permission to the devices I had to chown the device tree or run the test code as root. Hope that helps

bigmonkeyboy commented 8 years ago

I am running it all as root... no joy.

adityapatadia commented 8 years ago

@bigmonkeyboy yeah the path is correct. It is looking for /sys/devices/platform/bone_capemgr/slots file. I think it is user permission problem. Can you check again?

adityapatadia commented 8 years ago

I also suggest you don't use 'debian' user. Login directly as root via SSH. Let me know if it goes fine.

bigmonkeyboy commented 8 years ago

All OK now. In the end I re-flashed the Debian OS. Made sure I was root and installed latest from Master... not sure which bit was wrong as I could see the slots fine and was root... - but ... all working now. Thanks for your patience. Looking forward to full release.

adityapatadia commented 8 years ago

Looks good. I will try to release it by this Sunday.

adityapatadia commented 8 years ago

Hi All, I have pushed latest commit. I fixed everything so it should now work perfectly fine with 4.1 kernel. Can someone test on their BBB?

adityapatadia commented 8 years ago

I have checked, all unit tests are passing. Releasing beta version.

adityapatadia commented 8 years ago

Beta version of v1.1.0 is published. I request everyone to check and let us know if there is any issue.

bigmonkeyboy commented 8 years ago

So far - working well for me... Thanks shout when you release to npm.

adityapatadia commented 8 years ago

Published

maxwellhadley commented 8 years ago

I'm having almost but not quite the same issue, also using node-RED on the beagle bone. I'm using a very recent snapshot console image (with the necessary packages added) from https://rcn-ee.com/rootfs/bb.org/testing/2016-03-20/console/BBB-eMMC-flasher-debian-8.3-console-armhf-2016-03-20-2gb.img.xz

Running as root, I start node-red, which tries to load the node-red-node-beaglebone nodes, which try to load Octalbonescript, and I get the following output (hopefully you can distinguish your debug from node-red's!)

root@redbox:/home/max# DEBUG=bone node-red-pi -v

Welcome to Node-RED
===================

29 Mar 20:51:07 - [info] Node-RED version: v0.13.4
29 Mar 20:51:07 - [info] Node.js  version: v0.12.12
29 Mar 20:51:07 - [info] Linux 4.1.18-ti-r53 arm LE
29 Mar 20:51:07 - [info] Loading palette nodes
  bone is_ocp() = /sys/devices/platform/ocp +0ms
  bone find_sysfsFile(cape-universal,/sys/devices/platform/ocp,ocp:cape-universal) +16ms
  bone is_cape_universal() = null +18ms
  bone Loading Universal Cape interface... +3ms
  bone load_dt_sync(cape-universaln) +5ms
  bone onFindCapeMgr: path = /sys/devices/platform/bone_capemgr +3ms
  bone onReadSlots: index = -1, readAttempts = 1 +5ms
  bone Writing cape-universaln to /sys/devices/platform/bone_capemgr/slots +2ms
29 Mar 20:51:19 - [warn] ------------------------------------------
29 Mar 20:51:19 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
29 Mar 20:51:19 - [warn] [bbb] VError: Write to CapeMgr slots failed: ENOENT, no such file or directory
29 Mar 20:51:19 - [warn] ------------------------------------------
29 Mar 20:51:19 - [info] Settings file  : /root/.node-red/settings.js
29 Mar 20:51:19 - [info] User directory : /root/.node-red
29 Mar 20:51:19 - [info] Flows file : /root/.node-red/flows_redbox.json
29 Mar 20:51:19 - [info] Creating new flow file
29 Mar 20:51:19 - [info] Starting flows
29 Mar 20:51:19 - [info] Started flows
29 Mar 20:51:19 - [info] Server now running at http://127.0.0.1:1880/

However, the file it is complaining about does actually exist (unless maybe there is some non-printable character lurking in the pathname)

max@redbox:~$ ls -l /sys/devices/platform/bone_capemgr/slots
-rw-r--r-- 1 root root 4096 Mar 29 20:51 /sys/devices/platform/bone_capemgr/slots

The version of octalbonescript installed by node-red-node-beaglebone is 1.1.2

I'm currently working on getting a more up-to-date BBB running, why is why this is a fresh install. It's available to try out any tests you may wish, not being used for anything yet

maxwellhadley commented 8 years ago

Looking around at the other people who have reported similar issues (which you keep closing!) I see you mentioned in #53 that

Btw, the error is that it found slots file but it is not able to find .dtbo file for cape-universaln inside /lib/firmware folder. I suggest u re-install latest debian from link given in ready.

I have no /lib/firmware folder

max@redbox:~$ ls -l /lib
total 196
drwxr-xr-x  3 root root  4096 Mar 28 18:12 arm-linux-gnueabihf
lrwxrwxrwx  1 root root    21 Mar 28 20:43 cpp -> /etc/alternatives/cpp
drwxr-xr-x  2 root root  4096 Mar 20 17:30 ifupdown
drwxr-xr-x  2 root root  4096 Mar 20 17:30 init
-rwxr-xr-x  1 root root 54560 Oct  5  2014 klibc-sKNr1Fw-Rh9G1FYpGCXRnrwmP2A.so
lrwxrwxrwx  1 root root    30 Feb 12 04:08 ld-linux-armhf.so.3 -> arm-linux-gnueabihf/ld-2.19.so
lrwxrwxrwx  1 root root    17 Nov  8  2014 libip4tc.so.0 -> libip4tc.so.0.1.0
-rw-r--r--  1 root root 18172 Nov  8  2014 libip4tc.so.0.1.0
lrwxrwxrwx  1 root root    17 Nov  8  2014 libip6tc.so.0 -> libip6tc.so.0.1.0
-rw-r--r--  1 root root 18192 Nov  8  2014 libip6tc.so.0.1.0
lrwxrwxrwx  1 root root    15 Nov  8  2014 libipq.so.0 -> libipq.so.0.0.0
-rw-r--r--  1 root root  9680 Nov  8  2014 libipq.so.0.0.0
lrwxrwxrwx  1 root root    16 Nov  8  2014 libiptc.so.0 -> libiptc.so.0.0.0
-rw-r--r--  1 root root  5312 Nov  8  2014 libiptc.so.0.0.0
lrwxrwxrwx  1 root root    20 Nov  8  2014 libxtables.so.10 -> libxtables.so.10.0.0
-rw-r--r--  1 root root 34600 Nov  8  2014 libxtables.so.10.0.0
drwxr-xr-x  3 root root  4096 Mar 20 17:30 lsb
drwxr-xr-x  2 root root  4096 Mar 20 17:30 modprobe.d
drwxr-xr-x  3 root root  4096 Jan  1  2000 modules
drwxr-xr-x  2 root root  4096 Mar 20 17:30 startpar
drwxr-xr-x  8 root root  4096 Mar 20 17:31 systemd
drwxr-xr-x 15 root root  4096 Sep 17  2014 terminfo
drwxr-xr-x  4 root root  4096 Mar 20 17:31 udev
drwxr-xr-x  2 root root  4096 Mar 20 17:30 xtables

However, I do have a /sys/firmware directory:

max@redbox:~$ ls -l /sys/firmware
total 0
drwxr-xr-x 4 root root     0 Mar 29 08:05 devicetree
-r-------- 1 root root 61568 Mar 29 21:15 fdt

Is that of any relevance?

maxwellhadley commented 8 years ago

One more thing - does octalbonescript still call out to any executables, like the device tree compiler, that might cause these problems if not installed? Remember I started from the console image (which is very lightweight) and added things as needed. I may have not known about something that was needed: although I did install package device-tree-compiler.

maxwellhadley commented 8 years ago

I have found the problem. It was necessary to install the device-tree-overlays package on the BBB, as it appears to not be included in the stock console flasher BBB-eMMC-flasher-debian-8.3-console-armhf-2016-03-20-2gb.img.

It doesn't appear to be in a standard repository, but I installed it directly from GitHub:

git clone https://github.com/beagleboard/bb.org-overlays.git
cd bb.org-overlays
./install.sh

octalbonescript is now loading properly. However, it would be nice if Octalbonescript gave an appropriate error message (saying what needs to be done) if the /lib/firmware directory is not found.