summaryrefslogtreecommitdiffstats
path: root/src/common/port
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-15 15:33:27 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-15 15:33:27 -0600
commit9d6927a7d6a543332f828bffedf65eecf6774c6d (patch)
tree9f8210096908fddb7d266b477152021c45fa1a00 /src/common/port
parent3534213800bd8d151759df307755f2bbd592dfa1 (diff)
downloadpiklab-9d6927a7d6a543332f828bffedf65eecf6774c6d.tar.gz
piklab-9d6927a7d6a543332f828bffedf65eecf6774c6d.zip
Rename a number of old tq methods that are no longer tq specific
Diffstat (limited to 'src/common/port')
-rw-r--r--src/common/port/parallel.cpp28
-rw-r--r--src/common/port/parallel.h2
-rw-r--r--src/common/port/port_base.cpp6
-rw-r--r--src/common/port/serial.cpp32
-rw-r--r--src/common/port/usb_port.cpp36
5 files changed, 52 insertions, 52 deletions
diff --git a/src/common/port/parallel.cpp b/src/common/port/parallel.cpp
index daa0c6a..3d92ae0 100644
--- a/src/common/port/parallel.cpp
+++ b/src/common/port/parallel.cpp
@@ -59,12 +59,12 @@ TQStringList Port::Parallel::deviceList()
TQStringList list;
#if defined(HAVE_PPDEV)
// standard parport in user space
- for(int i = 0; i<8; ++i) list.append(TQString("/dev/parport%1").tqarg(i));
+ for(int i = 0; i<8; ++i) list.append(TQString("/dev/parport%1").arg(i));
// new devfs parport flavour
- for(int i = 0; i<8; ++i) list.append(TQString("/dev/parports/%1").tqarg(i));
+ for(int i = 0; i<8; ++i) list.append(TQString("/dev/parports/%1").arg(i));
#elif defined(HAVE_PPBUS)
// FreeBSD
- for(int i = 0; i<8; ++i) list.append(TQString("/dev/ppi%1").tqarg(i));
+ for(int i = 0; i<8; ++i) list.append(TQString("/dev/ppi%1").arg(i));
#endif
return list;
}
@@ -100,12 +100,12 @@ const Port::Parallel::PPinData Port::Parallel::PIN_DATA[Nb_Pins] = {
{ Data, 0x20, Out, "D5" }, // data 5
{ Data, 0x40, Out, "D6" }, // data 6
{ Data, 0x80, Out, "D7" }, // data 7
- { tqStatus, 0x40, In, "/ACK" }, // !ack
- { tqStatus, 0x80, In, "BUSY" }, // busy
- { tqStatus, 0x20, In, "PAPER" }, // pout
- { tqStatus, 0x10, In, "SELin" }, // select
+ { Status, 0x40, In, "/ACK" }, // !ack
+ { Status, 0x80, In, "BUSY" }, // busy
+ { Status, 0x20, In, "PAPER" }, // pout
+ { Status, 0x10, In, "SELin" }, // select
{ Control, 0x02, Out, "LF" }, // !feed
- { tqStatus, 0x08, In, "/ERROR" }, // !error
+ { Status, 0x08, In, "/ERROR" }, // !error
{ Control, 0x04, Out, "PRIME" }, // !init
{ Control, 0x08, Out, "SELout" }, // !si
{ Nb_RequestTypes, 0x00, NoIO, "GND" }, // GND
@@ -166,17 +166,17 @@ bool Port::Parallel::internalOpen()
#if defined(HAVE_PPDEV)
_fd = ::open(_device.latin1(), O_RDWR);
if ( _fd<0 ) {
- setSystemError(i18n("Could not open device \"%1\"").tqarg(_device));
+ setSystemError(i18n("Could not open device \"%1\"").arg(_device));
return false;
}
if ( ioctl(_fd, PPCLAIM)<0 ) {
- setSystemError(i18n("Could not claim device \"%1\": check it is read/write enabled").tqarg(_device));
+ setSystemError(i18n("Could not claim device \"%1\": check it is read/write enabled").arg(_device));
return false;
}
#elif defined(HAVE_PPBUS)
_fd = ::open(_device.latin1(), O_RDWR);
if ( _fd<0 ) {
- setSystemError(i18n("Could not open device \"%1\"").tqarg(_device));
+ setSystemError(i18n("Could not open device \"%1\"").arg(_device));
return false;
}
#endif
@@ -208,7 +208,7 @@ bool Port::Parallel::setPinOn(uint pin, bool on, LogicType type)
int request = REQUEST_DATA[rtype].write;
Q_ASSERT( request!=0 );
if ( ioctl(_fd, request, &c)<0 ) {
- setSystemError(i18n("Error setting pin %1 to %2").tqarg(PIN_DATA[pin].label).tqarg(on));
+ setSystemError(i18n("Error setting pin %1 to %2").arg(PIN_DATA[pin].label).arg(on));
return false;
}
_images[rtype] = c;
@@ -228,7 +228,7 @@ bool Port::Parallel::readPin(uint pin, LogicType type, bool &value)
Q_ASSERT( request!=0 );
uchar c = 0;
if ( ioctl(_fd, request, &c)<0 ) {
- setSystemError(i18n("Error reading bit on pin %1").tqarg(PIN_DATA[pin].label));
+ setSystemError(i18n("Error reading bit on pin %1").arg(PIN_DATA[pin].label));
return false;
}
_images[rtype] = c;
@@ -240,7 +240,7 @@ bool Port::Parallel::readPin(uint pin, LogicType type, bool &value)
void Port::Parallel::setSystemError(const TQString &message)
{
#if defined(HAVE_PPDEV) || defined(HAVE_PPBUS)
- log(Log::LineType::Error, message + TQString(" (errno=%1).").tqarg(strerror(errno)));
+ log(Log::LineType::Error, message + TQString(" (errno=%1).").arg(strerror(errno)));
#else
Q_UNUSED(message);
#endif
diff --git a/src/common/port/parallel.h b/src/common/port/parallel.h
index 08741e1..d25529d 100644
--- a/src/common/port/parallel.h
+++ b/src/common/port/parallel.h
@@ -33,7 +33,7 @@ public:
enum Pin { DS = 0, D0, D1, D2, D3, D4, D5, D6, D7, ACK, BUSY, PAPER, SELin,
LF, ERROR, PRIME, SELout, P18, P19, P20, P21, P22, P23, P24, P25,
Nb_Pins };
- enum RequestType { Control = 0, tqStatus, Data, Nb_RequestTypes };
+ enum RequestType { Control = 0, Status, Data, Nb_RequestTypes };
struct PPinData {
RequestType rType;
uchar mask;
diff --git a/src/common/port/port_base.cpp b/src/common/port/port_base.cpp
index 0112a1b..63e820e 100644
--- a/src/common/port/port_base.cpp
+++ b/src/common/port/port_base.cpp
@@ -28,7 +28,7 @@ void Port::Base::close()
bool Port::Base::send(const char *data, uint size, uint timeout)
{
- log(Log::DebugLevel::LowLevel, TQString("Sending: \"%1\"").tqarg(toPrintable(data, size, PrintAlphaNum)));
+ log(Log::DebugLevel::LowLevel, TQString("Sending: \"%1\"").arg(toPrintable(data, size, PrintAlphaNum)));
return internalSend(data, size, timeout);
}
@@ -45,14 +45,14 @@ bool Port::Base::receive(uint size, TQMemArray<uchar> &a, uint timeout)
{
a.resize(size);
bool ok = internalReceive(size, (char *)a.data(), timeout);
- if (ok) log(Log::DebugLevel::LowLevel, TQString("Received: \"%1\"").tqarg(toPrintable(a, PrintAlphaNum)));
+ if (ok) log(Log::DebugLevel::LowLevel, TQString("Received: \"%1\"").arg(toPrintable(a, PrintAlphaNum)));
return ok;
}
bool Port::Base::receiveChar(char &c, uint timeout)
{
if ( !internalReceive(1, &c, timeout) ) return false;
- log(Log::DebugLevel::LowLevel, TQString("Received: \"%1\"").tqarg(toPrintable(c, PrintAlphaNum)));
+ log(Log::DebugLevel::LowLevel, TQString("Received: \"%1\"").arg(toPrintable(c, PrintAlphaNum)));
return true;
}
diff --git a/src/common/port/serial.cpp b/src/common/port/serial.cpp
index 2db84b9..977f31c 100644
--- a/src/common/port/serial.cpp
+++ b/src/common/port/serial.cpp
@@ -73,21 +73,21 @@ TQStringList Port::Serial::deviceList()
TQStringList list;
#if defined(Q_OS_UNIX)
// standard serport in user space
- for (uint i=0; i<8; i++) list.append(TQString("/dev/ttyS%1").tqarg(i));
+ for (uint i=0; i<8; i++) list.append(TQString("/dev/ttyS%1").arg(i));
// new devfs serport flavour
- for (uint i=0; i<8; i++) list.append(TQString("/dev/tts/%1").tqarg(i));
+ for (uint i=0; i<8; i++) list.append(TQString("/dev/tts/%1").arg(i));
// standard USB serport in user space
- for (uint i=0; i<8; i++) list.append(TQString("/dev/ttyUSB%1").tqarg(i));
+ for (uint i=0; i<8; i++) list.append(TQString("/dev/ttyUSB%1").arg(i));
// new devfs USB serport flavour
- for (uint i=0; i<8; i++) list.append(TQString("/dev/usb/tts/%1").tqarg(i));
+ for (uint i=0; i<8; i++) list.append(TQString("/dev/usb/tts/%1").arg(i));
// FreeBSD
- for (uint i=0; i<8; i++) list.append(TQString("/dev/ttyd%1").tqarg(i));
+ for (uint i=0; i<8; i++) list.append(TQString("/dev/ttyd%1").arg(i));
// Slackware 11 devfs USB Serial port support.
- for (uint i=0; i<8; i++) list.append(TQString("/dev/tts/USB%1").tqarg(i));
+ for (uint i=0; i<8; i++) list.append(TQString("/dev/tts/USB%1").arg(i));
// MacOSX devfs USB Serial port support.
list.append("/dev/tty.usbserial");
#elif defined(Q_OS_WIN)
- for (uint i=1; i<10; i++) list.append(TQString("COM%1").tqarg(i));
+ for (uint i=1; i<10; i++) list.append(TQString("COM%1").arg(i));
#endif
return list;
}
@@ -187,7 +187,7 @@ bool Port::Serial::internalOpen()
{
_fd = openHandle(_device, In | Out);
if ( _fd==INVALID_HANDLE ) {
- setSystemError(i18n("Could not open device \"%1\" read-write").tqarg(_device));
+ setSystemError(i18n("Could not open device \"%1\" read-write").arg(_device));
return false;
}
if ( !getParameters(_oldParameters) ) return false; // save configuration
@@ -232,7 +232,7 @@ bool Port::Serial::internalSend(const char *data, uint size, uint timeout)
if ( res>0 ) todo -= res;
else {
if ( uint(time.elapsed())>timeout ) {
- log(Log::LineType::Error, i18n("Timeout sending data (%1/%2 bytes sent).").tqarg(size-todo).tqarg(size));
+ log(Log::LineType::Error, i18n("Timeout sending data (%1/%2 bytes sent).").arg(size-todo).arg(size));
return false;
}
msleep(1);
@@ -277,7 +277,7 @@ bool Port::Serial::internalReceive(uint size, char *data, uint timeout)
if ( res>0 ) todo -= res;
else {
if ( uint(time.elapsed())>timeout ) {
- log(Log::LineType::Error, i18n("Timeout receiving data (%1/%2 bytes received).").tqarg(size-todo).tqarg(size));
+ log(Log::LineType::Error, i18n("Timeout receiving data (%1/%2 bytes received).").arg(size-todo).arg(size));
return false;
}
msleep(1);
@@ -303,7 +303,7 @@ bool Port::Serial::drain(uint timeout)
if ( nb==0 ) break;
if ( uint(time.elapsed())>timeout ) {
_fd = INVALID_HANDLE; // otherwise close blocks...
- log(Log::LineType::Error, i18n("Timeout sending data (%1 bytes left).").tqarg(nb));
+ log(Log::LineType::Error, i18n("Timeout sending data (%1 bytes left).").arg(nb));
return false;
}
}
@@ -364,7 +364,7 @@ bool Port::Serial::setPinOn(uint pin, bool on, LogicType type)
Q_ASSERT( pin<Nb_Pins );
Q_ASSERT( PIN_DATA[pin].dir==Out );
if ( !internalSetPinOn(Pin(pin), on) ) {
- setSystemError(i18n("Error setting bit %1 of serial port to %2").tqarg(PIN_DATA[pin].label).tqarg(on));
+ setSystemError(i18n("Error setting bit %1 of serial port to %2").arg(PIN_DATA[pin].label).arg(on));
return false;
}
return true;
@@ -387,7 +387,7 @@ bool Port::Serial::internalReadPin(Pin pin, LogicType type, bool &value)
return true;
#elif defined(Q_OS_WIN)
DWORD status;
- if ( GetCommModemtqStatus(_fd, &status)==0 ) return false;
+ if ( GetCommModemStatus(_fd, &status)==0 ) return false;
switch (pin) {
case DCD: value = (status & MS_RLSD_ON); break;
case DSR: value = (status & MS_DSR_ON); break;
@@ -406,7 +406,7 @@ bool Port::Serial::internalReadPin(Pin pin, LogicType type, bool &value)
Q_ASSERT( pin<Nb_Pins );
Q_ASSERT( PIN_DATA[pin].dir==In );
if ( !internalReadPin(Pin(pin), type, value) ) {
- setSystemError(i18n("Error reading serial pin %1").tqarg(PIN_DATA[pin].label));
+ setSystemError(i18n("Error reading serial pin %1").arg(PIN_DATA[pin].label));
return false;
}
return true;
@@ -513,11 +513,11 @@ bool Port::Serial::setHardwareFlowControl(bool on)
void Port::Serial::setSystemError(const TQString &message)
{
#if defined(Q_OS_UNIX)
- log(Log::LineType::Error, message + TQString(" (errno=%1)").tqarg(strerror(errno)));
+ log(Log::LineType::Error, message + TQString(" (errno=%1)").arg(strerror(errno)));
#elif defined(Q_OS_WIN)
LPVOID lpMsgBuf;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&lpMsgBuf, 0, NULL);
- log(Log::LineType::Error, message + TQString(" (last error=%1 %2)").tqarg(GetLastError()).tqarg((const char *)(LPCTSTR)lpMsgBuf));
+ log(Log::LineType::Error, message + TQString(" (last error=%1 %2)").arg(GetLastError()).arg((const char *)(LPCTSTR)lpMsgBuf));
LocalFree(lpMsgBuf);
#endif
}
diff --git a/src/common/port/usb_port.cpp b/src/common/port/usb_port.cpp
index 80e7de2..76fa5b0 100644
--- a/src/common/port/usb_port.cpp
+++ b/src/common/port/usb_port.cpp
@@ -38,7 +38,7 @@ void Port::USB::initialize()
#ifdef HAVE_USB
usb_init();
VersionData vd = VersionData::fromString(LIBUSB_VERSION);
- TQString s = TQString("libusb %1").tqarg(vd.pretty());
+ TQString s = TQString("libusb %1").arg(vd.pretty());
if ( vd<VersionData(0, 1, 8) ) qWarning("%s: may be too old (you need at least version 0.1.8)", s.latin1());
#endif
}
@@ -132,7 +132,7 @@ TQStringList Port::USB::probedDeviceList()
for (struct usb_device *dev=bus->devices; dev; dev=dev->next) {
if ( dev->descriptor.idVendor==0 ) continue; // controller
list.append(TQString("Vendor Id: %1 - Product Id: %2")
- .tqarg(toLabel(NumberBase::Hex, dev->descriptor.idVendor, 4)).tqarg(toLabel(NumberBase::Hex, dev->descriptor.idProduct, 4)));
+ .arg(toLabel(NumberBase::Hex, dev->descriptor.idVendor, 4)).arg(toLabel(NumberBase::Hex, dev->descriptor.idProduct, 4)));
}
}
#endif
@@ -179,7 +179,7 @@ Port::USB::~USB()
void Port::USB::setSystemError(const TQString &message)
{
#ifdef HAVE_USB
- log(Log::LineType::Error, message + TQString(" (err=%1).").tqarg(usb_strerror()));
+ log(Log::LineType::Error, message + TQString(" (err=%1).").arg(usb_strerror()));
#else
log(Log::LineType::Error, message);
#endif
@@ -192,7 +192,7 @@ void Port::USB::tryToDetachDriver()
log(Log::DebugLevel::Extra, "find if there is already an installed driver");
char dname[256] = "";
if ( usb_get_driver_np(_handle, _interface, dname, 255)<0 ) return;
- log(Log::DebugLevel::Normal, TQString(" a driver \"%1\" is already installed...").tqarg(dname));
+ log(Log::DebugLevel::Normal, TQString(" a driver \"%1\" is already installed...").arg(dname));
# if defined(LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP) && LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
usb_detach_kernel_driver_np(_handle, _interface);
log(Log::DebugLevel::Normal, " try to detach it...");
@@ -208,10 +208,10 @@ bool Port::USB::internalOpen()
_device = findDevice(_vendorId, _productId);
if ( _device==0 ) {
log(Log::LineType::Error, i18n("Could not find USB device (vendor=%1 product=%2).")
- .tqarg(toLabel(NumberBase::Hex, _vendorId, 4)).tqarg(toLabel(NumberBase::Hex, _productId, 4)));
+ .arg(toLabel(NumberBase::Hex, _vendorId, 4)).arg(toLabel(NumberBase::Hex, _productId, 4)));
return false;
}
- log(Log::DebugLevel::Extra, TQString("found USB device as \"%1\" on bus \"%2\"").tqarg(_device->filename).tqarg(_device->bus->dirname));
+ log(Log::DebugLevel::Extra, TQString("found USB device as \"%1\" on bus \"%2\"").arg(_device->filename).arg(_device->bus->dirname));
_handle = usb_open(_device);
if ( _handle==0 ) {
setSystemError(i18n("Error opening USB device."));
@@ -239,11 +239,11 @@ bool Port::USB::internalOpen()
uint old = _config;
i = 0;
_config = _device->config[i].bConfigurationValue;
- log(Log::LineType::Warning, i18n("Configuration %1 not present: using %2").tqarg(old).tqarg(_config));
+ log(Log::LineType::Warning, i18n("Configuration %1 not present: using %2").arg(old).arg(_config));
}
const usb_config_descriptor &configd = _device->config[i];
if ( usb_set_configuration(_handle, _config)<0 ) {
- setSystemError(i18n("Error setting USB configuration %1.").tqarg(_config));
+ setSystemError(i18n("Error setting USB configuration %1.").arg(_config));
return false;
}
for (i=0; i<configd.bNumInterfaces; i++)
@@ -252,15 +252,15 @@ bool Port::USB::internalOpen()
uint old = _interface;
i = 0;
_interface = configd.interface[i].altsetting[0].bInterfaceNumber;
- log(Log::LineType::Warning, i18n("Interface %1 not present: using %2").tqarg(old).tqarg(_interface));
+ log(Log::LineType::Warning, i18n("Interface %1 not present: using %2").arg(old).arg(_interface));
}
_private->_interface = &(configd.interface[i].altsetting[0]);
if ( usb_claim_interface(_handle, _interface)<0 ) {
- setSystemError(i18n("Could not claim USB interface %1").tqarg(_interface));
+ setSystemError(i18n("Could not claim USB interface %1").arg(_interface));
return false;
}
- log(Log::DebugLevel::Max, TQString("alternate setting is %1").tqarg(_private->_interface->bAlternateSetting));
- log(Log::DebugLevel::Max, TQString("USB bcdDevice: %1").tqarg(toHexLabel(_device->descriptor.bcdDevice, 4)));
+ log(Log::DebugLevel::Max, TQString("alternate setting is %1").arg(_private->_interface->bAlternateSetting));
+ log(Log::DebugLevel::Max, TQString("USB bcdDevice: %1").arg(toHexLabel(_device->descriptor.bcdDevice, 4)));
return true;
#else
log(Log::LineType::Error, i18n("USB support disabled"));
@@ -343,7 +343,7 @@ bool Port::USB::write(uint ep, const char *data, uint size)
IODir dir = endpointDir(ep);
EndpointMode mode = endpointMode(ep);
log(Log::DebugLevel::LowLevel, TQString("write to endpoint %1 (%2 - %3) %4 chars: \"%5\"")
- .tqarg(toHexLabel(ep, 2)).tqarg(ENDPOINT_MODE_NAMES[mode]).tqarg(IO_DIR_NAMES[dir]).tqarg(size).tqarg(toPrintable(data, size, PrintEscapeAll)));
+ .arg(toHexLabel(ep, 2)).arg(ENDPOINT_MODE_NAMES[mode]).arg(IO_DIR_NAMES[dir]).arg(size).arg(toPrintable(data, size, PrintEscapeAll)));
Q_ASSERT( dir==Out );
TQTime time;
time.start();
@@ -356,8 +356,8 @@ bool Port::USB::write(uint ep, const char *data, uint size)
//qDebug("res: %i", res);
if ( res==todo ) break;
if ( uint(time.elapsed())>3000 ) { // 3 s
- if ( res<0 ) setSystemError(i18n("Error sending data (ep=%1 res=%2)").tqarg(toHexLabel(ep, 2)).tqarg(res));
- else log(Log::LineType::Error, i18n("Timeout: only some data sent (%1/%2 bytes).").tqarg(size-todo).tqarg(size));
+ if ( res<0 ) setSystemError(i18n("Error sending data (ep=%1 res=%2)").arg(toHexLabel(ep, 2)).arg(res));
+ else log(Log::LineType::Error, i18n("Timeout: only some data sent (%1/%2 bytes).").arg(size-todo).arg(size));
return false;
}
if ( res==0 ) log(Log::DebugLevel::Normal, i18n("Nothing sent: retrying..."));
@@ -377,7 +377,7 @@ bool Port::USB::read(uint ep, char *data, uint size, bool *poll)
IODir dir = endpointDir(ep);
EndpointMode mode = endpointMode(ep);
log(Log::DebugLevel::LowLevel, TQString("read from endpoint %1 (%2 - %3) %4 chars")
- .tqarg(toHexLabel(ep, 2)).tqarg(ENDPOINT_MODE_NAMES[mode]).tqarg(IO_DIR_NAMES[dir]).tqarg(size));
+ .arg(toHexLabel(ep, 2)).arg(ENDPOINT_MODE_NAMES[mode]).arg(IO_DIR_NAMES[dir]).arg(size));
Q_ASSERT( dir==In );
TQTime time;
time.start();
@@ -390,8 +390,8 @@ bool Port::USB::read(uint ep, char *data, uint size, bool *poll)
//qDebug("res: %i", res);
if ( res==todo ) break;
if ( uint(time.elapsed())>3000 ) { // 3 s: seems to help icd2 in some case (?)
- if ( res<0 ) setSystemError(i18n("Error receiving data (ep=%1 res=%2)").tqarg(toHexLabel(ep, 2)).tqarg(res));
- else log(Log::LineType::Error, i18n("Timeout: only some data received (%1/%2 bytes).").tqarg(size-todo).tqarg(size));
+ if ( res<0 ) setSystemError(i18n("Error receiving data (ep=%1 res=%2)").arg(toHexLabel(ep, 2)).arg(res));
+ else log(Log::LineType::Error, i18n("Timeout: only some data received (%1/%2 bytes).").arg(size-todo).arg(size));
return false;
}
if ( res==0 ) {