linux
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#include "pikbdlistener.h"
|
||||
|
||||
#include "piincludes_p.h"
|
||||
#include "piliterals.h"
|
||||
#ifndef WINDOWS
|
||||
# include <termios.h>
|
||||
#else
|
||||
@@ -147,7 +148,7 @@ PRIVATE_DEFINITION_END(PIKbdListener)
|
||||
|
||||
|
||||
PIKbdListener::PIKbdListener(KBFunc slot, void * _d, bool startNow): PIThread() {
|
||||
setName("keyboard_listener");
|
||||
setName("keyboard_listener"_a);
|
||||
_object = this;
|
||||
#ifdef WINDOWS
|
||||
PRIVATE->hIn = GetStdHandle(STD_INPUT_HANDLE);
|
||||
@@ -526,7 +527,7 @@ void PIKbdListener::readKeyboard() {
|
||||
cout << "'" << (char)(rc[i]) << "' ";
|
||||
cout << endl;*/
|
||||
}
|
||||
if (ke.key == 0 && PRIVATE->ret > 1) ke.key = PIChar(rc).unicode16Code();
|
||||
if (ke.key == 0 && PRIVATE->ret > 1) ke.key = PIChar::fromSystem(rc).unicode16Code();
|
||||
#endif
|
||||
if ((rc[0] == '\n' || rc[0] == '\r') && PRIVATE->ret == 1) ke.key = Return;
|
||||
if (exit_enabled && ke.key == exit_key) {
|
||||
|
||||
@@ -1199,7 +1199,7 @@ PIVector<PISerial::DeviceInfo> PISerial::availableDevicesInfo(bool test) {
|
||||
# endif
|
||||
PIFile file_prefixes("/proc/tty/drivers", PIIODevice::ReadOnly);
|
||||
if (file_prefixes.open()) {
|
||||
PIString fc = file_prefixes.readAll(true), line, cpref;
|
||||
PIString fc = PIString::fromAscii(file_prefixes.readAll(true)), line, cpref;
|
||||
PIStringList words;
|
||||
file_prefixes.close();
|
||||
while (!fc.isEmpty()) {
|
||||
@@ -1236,10 +1236,11 @@ PIVector<PISerial::DeviceInfo> PISerial::availableDevicesInfo(bool test) {
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
fpath += "../";
|
||||
// piCout << "try" << fpath;
|
||||
if (_f.open(fpath + "idVendor", PIIODevice::ReadOnly)) di.vID = PIString(_f.readAll()).trim().toInt(16);
|
||||
if (_f.open(fpath + "idProduct", PIIODevice::ReadOnly)) di.pID = PIString(_f.readAll()).trim().toInt(16);
|
||||
if (_f.open(fpath + "product", PIIODevice::ReadOnly)) di.description = PIString(_f.readAll()).trim();
|
||||
if (_f.open(fpath + "manufacturer", PIIODevice::ReadOnly)) di.manufacturer = PIString(_f.readAll()).trim();
|
||||
if (_f.open(fpath + "idVendor", PIIODevice::ReadOnly)) di.vID = PIString::fromAscii(_f.readAll()).trim().toInt(16);
|
||||
if (_f.open(fpath + "idProduct", PIIODevice::ReadOnly)) di.pID = PIString::fromAscii(_f.readAll()).trim().toInt(16);
|
||||
if (_f.open(fpath + "product", PIIODevice::ReadOnly)) di.description = PIString::fromUTF8(_f.readAll()).trim();
|
||||
if (_f.open(fpath + "manufacturer", PIIODevice::ReadOnly))
|
||||
di.manufacturer = PIString::fromUTF8(_f.readAll()).trim();
|
||||
if (di.pID > 0) break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "pidir.h"
|
||||
#include "piincludes_p.h"
|
||||
#include "piliterals.h"
|
||||
#include "piprocess.h"
|
||||
#include "pisysteminfo.h"
|
||||
#include "pitime_win.h"
|
||||
@@ -84,7 +85,7 @@ PISystemMonitor::PISystemMonitor(): PIThread() {
|
||||
PRIVATE->mem_cnt.cb = sizeof(PRIVATE->mem_cnt);
|
||||
# endif
|
||||
#endif
|
||||
setName("system_monitor");
|
||||
setName("system_monitor"_a);
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +209,7 @@ void PISystemMonitor::run() {
|
||||
// piCout << (PRIVATE->cpu_u_cur - PRIVATE->cpu_u_prev).toMilliseconds() / delay_;
|
||||
# else
|
||||
PRIVATE->file.seekToBegin();
|
||||
PIString str(PRIVATE->file.readAll(true));
|
||||
PIString str = PIString::fromAscii(PRIVATE->file.readAll(true));
|
||||
int si = str.find('(') + 1, fi = 0, cc = 1;
|
||||
for (int i = si; i < str.size_s(); ++i) {
|
||||
if (str[i] == '(') cc++;
|
||||
@@ -246,7 +247,7 @@ void PISystemMonitor::run() {
|
||||
// piCout << sl[0] << sl[12] << sl[13];
|
||||
|
||||
PRIVATE->filem.seekToBegin();
|
||||
str = PRIVATE->filem.readAll(true);
|
||||
str = PIString::fromAscii(PRIVATE->filem.readAll(true));
|
||||
sl = str.split(" ");
|
||||
if (sl.size_s() < 6) return;
|
||||
tstat.virtual_memsize = sl[0].toLong() * page_size;
|
||||
@@ -352,7 +353,7 @@ void PISystemMonitor::gatherThread(llong id) {
|
||||
PIFile f(PRIVATE->proc_dir + "task/" + PIString::fromNumber(id) + "/stat");
|
||||
// piCout << f.path();
|
||||
if (!f.open(PIIODevice::ReadOnly)) return;
|
||||
PIString str = f.readAll(true);
|
||||
PIString str = PIString::fromAscii(f.readAll(true));
|
||||
int si = str.find('(') + 1, fi = 0, cc = 1;
|
||||
for (int i = si; i < str.size_s(); ++i) {
|
||||
if (str[i] == '(') cc++;
|
||||
|
||||
Reference in New Issue
Block a user