LINUX.ORG.RU

Сообщения Alex_Golubev

 

Журнал событий кольцевой

Мне нужен журнал событий кольцевой для qt5 c++. С функцией чтения и записи строк из файла. Размер файла на 128 строк. Количество символов в строке ограничен 128 символов. Выравнивания строк не нужно на 128 символов пробелами или еще чем. Если больше 128 символов в строке то просто обрезаем. Компьютер может отключатся от сети поэтому нужно хранить голову в файле во избежание потери куда писать новую строку. Пишем и читаем по кругу.

Написал код, но проблема возникает с индексом при чтение. Если записать 128 строк, то сначала прочитает «Сообщение 0» а потом «Сообщение 127» понятно, что должно прочитаться «Сообщение 127» …. «Сообщение 0» а тут наоборот. Чет не могу найти ошибку с индексом.

#include "mainwindow.h"
#include <QFile>
#include <QTextStream>
#include <QDebug>
#include <QStringList>
#include <QApplication>
 
 
class RingBufferLog {
public:
    RingBufferLog(const QString &filename) : m_filename(filename) {
        // Инициализация файла, если его нет
        if (!QFile::exists(m_filename)) {
            QFile file(m_filename);
            if (file.open(QIODevice::WriteOnly)) {
                QTextStream out(&file);
                // Записываем начальные значения головы и хвоста (первые 2 строки)
                out << "0\n";  // head
                out << "0\n";  // tail
                // Заполняем остальные строки пустыми значениями
                for (int i = 2; i < 130; ++i) {
                    out << "\n";
                }
                file.close();
            }
        }
        // Читаем текущие head и tail
        readPointers();
    }
 
    // Добавление строки в лог (FIFO)
    bool write(const QString &message) {
        QFile file(m_filename);
        if (!file.open(QIODevice::ReadWrite)) {
            qWarning() << "Cannot open file for writing:" << m_filename;
            return false;
        }
 
        QTextStream in(&file);
        QStringList lines;
        while (!in.atEnd()) {
            lines << in.readLine();
        }
 
        // Обрезаем строку, если она длиннее 128 символов
        QString truncatedMsg = message.left(128);
 
        // Обновляем head (новая позиция для записи)
        int newHead = (m_head + 1) % 128;
        m_tail = (m_tail + 1) % 1048576;
 
        // Записываем строку в новую позицию
        //lines[newHead + 2] = truncatedMsg;  // +2 потому что первые 2 строки - head и tail
        lines[m_head + 2] = truncatedMsg;  // +2 потому что первые 2 строки - head и tail
 
        // Обновляем head в файле
        lines[0] = QString::number(newHead);
        lines[1] = QString::number(m_tail);
 
        // Перезаписываем файл
        file.resize(0);  // Очищаем файл
        QTextStream out(&file);
        for (const QString &line : lines) {
            out << line << "\n";
        }
 
        m_head = newHead;
        file.close();
        return true;
    }
 
    // Чтение всех строк в порядке FIFO
    QStringList readAll() {
        QStringList messages;
        QFile file(m_filename);
        if (!file.open(QIODevice::ReadOnly)) {
            qWarning() << "Cannot open file for reading:" << m_filename;
            return messages;
        }
 
        QTextStream in(&file);
        QStringList lines;
        while (!in.atEnd()) {
            lines << in.readLine();
        }
        file.close();
 
        if (lines.size() < 130) {
            qWarning() << "File is corrupted";
            return messages;
        }
 
        int curent = m_tail < 128 ? m_tail : 128;
        //int current = m_head;
        int current = m_tail ;
 
        qDebug() << "m_tail" << m_tail << "m_head" << m_head << "curent" << curent;
        for (int i = 0; i < curent; i++)
        {
        messages << lines[((current - i) % 128) + 2];
       // qDebug() << "точки массива" << ((current - i) % 128) << "i" << i << "current" << current;
        }
       // qDebug() << current << m_head << "messages" << messages << messages.size() << "\n";
 
        return messages;
    }
 
private:
    QString m_filename;
    int m_head = 0;
    int m_tail = 0;
 
    void readPointers() {
        QFile file(m_filename);
        if (!file.open(QIODevice::ReadOnly)) {
            qWarning() << "Cannot open file for reading pointers:" << m_filename;
            return;
        }
 
        QTextStream in(&file);
        QString headLine = in.readLine();
        QString tailLine = in.readLine();
        m_head = headLine.toInt();
        m_tail = tailLine.toInt();
        file.close();
    }
};
 
 
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    system("rm event_log.txt");
 
    RingBufferLog log("event_log.txt");
    // Запись в лог
    //log.write("Event 1: System started");
    //log.write("Event 2: User logged in");
    //log.write("Event 3: Data processed");
 
    // Записываем 145 сообщений
    for (int i = 0; i < 128; ++i) {
        log.write("Сообщение " + QString::number(i));
    }
 
    // Читаем обратно
    QStringList events = log.readAll();
    qDebug() << "Всего сообщений:" << events.size();
 
    for (const QString &event : events) {
        qDebug() << event;
    }
 
   // MainWindow w;
   // w.show();
    return a.exec();
}

Перемещено Dimez из general

 , ,

Alex_Golubev
()

удаленный стол debian12 RDP виндувс. Выкидывает пользователя при входе.

Установил RDP по инструкции но что-то пошло не так и пользователя выбрасывает.

Последовательность команд которые использовал.

sudo apt update

sudo ufw allow 3389

sudo apt install xrdp

sudo apt install xorgxrdp

sudo systemctl enable xrdp

sudo systemctl status xrdp

sudo apt install xfce4

sudo systemctl start xrdp

user1@prom3:~$ sudo grep -i "error" /var/log/xrdp.log
[20250306-11:59:14] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-11:59:15] [ERROR] libxrdp_force_read: header read error
[20250306-11:59:15] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-11:59:15] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-11:59:15] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-11:59:15] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-11:59:15] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-11:59:15] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-11:59:15] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-11:59:20] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-11:59:21] [ERROR] dynamic_monitor_open_response: error
[20250306-11:59:21] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-12:00:15] [ERROR] xrdp_sec_recv: xrdp_mcs_recv failed
[20250306-12:00:15] [ERROR] xrdp_rdp_recv: xrdp_sec_recv failed
[20250306-12:00:15] [ERROR] libxrdp_process_data: xrdp_rdp_recv failed
[20250306-12:00:15] [ERROR] xrdp_process_data_in: xrdp_process_loop failed
[20250306-12:00:29] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-12:00:29] [ERROR] libxrdp_force_read: header read error
[20250306-12:00:29] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-12:00:29] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-12:00:29] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-12:00:29] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-12:00:29] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-12:00:29] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-12:00:29] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-12:00:31] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-12:00:31] [ERROR] dynamic_monitor_open_response: error
[20250306-12:00:32] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-12:01:35] [ERROR] xrdp_sec_recv: xrdp_mcs_recv failed
[20250306-12:01:35] [ERROR] xrdp_rdp_recv: xrdp_sec_recv failed
[20250306-12:01:35] [ERROR] libxrdp_process_data: xrdp_rdp_recv failed
[20250306-12:01:35] [ERROR] xrdp_process_data_in: xrdp_process_loop failed
[20250306-12:19:30] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-12:19:30] [ERROR] libxrdp_force_read: header read error
[20250306-12:19:30] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-12:19:30] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-12:19:30] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-12:19:31] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-12:19:31] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-12:19:31] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-12:19:31] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-12:19:39] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-12:19:40] [ERROR] dynamic_monitor_open_response: error
[20250306-12:19:40] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-12:20:56] [ERROR] xrdp_sec_recv: xrdp_mcs_recv failed
[20250306-12:20:56] [ERROR] xrdp_rdp_recv: xrdp_sec_recv failed
[20250306-12:20:56] [ERROR] libxrdp_process_data: xrdp_rdp_recv failed
[20250306-12:20:56] [ERROR] xrdp_process_data_in: xrdp_process_loop failed
[20250306-12:22:02] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-12:22:02] [ERROR] libxrdp_force_read: header read error
[20250306-12:22:02] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-12:22:02] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-12:22:02] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-12:22:02] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-12:22:02] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-12:22:02] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-12:22:02] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-12:22:05] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-12:22:06] [ERROR] dynamic_monitor_open_response: error
[20250306-12:22:06] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-12:22:26] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-12:22:26] [ERROR] libxrdp_force_read: header read error
[20250306-12:22:26] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-12:22:26] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-12:22:27] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-12:22:27] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-12:22:27] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-12:22:27] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-12:22:27] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-12:22:27] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-12:22:28] [ERROR] dynamic_monitor_open_response: error
[20250306-12:22:28] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:06:45] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:06:45] [ERROR] libxrdp_force_read: header read error
[20250306-13:06:45] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:06:45] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:06:45] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:06:45] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:06:45] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:06:45] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:06:45] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:06:48] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:06:49] [ERROR] dynamic_monitor_open_response: error
[20250306-13:06:49] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:07:06] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:07:07] [ERROR] libxrdp_force_read: header read error
[20250306-13:07:07] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:07:07] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:07:07] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:07:07] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:07:07] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:07:07] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:07:07] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:07:07] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:07:08] [ERROR] dynamic_monitor_open_response: error
[20250306-13:07:08] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:07:44] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:07:44] [ERROR] libxrdp_force_read: header read error
[20250306-13:07:44] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:07:44] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:07:44] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:07:44] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:07:44] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:07:44] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:07:44] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:07:44] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:07:45] [ERROR] dynamic_monitor_open_response: error
[20250306-13:07:45] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:14:37] [ERROR] xrdp_sec_recv: xrdp_mcs_recv failed
[20250306-13:14:37] [ERROR] xrdp_rdp_recv: xrdp_sec_recv failed
[20250306-13:14:37] [ERROR] libxrdp_process_data: xrdp_rdp_recv failed
[20250306-13:14:37] [ERROR] xrdp_process_data_in: xrdp_process_loop failed
[20250306-13:14:43] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:14:43] [ERROR] libxrdp_force_read: header read error
[20250306-13:14:43] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:14:43] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:14:43] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:14:43] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:14:44] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:14:44] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:14:44] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:14:44] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:14:45] [ERROR] dynamic_monitor_open_response: error
[20250306-13:14:45] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:17:56] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:17:56] [ERROR] libxrdp_force_read: header read error
[20250306-13:17:56] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:17:56] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:17:56] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:17:56] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:17:56] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:17:56] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:17:56] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:17:56] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:17:57] [ERROR] dynamic_monitor_open_response: error
[20250306-13:17:57] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:18:15] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:18:15] [ERROR] libxrdp_force_read: header read error
[20250306-13:18:15] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:18:15] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:18:15] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:18:15] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:18:15] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:18:15] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:18:15] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:18:15] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:18:16] [ERROR] dynamic_monitor_open_response: error
[20250306-13:18:16] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:19:06] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:19:06] [ERROR] libxrdp_force_read: header read error
[20250306-13:19:06] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:19:06] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:19:06] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:19:06] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:19:06] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:19:06] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:19:06] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:19:07] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:19:08] [ERROR] dynamic_monitor_open_response: error
[20250306-13:19:08] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:19:21] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:19:21] [ERROR] libxrdp_force_read: header read error
[20250306-13:19:21] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:19:21] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:19:21] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:19:21] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:19:21] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:19:21] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:19:21] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:19:22] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:19:23] [ERROR] dynamic_monitor_open_response: error
[20250306-13:19:23] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:31:03] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:31:03] [ERROR] libxrdp_force_read: header read error
[20250306-13:31:03] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:31:03] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:31:03] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:31:04] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:31:04] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:31:04] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:31:04] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:31:04] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:31:05] [ERROR] dynamic_monitor_open_response: error
[20250306-13:31:05] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:34:07] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:34:07] [ERROR] libxrdp_force_read: header read error
[20250306-13:34:07] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:34:07] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:34:08] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:34:08] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:34:08] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:34:08] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:34:08] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:34:08] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:34:09] [ERROR] dynamic_monitor_open_response: error
[20250306-13:34:09] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:34:56] [ERROR] VNC error 1 after security negotiation
[20250306-13:34:56] [ERROR] VNC error before sending share flag
[20250306-13:34:56] [ERROR] VNC error before receiving server init
[20250306-13:34:56] [ERROR] VNC error before receiving pixel format
[20250306-13:34:56] [ERROR] VNC error before receiving name length
[20250306-13:34:57] [ERROR] VNC error before receiving name
[20250306-13:34:57] [INFO ] VNC error - problem connecting
[20250306-13:34:57] [ERROR] xrdp_wm_log_msg: Error connecting to user session
[20250306-13:34:57] [INFO ] Error connecting to user session
[20250306-13:35:26] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:35:26] [ERROR] libxrdp_force_read: header read error
[20250306-13:35:26] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:35:26] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:35:26] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:35:26] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:35:26] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:35:26] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:35:26] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:35:26] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:35:27] [ERROR] dynamic_monitor_open_response: error
[20250306-13:35:27] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:41:48] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:41:48] [ERROR] libxrdp_force_read: header read error
[20250306-13:41:48] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:41:48] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:41:48] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:41:48] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:41:48] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:41:48] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:41:48] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:41:49] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:41:49] [ERROR] dynamic_monitor_open_response: error
[20250306-13:41:50] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:42:58] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:42:58] [ERROR] libxrdp_force_read: header read error
[20250306-13:42:58] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:42:58] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:42:58] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:42:58] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:42:58] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:42:58] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:42:58] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:42:59] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:43:00] [ERROR] dynamic_monitor_open_response: error
[20250306-13:43:00] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:43:14] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:43:14] [ERROR] libxrdp_force_read: header read error
[20250306-13:43:14] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:43:14] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:43:14] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:43:14] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:43:14] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:43:14] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:43:14] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:43:14] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:43:15] [ERROR] dynamic_monitor_open_response: error
[20250306-13:43:15] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
[20250306-13:50:16] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:50:16] [ERROR] libxrdp_force_read: header read error
[20250306-13:50:16] [ERROR] Processing [ITU-T T.125] Connect-Initial failed
[20250306-13:50:16] [ERROR] [MCS Connection Sequence] receive connection request failed
[20250306-13:50:16] [ERROR] xrdp_sec_incoming: xrdp_mcs_incoming failed
[20250306-13:50:16] [ERROR] xrdp_rdp_incoming: xrdp_sec_incoming failed
[20250306-13:50:16] [ERROR] xrdp_process_main_loop: libxrdp_process_incoming failed
[20250306-13:50:16] [ERROR] xrdp_iso_send: trans_write_copy_s failed
[20250306-13:50:17] [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed
[20250306-13:50:17] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20250306-13:50:18] [ERROR] dynamic_monitor_open_response: error
[20250306-13:50:18] [ERROR] xrdp_rdp_recv: xrdp_channel_process failed

user1@prom3:~$ sudo grep -i "error" /var/log/xrdp-sesman.log
[20250306-11:59:38] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-11:59:38] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-12:00:43] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-12:00:43] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-12:19:52] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-12:19:52] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-12:22:15] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-12:22:16] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-12:22:39] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-12:22:39] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:06:58] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:06:58] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:07:27] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:07:27] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:07:52] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:07:52] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:18:05] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:18:05] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:19:14] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:19:14] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:19:28] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:19:28] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:31:12] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:31:12] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:34:53] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:34:53] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:34:53] [ERROR] Error calling exec (executable: Xvnc, arguments: Xvnc :12 -auth .Xauthority -geometry 1920x1200 -depth 32 -rfbauth /home/user1/.vnc/sesman_passwd-user1@prom3:12 -bs -nolisten tcp -localhost -dpi 96) returned errno: 2, description: No such file or directory
[20250306-13:34:53] [ERROR] Error starting X server on display 12
[20250306-13:34:53] [ERROR] A fatal error has occurred attempting to start the X server on display 12, aborting connection
[20250306-13:35:03] [ERROR] There is no X server active on display 12
[20250306-13:35:03] [ERROR] A fatal error has occurred attempting to start the window manager on display 12, aborting connection
[20250306-13:35:08] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:35:08] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:35:33] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:35:33] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:41:56] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:41:56] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:43:09] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:43:09] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20250306-13:50:24] [ERROR] sesman_data_in: scp_process_msg failed
[20250306-13:50:24] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans

 ,

Alex_Golubev
()

Автозапуск bash через systemd

Пытаюсь запустить браузер гугл хром с открытием страницы яндекс. ОС дебиан.

Для этого сделал сам bash код с названием start_chrome_kiosk.sh:

#!/bin/bash
CHROME_PATH="/usr/bin/google-chrome-stable"  
START_URL="https://ya.ru/"
# Запуск OpenAI Chrome в режиме киоска
$CHROME_PATH \
    --kiosk \
    --no-first-run \
    --disable-infobars \
    --disable-session-crashed-bubble \
    --disable-features=Translate \
    "$START_URL"

Прописал chmod +x ~/start_chrome_kiosk.sh Запустил ~/start_chrome_kiosk.sh Все работает.

Далее добавляю в systemd Создал файл по пути sudo nano /etc/systemd/system/chrome-kiosk-script.service

Со следящим содержимым:

[Unit]
Description=Launch OpenAI Chrome in Kiosk Mode (Script)
After=network.target graphical.target

[Service]
User=linoxide
WorkingDirectory=/home/linoxide
ExecStart=/home/linoxide/start_chrome_kiosk.sh
Restart=on-failure
RestartSec=10


[Install]
WantedBy=multi-user.target

Далее

sudo systemctl enable chrome-kiosk-script.service
sudo systemctl start chrome-kiosk-script.service

И ни чего не запустилось.

linoxide@debian:~$ sudo systemctl restart chrome-kiosk-script.service
linoxide@debian:~$ sudo systemctl status chrome-kiosk-script.service
● chrome-kiosk-script.service - Launch OpenAI Chrome in Kiosk Mode (Script)
     Loaded: loaded (/etc/systemd/system/chrome-kiosk-script.service; enabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Sat 2025-01-18 02:03:03 AEDT; 3s ago
    Process: 14419 ExecStart=/home/linoxide/start_chrome_kiosk.sh (code=exited, status=1/FAILURE)
   Main PID: 14419 (code=exited, status=1/FAILURE)
        CPU: 55ms

 ,

Alex_Golubev
()

Научите работать с openScada

Осваиваю новое, пытаюсь учиться. Решил освоить openScada. Научился работать только с модбас. И еще понемногу. Хочу перейти к визуализации и поднять сервер. Есть какая доступная информация по openScada. С примерами. Хочу освоить. Как понимаю штука очень интересная.

 

Alex_Golubev
()

Как установить openScada на debian 11?

Как установит openScada на debian 11?

 

Alex_Golubev
()

Как в systemmd дать root права программе при запуске

Нужно для тестирования дать root права программе и проверить что программа запустилась с нужными правами. Сейчас сделал вот так:

[Unit]
Description=Qt application autostart
After=graphical.target
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=root
Grop=root
WorkingDirectory=/home/pi/Qt_Projects/SHUOT
ExecStart=/home/pi/Qt_Projects/SHUOT/SHUOT

[Install]
WantedBy=multi-user.target

 

Alex_Golubev
()

QStringList как обезопасить себя от обращения к несуществующему элементу ?

Понятно, что можно каждый раз контролировать размер size. Но это не очень удобно. Охота более простой способ. at не возвращает пустую строку.

Перемещено Zhbert из general

 

Alex_Golubev
()

Кто как обновляет программу написаную на qt5 в линукс с usb устройства в частности флешка?

Понимаю что можно скриптом на bash сделать, но может есть еще какие варианты. Программа на usb флешь может лежать где угодно. В папке каталоге. Пользователь указывает на программу и подтверждает. Далее путь к файлу передается в условно говоря программу обновления и обновляется основанная программа.

 

Alex_Golubev
()

QStateMachine как можно узнать в каком состоянии находиться машина состояний?

Как можно понять в каком состоянии «QState» находиться QStateMachine ? Как понял прямого метода нет и нужно что-то придумать.

 

Alex_Golubev
()

Pi4 управление портами ввода-вывода.

Чет не понял как управлять портами в pi4. Что-то поменяли. Раньше можно было вот так:

QFile exportFile("/sys/class/gpio/gpio19/export");
exportFile.open(QIODevice::WriteOnly);
exportFile.write("19");

QFile directionFile("/sys/class/gpio/gpio19/direction");
directionFile.open(QIODevice::WriteOnly);
directionFile.write("in");

QFile edgeFile("/sys/class/gpio/gpio19/edge");
edgeFile.open(QIODevice::WriteOnly);
edgeFile.write("body");

QFile file("/sys/class/gpio/gpio19/value");

QSocketNotifier notifier(file.handle(), QSocketNotifier::Read);
connect(&notifier, &QSocketNotifier::activated, this, &MyClass::interruptFired);

Слот interruptFired вызывался по смени фронта. А теперь как управлять?

 

Alex_Golubev
()

Как убрать консоль после загрузки ОС с экрана на pi4 ?

После подачи питания pi4 загружается и в конце загрузки остается открытая консоль ссылка . Как можно ее убрать чтобы был просто черный экран без символов. И как можно ваще все убрать в момент загрузки?

 

Alex_Golubev
()

raspberry pi 4 долгая загрузка операционной системы, охота быстрее.

Имею raspberry pi 4 линукс долго загружается. Есть возможности ускорить загрузку?

 ,

Alex_Golubev
()

Как можно построить 3 графика с одной осью 'X' и разными осями 'Y', Y1, Y2, Y3 все Y в разных маштабах

Как можно построить 3 графика с одной осью X? Чтобы сетка была едина. Накидал пример:


    QApplication a(argc, argv);

    // Создаем сцену
    QGraphicsScene *scene = new QGraphicsScene();

    // Создаем графики (QChart)
    QChart *chart1 = new QChart();
    chart1->setTitle("График 1");

    QChart *chart2 = new QChart();
    chart2->setTitle("График 2");

    QChart *chart3 = new QChart();
    chart3->setTitle("График 3");

    // Создаем линейные серии данных (QLineSeries) для каждого графика
    QLineSeries *series1 = new QLineSeries();
    series1->setName("Линия 1");
    *series1 << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10, 5);
    chart1->addSeries(series1);

    QLineSeries *series2 = new QLineSeries();
    series2->setName("Линия 2");
    *series2 << QPointF(0, 5) << QPointF(2, 7) << QPointF(3, 6) << QPointF(7, 3) << QPointF(10, 8);
    chart2->addSeries(series2);

    QLineSeries *series3 = new QLineSeries();
    series3->setName("Линия 3");
    *series3 << QPointF(0, 3) << QPointF(2, 5) << QPointF(3, 4) << QPointF(7, 2) << QPointF(10, 6);
    chart3->addSeries(series3);

    // Создаем общую ось X
    QValueAxis *axisX = new QValueAxis();
    axisX->setTitleText("Ось X");
    axisX->setLabelFormat("%i");
    axisX->setTickCount(11);

    QValueAxis *axisX1 = new QValueAxis();
    axisX1->setTitleText("Ось X");
    axisX1->setLabelFormat("%i");
    axisX1->setTickCount(11);

    QValueAxis *axisX2 = new QValueAxis();
    axisX2->setTitleText("Ось X");
    axisX2->setLabelFormat("%i");
    axisX2->setTickCount(11);

    // Создаем отдельные оси Y для каждого графика
    QValueAxis *axisY1 = new QValueAxis();
    axisY1->setTitleText("Ось Y1");
    axisY1->setLabelFormat("%i");
    axisY1->setTickCount(6);
    chart1->addAxis(axisY1, Qt::AlignLeft);
    series1->attachAxis(axisY1);

    QValueAxis *axisY2 = new QValueAxis();
    axisY2->setTitleText("Ось Y2");
    axisY2->setLabelFormat("%i");
    axisY2->setTickCount(6);
    chart2->addAxis(axisY2, Qt::AlignLeft);
    series2->attachAxis(axisY2);

    QValueAxis *axisY3 = new QValueAxis();
    axisY3->setTitleText("Ось Y3");
    axisY3->setLabelFormat("%i");
    axisY3->setTickCount(6);
    chart3->addAxis(axisY3, Qt::AlignLeft);
    series3->attachAxis(axisY3);

    // Подключаем общую ось X ко всем графикам
    chart1->addAxis(axisX, Qt::AlignBottom);
    series1->attachAxis(axisX);

    chart2->addAxis(axisX1, Qt::AlignBottom);
    series2->attachAxis(axisX1);

    chart3->addAxis(axisX2, Qt::AlignBottom);
    series3->attachAxis(axisX2);

    // Создаем виджеты для отображения графиков
    QChartView *chartView1 = new QChartView(chart1);
    QChartView *chartView2 = new QChartView(chart2);
    QChartView *chartView3 = new QChartView(chart3);

    chartView1->setRenderHint(QPainter::Antialiasing);
    chartView2->setRenderHint(QPainter::Antialiasing);
    chartView3->setRenderHint(QPainter::Antialiasing);

    // Добавляем графики на сцену
    scene->addWidget(chartView1);
    scene->addWidget(chartView2);
    scene->addWidget(chartView3);

    // Создаем представление для сцены и отображаем его
    QGraphicsView *view = new QGraphicsView(scene);
    view->setWindowTitle("Пример 3 графиков с одной осью X");
    view->resize(800, 600);
    view->show();

 

Alex_Golubev
()

QChart pi4 opengl как сделать и проверить что работает

Хочу подключить для теста к qchart opengl. пробывал делать:

OpenGLChartView *chartView;
QChart *chart;
QLineSeries *series;
QLineSeries *series1;
QLineSeries *series2;
QValueAxis  *axisY;
QValueAxis  *axisY2;
QValueAxis  *axisY3;
QDateTimeAxis *axisX;

    chart   = new QChart();
    series  = new QLineSeries();
    series1 = new QLineSeries();
    series2 = new QLineSeries();
    series->clear();
    series1->clear();
    series2->clear();
    series->setUseOpenGL(true);
    series1->setUseOpenGL(true);
    series2->setUseOpenGL(true);
    chartView = new QChartView(this);
    chartView->setRenderHint(QPainter::Antialiasing);
    ui->verticalLayout->addWidget(chartView);


    font.setPointSizeF(10);
    axisY = new QValueAxis;
    axisY->setLabelFormat("%.1f");
    axisY->setLabelsFont(font);
    axisY->setLinePen(penY);
    axisY->setRange(0, 100);

    axisY2 = new QValueAxis;
    axisY2->setLabelFormat("%.1f");
    axisY2->setLabelsFont(font);
    axisY2->setLinePen(penY2);
    axisY2->setRange(0, 1);

    axisY3 = new QValueAxis;
    axisY3->setLabelFormat("%.1f");
    axisY3->setLabelsFont(font);
    axisY3->setLinePen(penY3);
    axisY3->setRange(0, 1);

    axisX = new QDateTimeAxis;
    axisX->setFormat("HH:mm");
    axisX->setLabelsFont(font);
    axisX->setLabelsAngle(15);

   *series<<QPointF(QwtDate::toDouble(dt),lineData[4].toFloat()); 
   *series1 << QPointF(QwtDate::toDouble(dt), lineData[3].toFloat());
   *series2 << QPointF(QwtDate::toDouble(dt), lineData[2].toFloat());

        chart->addSeries(series);
        chart->addSeries(series1);
        chart->addSeries(series2);
        chart->legend()->hide();


        chart->addAxis(axisY, Qt::AlignRight);
        series->attachAxis(axisY);
        series->setPen(penY);

        chart->addAxis(axisY2, Qt::AlignRight);
        series1->attachAxis(axisY2);
        series1->setPen(penY2);


        chart->addAxis(axisY3, Qt::AlignRight);
        series2->attachAxis(axisY3);
        series2->setPen(penY3);


        chart->addAxis(axisX, Qt::AlignBottom);
        series->attachAxis(axisX);

        series1->attachAxis(axisX);
        series2->attachAxis(axisX);
        chartView->setChart(chart);

 ,

Alex_Golubev
()

Не создает файл на usb флешки

root@pi:~/folder# ls
content.xml  META-INF  mimetype  Pictures  report.odt
root@pi:~/folder# cp report.odt /media/usb0/SHUOT/Отчет.odt
cp: невозможно создать обычный файл '/media/usb0/SHUOT/Отчет.odt': Недопустимый аргумент
root@pi:~/folder# 

 ,

Alex_Golubev
()

файл созданный в qt5 с кириллицей отображается с не верной кодировкой в консоли линукс

В qt5 в main установил:

QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));

пишу файл с кириллицей:

QFile file("test.txt");
    if(file.open(QFile::Append | QFile::Text))
    {
    QTextStream out(&file);
    out << "полученные табличные данные после измерения:";
    file.flush();
    file.close();
    }

Открываю в консоли:

root@pi:~# echo $LANG
ru_RU.UTF-8

root@pi:~# cat testR.txt
полÑÑеннÑе ÑаблиÑнÑе даннÑе поÑле измеÑениÑ:анализ ÑоÑÑоÑÐ½Ð¸Ñ Ð¸ пеÑвиÑнÑй заÑÑд баÑаÑеи

Как исправить?

 

Alex_Golubev
()

В чем отличие между запусками одной программы из командной строки

Из командной строки запускаю одну программу но немного по разному.

  1. запускается верно
/home/pi/Qt_Projects/kiab/kiab -plugin tslib
  1. запускается программа но не работает тач. 2.1 сначала запускаем программу
/home/pi/Qt_Projects/kiab/kiab 

2.2 после отсылаем плагин.

-plugin tslib

2.3 получаем ошибки

ts_setup() failed (No such file or directory)

2.4 добавляю

TSLIB_TSDEVICE=/dev/input/event1
TSLIB_FBDEVICE=/dev/fb0
TSLIB_CONFFILE=/etc/ts.conf
TSLIB_CALIBFILE=/etc/pointercal
TSLIB_PLUGINDIR=/usr/lib/arm-linux-gnueabihf/ts0
QT_QPA_FB_TSLIB=1
QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0

2.5 снова -plugin tslib все сьел а тач не заработал. Так в чем отличие запуска?

Перемещено hobbit из general

 ,

Alex_Golubev
()

Куда добавить в .pro -plugin tslib, чтобы при запуски программы применялся плагин tslib

Мне нужно чтобы при запуски программы, каждый раз применялся плагин -plugin tslib. Как пример:

cd /home/pi/Qt_Projects/
cd app
./app -plugin tslib

Где app - это программа.

Куда и что нужно добавить в .pro чтобы применялся плагин -plugin tslib.

Вот файл .pro:

QT       += core gui serialport opengl svg printsupport xml

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
    SysVar.cpp \
    andreyui_2.cpp \
    banner.cpp \


HEADERS += \
    MemMap.h \
    SysVar.h \
    andreyui_2.h \
    banner.h \

FORMS += \
    andreyui_2.ui \
    banner.ui \

QMAKE_LIBDIR += /usr/lib

CONFIG += qwt
CONFIG += console
INCLUDEPATH += /usr/include/qwt

LIBS += -lmodbus -lqwt-qt5 -lz

RESOURCES += \
    resource.qrc


# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /home/pi/Qt_Projects/$${TARGET}
!isEmpty(target.path): INSTALLS += target

unix:!macx: LIBS += -L$$PWD/qdeviceWatcher/ -lQDeviceWatcher
INCLUDEPATH += $$PWD/qdeviceWatcher
DEPENDPATH += $$PWD/qdeviceWatcher

 ,

Alex_Golubev
()

qt5.15 и tslib не работают вмести.

Не работает тачскрин при запуски qt5.15. Tslib работает. ts_calibrate и ts_test работают. qt5.15 в сборки поддержка tslib включена. Пишу переменные:

root@pi:~# export QT_DEBUG_PLUGINS=1
root@pi:~# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/arm-linux-gnueabihf/
root@pi:~# export QT_PLUGIN_PATH=/usr/lib/plugins
root@pi:~# export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/plugins/platforms
root@pi:~# export QT_QPA_PLATFORM=linuxfb
root@pi:~# export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event1
root@pi:~# export TSLIB_TSEVENTTYPE='INPUT'
root@pi:~# export TSLIB_CALIBFILE='/etc/pointercal'
root@pi:~# export TSLIB_CONFFILE='/etc/ts.conf'
root@pi:~# export TSLIB_CONSOLEDEVICE='none'
root@pi:~# export TSLIB_FBDEVICE='/dev/fb0'
root@pi:~# export TSLIB_PLUGINDIR='/usr/lib/ts'
root@pi:~# export TSLIB_TSDEVICE='/dev/input/event1'
root@pi:~# 

запускаю qt. Программа запускается тач не работает.

 , ,

Alex_Golubev
()

Raspberry Pi 4 + QT5.15 + тачскрин не могу решить проблему.

Попал в засаду с линуксом. Точнее с дисплеем адвантек, а именно с тач. Не хочет работать тач в qt5.

Что делал.

Сначала подключил дисплей к малине. После выполнил команду lsusb

root@pi:~# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0eef:0001 D-WAV Scientific Co., Ltd eGalax Touch Screen
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@pi:~# 

Дальнейшее изыскания: Запустил тест evtest:

root@pi:~# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:    eGalax Inc. USB TouchController UNKNOWN
/dev/input/event1:    eGalax Inc. USB TouchController Stylus
/dev/input/event2:    eGalax Inc. USB TouchController

Выбрал 1:

root@pi:~# evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:    eGalax Inc. USB TouchController UNKNOWN
/dev/input/event1:    eGalax Inc. USB TouchController Stylus
/dev/input/event2:    eGalax Inc. USB TouchController
Select the device event number [0-2]: 1
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0xeef product 0x1 version 0x210
Input device name: "eGalax Inc. USB TouchController Stylus"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 320 (BTN_TOOL_PEN)
    Event code 330 (BTN_TOUCH)
    Event code 331 (BTN_STYLUS)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value   2008
      Min        0
      Max     4095
    Event code 1 (ABS_Y)
      Value   2052
      Min        0
      Max     4095
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
Event: time 1716869875.859086, type 4 (EV_MSC), code 4 (MSC_SCAN), value d0042
Event: time 1716869875.859086, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1716869875.859086, type 3 (EV_ABS), code 0 (ABS_X), value 1488
Event: time 1716869875.859086, type 3 (EV_ABS), code 1 (ABS_Y), value 1990
Event: time 1716869875.859086, -------------- SYN_REPORT ------------
Event: time 1716869875.874988, type 3 (EV_ABS), code 0 (ABS_X), value 1490
Event: time 1716869875.874988, -------------- SYN_REPORT ------------
Event: time 1716869875.878990, type 3 (EV_ABS), code 0 (ABS_X), value 1496
Event: time 1716869875.878990, -------------- SYN_REPORT ------------
Event: time 1716869875.885024, type 3 (EV_ABS), code 0 (ABS_X), value 1506
Event: time 1716869875.885024, -------------- SYN_REPORT ------------
Event: time 1716869875.890991, type 3 (EV_ABS), code 0 (ABS_X), value 1518

Выше показал реакции а нажатия тач. Далее пытался настроить калибровку тачскрин. Делал:

apt-get install evtest libts-bin apt-get install libts-dev export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_FBDEVICE=/dev/fb0: Калибровка запустилась и тач заработал. Далее заменил

libinput на evdev в файле nano /usr/share/X11/xorg.conf.d/40-libinput.conf

  Section "InputClass"
      Identifier "evdev tablet catchall"
      MatchIsTablet "on"
      MatchDevicePath "/dev/input/event*"
      Driver "evdev"
  EndSection

Добавил

export TSLIB_TSDEVICE=/dev/input/event1

ts_calibrate

export QWS_MOUSE_PROTO=tslib:/dev/inut/event1

Но qt не работает тач. Кнопки не нажимаются

 , ,

Alex_Golubev
()

RSS подписка на новые темы