The problem of configuring the libfptr10 driver in linux (Russian cash register equipment)

51 views Asked by At

As developers, we need to integrate the support of the Russian cash register “Kaznachei” into the project. All integration materials are available on the manufacturer's website. However, the described scheme does not work. The atol driver does not accept string parameters as input. This problem presents only on linux but there is no problem in the windows environment.

Our project has the following environment:

  • Server: Linux x64 Ubuntu 22.04 LTS without graphical shell
  • Project: C# NET.CORE
  • The driver is installed from the libfptr10_10.10.0.0_amd64.deb package (downloaded from the manufacturer's website https://fs.atol.ru)
  • The cash register is connected to a PC accessible over a local network. The atol-fptr-rpc-server kit is installed and running on the PC

Problems

  1. It is not possible to initialize a working instance of the driver specifying the library directory/library path
"DriverPath": "/usr/lib/libfptr10.so".

An instance of the driver is created only if we submit an empty string to the constructor. "DriverPath": "".

  1. The LIBFPTR_SETTING_REMOTE_SERVER_CONNECTION_TIMEOUT and LIBFPTR_SETTING_REMOTE_SERVER_ADDR settings are not set from the code. Executing the fptr.setSingleSetting() method followed by executing fptr.applySingleSettings() does not give a result. We see an empty line in the atol log. If, after executing these methods, we request settings again fptr.getSettings() as result we get a standard JSON with default settings:
2023.12.11 12:47:22.756       T:E5451640 INFO  [FiscalPrinter] libfptr_get_settings()
2023.12.11 12:47:22.764       T:E5451640 INFO  [FiscalPrinter] Текущие настройки: [{
   "AccessPassword" : "",
   "AutoDisableBluetooth" : false,
   "AutoEnableBluetooth" : true,
   "AutoMeasurementUnit" : false,
   "AutoReconnect" : true,
   "BaudRate" : 115200,
   "Bits" : 8,
   "ComFile" : "1",
   "DocumentsJournalPath" : "",
   "IPAddress" : "192.168.1.10",
   "IPPort" : 5555,
   "InvertCashDrawerStatus" : false,
   "LibraryPath" : "",
   "MACAddress" : "FF:FF:FF:FF:FF:FF",
   "Model" : 500,
   "OfdChannel" : 2,
   "Parity" : 0,
   "Port" : 1,
   "RemoteServerAddr" : "",
   "RemoteServerConnectionTimeout" : 10000,
   "ScriptsPath" : "",
   "SilentReboot" : 0,
   "StopBits" : 0,
   "UsbDevicePath" : "auto",
   "UseDocumentsJournal" : false,
   "UserPassword" : "",
   "ValidateMarksWithFnmOnly" : false
}
  1. If we request settings, then try to change any settings, and request settings again, we get an error:
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  1. Without correctly setting of the libfptr10 driver, we get the expected error:
2023.12.07 12:04:45.470       T:B12B0640 ERROR [USB] Не удалось найти устройство 2912:FFFF
2023.12.07 12:04:45.476       T:B12B0640 ERROR [FiscalPrinter] Объекту 0xA002B6D0 присвоен код ошибки 4 [Порт недоступен]

As a result We are unable to initialize the libfptr10 driver on the Ubuntu 22.04 LTS server according to the description from the official manufacturer's documentation.

  • We tried to roll back the version of the installed driver to 10.9.5.0.
  • We tried to connect the Kaznachei via the linux usbip utility.
  • We decided that the problem was related to the encoding of string parameters and changed the encoding options.
  • We thought that the width of the character in bytes 2 or 4 mattered, we tried to change it.

There is no result

1

There are 1 answers

0
JMLabs On

The problem was solved by replacing the library Atol.Drivers10.Fptr.dll for an older version 10.9.5.0. It can be argued that the current version 10.10.0.0 of this library does not work correctly in a linux environment. Hooray