This is written in lua using the Lua Event Machine, along with the sqlite3 library for it. sha1 is used for hashing the readings from the magnetic cards.
Zebex Z-6070 Programming guide User manual
sudo apt-get install lua5.2 git sqlite3 libsqlite3-dev pkg-config
git clone https://github.com/Studentergaarden/drinkomatic.git
git clone https://github.com/Studentergaarden/lua-sha1.git
git clone https://github.com/esmil/lem.git
git clone https://github.com/esmil/lem-sqlite3.git
cd lem && ./configure && make
sudo make install
cd ../lem-sqlite3 && make && sudo make install
cd ../lua-sha1 && make LUA_INCDIR=/usr/local/include/lem && sudo make install
Install SQLite3
sudo apt-get install sqlite3 libsqlite3-dev
and create database
sqlite3 /home/paw/tmp/micropay.db < structure.sql
In order to give a persistent name to the specific serial-to-usb devices, we need a rule to udev. First find the serial number for the device (without grep a lot of info about the usb is shown - use the first value of each keyword):
udevadm info -a -n /dev/ttyUSB* | egrep -w --color 'idVendor|idProduct|serial'
Then add the rule
$ sudo nano /etc/udev/rules.d/99-usb-serial.rules
SUBSYSTEM=="tty", ATTRS{idVendor}=="0711", ATTRS{idProduct}=="0230", ATTRS{serial}=="026637", SYMLINK+="card"
SUBSYSTEM=="tty", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="barcode"
and update udev
$ sudo udevadm trigger --action=change
src{SYMLINK+=”card”} means that UDEV should create a symlink /dev/card
pointing to the actual /dev/ttyUSB*
device. In other words the device names will continue to be assigned ad-hoc but the symbolic links will always point to the right device node.
Run and add the following to ~/.xinitrc
# change comma to dot on numeric keypad
setxkbmap -option '' -option kpdl:dot
NB: This does only work in a graphical environment, eg. X must be started.
To check the current settings, write setxkbmap -query
Instead of connecting an barcode scanner or cardreader, a named pipe can be used for testing:
mkfifo /home/paw/tmp/testpipe
Then change ./drinkomatic
to use this pipe instead of /dev/ttyUSB*
.
http://www.instructables.com/id/How-to-Make-a-Raspberry-Pi-Media-Panel-fka-Digita/
See also this comment.