New #VSCP Level II driver interface

The driver interface for Level II drivers will change for the upcoming 14.0.0 release. In previous versions the message passing has been done through the tcp/ip interface. This is no longer used (will still be used by Level III drivers).

The interface a driver maker has to implement is very simple and looks like this

// Open connection
long VSCPOpen( const char *pPathConfig, const unsigned char*pguid );

// Close connection
int VSCPClose( long handle );

// Write event
int VSCPWrite( long handle, const vscpEvent *pEvent, long timeout );

// Read event
int VSCPRead( long handle, vscpEvent *pEvent, unsigned long timeout );

// Get driver version MSB = major, LSB = build with minor/release in between
unsigned long VSCPGetVersion(  void );

// Get vendor string describing driver maker
const char *VSCPGetVendorString( void );

I think it is pretty selfexplanatory.

All Level II driver now must have a unique GUID assign to them. Configuration is

<driver enable="true"     
        name="driver-name"     
        path-driver="/usr/lib/x86_64-linux-gnu/vscpl2drv-driver-name1.so"     
        path-config="/var/lib/vscpl2drv-driver-name/drv.xml"       
        guid="FF:FF:FF:FF:FF:FF:FF:FC:88:99:AA:BB:CC:DD:EE:FF" 
</driver>

Worth to note here is that driver now by default will be installed to /usr/lib/x86_64-linux-gnu/ and /usr/lib/x86_32-linux-gnu/ so one can have 32-bit and 64-bit drivers installed on a system at the same time. We by this adopt to Debian roles used in deb packages.

Also driver names will end with the major version. So a a level II driver “automation” will be vscpl2drv-automation1. Also, drivers will comply to the Linux library installation schema used on Linux so they will be installed with the full version for example vscpl2drv-automation1.so.1.1.1 but links will be created for vscpl2drv-automation1.so.1.1, vscpl2drv-automation1.so.1 and vscpl2drv-automation1.so so drivers can be addressed as before.

If you make driver please use this schema. In the same way use vscpl1drv- as prefix for level I driver.

name is a system unique name for the driver.

path-driver gives the path to the driver as expected.

path-config is a path to a configuration file for a driver. Normally this file should be in xml format. The location for the configuration file can be anywhere but recommended is /var/lib/vscpl2drv-driver-name/ for a driver that can be configured on the fly and /etc/vscp for a driver that are static. The later being the safest place.

guid is a system unique GUID for the driver. This GUID must be set and it must be valid.

New for level II drivers is that they will be able to be configured on the fly and be interacted with through the web interface, websockets and tcp/ip interface. One can therefore easily set up configuration pages etc. More on that later.

For a sample of the new futures and a base for your own projects check the vscpl2drv-automation driver. This driver implements the automation functionality that was previously integrated into the VSCP daemon. Tables, DM, remote variables, udp, multicast are other functionality that is moved out to drivers with the upcoming 14.0.0 version.

A lot of new functionality is demonstrated in the vscpl2drv-automation. Save and load for example that save/load the current configuration. Also all parameters are possible to edit/change when the driver is loaded and alive in a system.

Some parameters may still be changed so look at tis as somewhat preliminary information.

Building #ARM #Raspbian packages on your #Intel PC

If you are a maintainer of a software project as I am, you probably spend a lot of time testing and deploying code. The more platforms you add the harder this gets and at some point you need to think carefully what you can do to minimize manual work.

I build things for Ubuntu/Debian/Raspian and Windows. In the beginning a lot of the deployment here was done on each platform. Hours spent on this for each release. Frustrating. I decided to do some scripts that would make it possible to do the first tree automatically. Saving time if I could get it to work.

I found Stein Magnus Jodal‘s excellent article Building ARM Debian packages with pbuilder and his the only one that should take credit for the things I describe here. I am just a copy cat in this case, well more or less, just adding some vital things.

I had no major problem to get buildings for Ubuntu and Debian to work with pbuilder following Stein Magnis Jodal’s document. The ARM builds was another thing. What I got was this

...
 qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x60184bcc
 qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x600019f9
...

qemu (or rather pbuilder-satisfydepends) fails when checking dependencies. After a long struggle I found that replacing pbuilder-satisfydepends with pbuilder-satisfydepends-apt was a solution to this problem.

I repeat the steps from Stein Magnis Jodal’s document here with my changes and updates and comments to get things working. Again credit is to Stein Magnis Jodal.

Setup pbuilder environment

Add a file .pbuilderrc to your root acount with the following content

!/bin/sh
 set -e
 if [ "$OS" == "debian" ]; then
     MIRRORSITE="http://ftp.se.debian.org/debian/"
     COMPONENTS="main contrib non-free"
     DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
         "--keyring=/usr/share/keyrings/debian-archive-keyring.gpg")
     : ${DIST:="stretch"}
     : ${ARCH:="amd64"}
     if [ "$DIST" == "jessie" ]; then
         #EXTRAPACKAGES="$EXTRAPACKAGES debian-backports-keyring"
         OTHERMIRROR="$OTHERMIRROR | deb $MIRRORSITE jessie-backports $COMPONENTS"
     fi
 elif [ "$OS" == "raspbian" ]; then
     MIRRORSITE="http://ftp.acc.umu.se/mirror/raspbian/raspbian/"
     COMPONENTS="main contrib non-free"
     PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-apt"
     DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
         "--keyring=/usr/share/keyrings/raspbian-archive-keyring.gpg")
     : ${DIST:="stretch"}
     : ${ARCH:="armhf"}
 elif [ "$OS" == "ubuntu" ]; then
     MIRRORSITE="http://se.archive.ubuntu.com/ubuntu/"
     COMPONENTS="main restricted universe multiverse"
     DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
         "--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg")
 else
     echo "Unknown OS: $OS"
     exit 1
 fi
 if [ "$DIST" == "" ]; then
     echo "DIST is not set"
     exit 1
 fi

Note the PBUILDERSATISFYDEPENDSCMD under the Raspbian section.

Now pbuilder will require three environment variables (in upper case) for it’s use

OS

The os you build for.It can be set to ubuntu, debian or raspbian

ARCH

The arcitecture you are builing for. It can be any of amd64, i386, armel, or armhf. Yes som eother supported arcitecure also of course.

DIST

Distribution of the os. For Debian/Raspbian buster, stretch, jessie. For Ubuntu eoan, disco, bionic, xenial, trusty. Well others shoudl work to.

If you are on a PC qemu-debootstrap is used for the ARM builds. So you have to install it with

sudo apt install pbuilder qemu-user-static

We also need the keyrings. For Ubuntu and Debian install them with

sudo apt install ubuntu-keyring debian-archive-keyring

If that for some reason does not work you can fetch the keyring fro Debian at https://packages.debian.org/sid/all/ubuntu-keyring/download and for Ubuntu keyring can be fetched here https://launchpad.net/ubuntu/+source/ubuntu-keyring

The keyring for Raspbian you can get here

 wget http://archive.raspbian.org/raspbian/pool/main/r/raspbian-archive-keyring/raspbian-archive-keyring_20120528.2_all.deb  
sudo dpkg -i raspbian-archive-keyring_20120528.2_all.deb

Now you need to build the chroots. You do this with steps like

sudo mkdir -p /var/cache/pbuilder/debian-stretch-amd64/aptcache/  
sudo OS=debian DIST=stretch ARCH=amd64 pbuilder --create

Replace OS/DIST/ARCH for your needs.

All you need now is the Debian source package for the code you want to work with. Go to the folder where it is and issue

sudo OS=debian DIST=stretch ARCH=armhf pbuilder build *.dsc

Replace OS/DIST/ARCH for your needs.

If all goes well you find the resulting package in

/var/cache/pbuilder//var/cache/pbuilder/debian-stretch-amd64/result/

replace ‘stretch’, ‘amd64’ and ‘debian’ as to you settings for DIST, ARCH and OS.

If you rather want you can go into an unpacked source folder and issu

tar xvf ../src-pkg.debian.tar.xz
tar xvf ../src-pkg.orig.tar.gz
sudo OS=debian DIST=stretch ARCH=amd64 pdebuild

Again replace OS/DIST/ARCH for your needs.

Thats it really.

I experienced situation when dh-autoreconf was not available in the chroot and when it did not get installed. This was for Ubuntu. If this happens you can instll it manually with

sudo OS=ubuntu DIST=xenial ARCH=amd64 pbuilder --login --save-after-exec 
apt install dh-autoreconf 
exit

Hope this can save some time for someone. And again thanks to Stein Magnis Jodal for his work.

Lazy section

Below is some code you can use if you think typing on a keyboard is tiresome…

Ubuntu

sudo mkdir -p /var/cache/pbuilder/ubuntu-trusty-amd64/aptcache/
sudo OS=ubuntu DIST=trusty ARCH=amd64 pbuilder --create
sudo OS=ubuntu DIST=trusty ARCH=amd64 pbuilder build vscpl2drv-automation1_1.1.0-1.dsc

sudo mkdir -p /var/cache/pbuilder/ubuntu-xenial-amd64/aptcache/
sudo OS=ubuntu DIST=xenial ARCH=amd64 pbuilder --create
sudo OS=ubuntu DIST=xenial ARCH=amd64 pbuilder build vscpl2drv-automation1_1.1.0-1.dsc

sudo mkdir -p /var/cache/pbuilder/ubuntu-bionic-amd64/aptcache/
sudo OS=ubuntu DIST=bionic ARCH=amd64 pbuilder --create
sudo OS=ubuntu DIST=bionic ARCH=amd64 pbuilder build vscpl2drv-automation1_1.1.0-1.dsc

sudo mkdir -p /var/cache/pbuilder/ubuntu-disco-amd64/aptcache/
sudo OS=ubuntu DIST=disco ARCH=amd64 pbuilder --create
sudo OS=ubuntu DIST=disco ARCH=amd64 pbuilder build vscpl2drv-automation1_1.1.0-1.dsc

sudo mkdir -p /var/cache/pbuilder/ubuntu-eoan-amd64/aptcache/
sudo OS=ubuntu DIST=eoan ARCH=amd64 pbuilder --create
sudo OS=ubuntu DIST=eoan ARCH=amd64 pbuilder build vscpl2drv-automation1_1.1.0-1.dsc

Debian

For the arm builds you may need to add the line

PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-apt"

to your pbuilder configuration (.pbuilderrc) file.

sudo mkdir -p /var/cache/pbuilder/raspbian-jessie-amd64/aptcache/
sudo OS=raspbian DIST=jessie ARCH=amd64 pbuilder --create
sudo OS=raspbian DIST=jessie ARCH=amd64 pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-stretch-amd64/aptcache/
sudo OS=raspbian DIST=stretch ARCH=amd64 pbuilder --create
sudo OS=raspbian DIST=stretch ARCH=amd64 pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-buster-amd64/aptcache/
sudo OS=raspbian DIST=buster ARCH=amd64 pbuilder --create
sudo OS=raspbian DIST=buster ARCH=amd64 pbuilder build *.dsc


sudo mkdir -p /var/cache/pbuilder/raspbian-jessie-i385/aptcache/
sudo OS=raspbian DIST=jessie ARCH=i385 pbuilder --create
sudo OS=raspbian DIST=jessie ARCH=i385 pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-stretch-i385/aptcache/
sudo OS=raspbian DIST=stretch ARCH=i385 pbuilder --create
sudo OS=raspbian DIST=stretch ARCH=i385 pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-buster-i385/aptcache/
sudo OS=raspbian DIST=buster ARCH=i385 pbuilder --create
sudo OS=raspbian DIST=buster ARCH=i385 pbuilder build *.dsc


sudo mkdir -p /var/cache/pbuilder/raspbian-jessie-armle/aptcache/
sudo OS=raspbian DIST=jessie ARCH=armle pbuilder --create
sudo OS=raspbian DIST=jessie ARCH=armle pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-stretch-armle/aptcache/
sudo OS=raspbian DIST=stretch ARCH=armle pbuilder --create
sudo OS=raspbian DIST=stretch ARCH=armle pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-buster-armle/aptcache/
sudo OS=raspbian DIST=buster ARCH=armle pbuilder --create
sudo OS=raspbian DIST=buster ARCH=armle pbuilder build *.dsc


sudo mkdir -p /var/cache/pbuilder/raspbian-jessie-armhf/aptcache/
sudo OS=raspbian DIST=jessie ARCH=armhf pbuilder --create
sudo OS=raspbian DIST=jessie ARCH=armhf pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-stretch-armhf/aptcache/
sudo OS=raspbian DIST=stretch ARCH=armhf pbuilder --create
sudo OS=raspbian DIST=stretch ARCH=armhf pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-buster-armhf/aptcache/
sudo OS=raspbian DIST=buster ARCH=armhf pbuilder --create
sudo OS=raspbian DIST=buster ARCH=armhf pbuilder build *.dsc

Raspbian

Use armle for Raspberry Pi 1

sudo mkdir -p /var/cache/pbuilder/raspbian-jessie-armhf/aptcache/
sudo OS=raspbian DIST=jessie ARCH=armhf pbuilder --create
sudo OS=raspbian DIST=jessie ARCH=armhf pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-stretch-armhf/aptcache/
sudo OS=raspbian DIST=stretch ARCH=armhf pbuilder --create
sudo OS=raspbian DIST=stretch ARCH=armhf pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-buster-armhf/aptcache/
sudo OS=raspbian DIST=buster ARCH=armhf pbuilder --create
sudo OS=raspbian DIST=buster ARCH=armhf pbuilder build *.dsc

This info is current when this is written but may not be when you read it.

CadSoft eagle 6.6.0 on new Ubuntu

I have had problems installing my eagle license for 6.6.0 on new Ubuntu versions for a while and have been forces to run it on my Windows machine (yes I have a license).

I found this link and it is halfway working. Superb work btw. But I still get a complaint about eagle not finding libssl1.0.0

I today found that the solution to this problem is to install libssl1.0.0_1.0.2n-1ubuntu5.3_i386.deb from here. Pretty obvious maybe. Now everything works as expected again.

Posted here in case someone else have the same problem and want to save a minute or two.

At last #VSCP

At last, after a long time the PIR sensors and the door sensors start to deliver some VSCP events. This is something that should have been live this spring, but due to unforeseen events of life, it all has been delayed. But better late than never I guess.

This is nothing fancy of course but I will still describe the project here in detail later. For me it is important to get some real world data to work with. Using real world data always give more insight in how things should work than simulate things. Side-effects of this project is smart lights, lock control and some other things, for part of our house and my office.

Now some coffee, then it’s time to go on with other parts of this project.

dh_autoreconf problem

If you want to make a debian package on a Raspberry Pi with Stretch installed or another machine with an older debian version installed the debhelper build process may complain about multiple runs of dh_autoreconf and abort. This is due to a bug in dh_autoreconf which just warns for this in later versions.

Solution

Get the latest version of dh_autoreconf

wget http://sourcearchive.raspbian.org/main/d/dh-autoreconf/dh-autoreconf_19.tar.xz

Unpack

tar xvf dh-autoreconf_19.tar.xz

Save a copy of the old sh_autoreconf

sudo mv /usr/bin/dh_autoreconf /usr/bin/dh_autoreconf.save

Copy the new file

copy dh_autoreconf to /usr/bin

Problem should be solved.