Skip to content

slub/Sapphire4Linux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sapphire4Linux

This is a Linux implementation of a control software for the Dialoc ID Sapphire EM Staff Station, similar to StaffWorkstation4Linux for the older 3M devices.

It is designed to automatically activate or deactive EM tags in books after a barcode is scanned. A standard USB (keyboard-like) barcode scanner is necessary for this script to operate. The decision if the EM tag is activated or deactivated is done by checking the window title of the circulation software. A QT tray bar icon shows the current operation mode.

Hardware Setup

The device is recognized as serial port over USB. If you have multiple USB serial devices attached, you may want to create unique device files as the adapters may be recognized in different order on every boot:

# this rule makes your Sapphire with serial=12345678 always available as /dev/sapphire (find your serial be reading `dmesg -w` when connecting the device)
# /etc/udev/rules.d/50-sapphire.rules:
SUBSYSTEMS=="usb", KERNEL=="ttyACM*", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2435", ATTRS{serial}=="12345678", SYMLINK+="sapphire"

Disable serial-getty for exclusive serial port access and add your user to the dialout group for non-root access.

sudo systemctl mask serial-getty@ttyAMA0.service
sudo systemctl mask serial-getty@serial0.service
usermod -aG dialout <linuxuser>
reboot

Software Setup

  1. Install packages:
apt install python3-serial python3-evdev python3-pyqt6
  1. Create a config file ~/.config/sapphire4linux.ini:
[sapphire]
port = /dev/sapphire
baud = 115200
keywordcheckout = Ausleihe
keywordcheckin = Rückgabe
checkoutcmd = Set arrow: 200\rD
checkincmd = Set arrow: 200\rA
finishcmd = Set arrow: 0
initcmd = Unit on\rDisable On/Off key\rHost mode\rBeep on error\rRed on error
endcmd = Unit off

[scanner]
device = /dev/input/by-id/usb-Optoelectronics_Co.__Ltd._USB_Code_Reader-event-kbd

initcmd/endcmd can contain arbitrary commands separated by \r (see "Commands.txt" for all available commands).

  1. Start the application im terminal for testing:
./sapphire.py

Scan a barcode and check if de/activating works.

  1. Add it into your autostart ~/.config/autostart/sapphire.desktop:
[Desktop Entry]
Type=Application
Exec=/opt/sapphire.py
X-GNOME-Autostart-enabled=true
NoDisplay=false
Hidden=false
Name=Sapphire4Linux
X-GNOME-Autostart-Delay=0

Debugging

You can start the script with the --shell parameter to get a serial shell for sending arbitrary commands to the device and see the response live.

About

Linux control software for the Dialoc ID Sapphire EM Staff Station (Maintained by @schorschii)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors

Languages