====== Hwserver ======
The concept of Gwyscope is based on a server-client approach, i.e. a server - hwserver - is used to control all the hardware based on commands received from a client (e.g. Gwyscope GUI). Default hwserver installation is ''/root/gwyhwserver_gwyscope''. The server can be started after login to the Red Pitaya from the command line, providing port number for client connection and (optionally) .ini file with initial parameters settings. For example
./hwserver 50100 hwserver.ini
If started successfully, hwserver should log different values every cca 2 seconds. Note that if hwserver is running and the Red Pitaya would be at the same time accessed using its web interface, then the Red Pitaya freezes and all electronics has to be power cycled.
{{ :wiki:hw:mobaxterm_hwserver.png?400 }}
The start of hwserver can be automated using provided ''hwserver.service'' file. Example of this file is shown here:
[Unit]
Description=hwserver
After=network.target
[Service]
Type=simple
Environment=SOCKET_NUMBER=50100
Environment=INI_FILE=hwserver.ini
ExecStart=/root/gwyhwserver_gwyscope/hwserver ${SOCKET_NUMBER} ${INI_FILE}
User=root
WorkingDirectory=/root/gwyhwserver_gwyscope/
TimeoutStopSec=10
[Install]
WantedBy=multi-user.target
Change parameters to match the installation and copy it to ''/lib/systemd/system/'' directory.
cp /root/gwyhwserver_gwyscope/hwserver.service /lib/systemd/system/
The service is disabled by default, this can be verified using ''status'' command of ''systemctl'' system services manager.
root@rp-f0962a:~/gwyhwserver_gwyscope# systemctl status hwserver.service
hwserver.service - hwserver
Loaded: loaded (/lib/systemd/system/hwserver.service; disabled; vendor preset: enabled)
Active: inactive (dead)
To enable automatic start of the hwserver after reboot or power on use ''enable''.
root@rp-f0962a:~/gwyhwserver_gwyscope# systemctl enable hwserver.service
Created symlink from /etc/systemd/system/multi-user.target.wants/hwserver.service to /lib/systemd/system/hwserver.service.
To start the service immediately use ''start''.
root@rp-f0962a:~/gwyhwserver_gwyscope# systemctl start hwserver.service
root@rp-f0962a:~/gwyhwserver_gwyscope# systemctl status hwserver.service
hwserver.service - hwserver
Loaded: loaded (/lib/systemd/system/hwserver.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2025-02-20 11:58:50 UTC; 2s ago
Main PID: 3195 (hwserver)
CGroup: /system.slice/hwserver.service
L¦3195 /root/gwyhwserver_gwyscope/hwserver 50100 hwserver.ini
Feb 20 11:58:50 rp-f0962a systemd[1]: Started hwserver.
Feb 20 11:58:50 rp-f0962a hwserver[3195]: starting RP hwserver...
Feb 20 11:58:50 rp-f0962a hwserver[3195]: hwserver version: v3.0
In order to view hwserver's log use ''journalctl''. Note, however, that the update time is considerably longer (>30 s) because the output is buffered.
journalctl -f -u hwserver.service
To stop the service immediately use ''stop''.
systemctl stop hwserver.service
If automatic hwserver starting is not desired anymore use ''disable''.
root@rp-f0962a:~/gwyhwserver_gwyscope# systemctl disable hwserver.service
Removed symlink /etc/systemd/system/multi-user.target.wants/hwserver.service.