how to create App for communicate with device through USB serial communication
-
@vicksoccer , are you sure that you have a right permissions to open the ttyACM device? You can search required info in google. What is an error code?
-
@kuzulis
getting segmentation fault error in first line of qserialport code..usb->setPortName(port);
usb->setBaudRate(QSerialPort::Baud9600);
usb->setDataBits(QSerialPort::Data8);
usb->setParity(QSerialPort::EvenParity);
usb->setStopBits(QSerialPort::OneStop);
usb->setFlowControl(QSerialPort::NoFlowControl);
if (usb->open(QIODevice::ReadWrite)) {
qDebug() << "Port open success!!";
} else {
qDebug() << "Port open failed!!";
}
nothing is happened with qserialport only port detection is succeed. I Dont know why, search on google also.. -
Thanks all for your kind support!!!
Problem solved.. Its done with qserialport itself,
Now my device port is opened need to work on send commands.. -
Hi
If possible, could you tell how you made the
segmentation fault error go away?
What was the issue and fix. -
@mrjj
I think fault is due to initialization of port is not proper.
this work for me for setting available device port and open it.QSerialPort usb = new QSerialPort(port);
usb->setBaudRate(QSerialPort::Baud9600);
usb->setDataBits(QSerialPort::Data8);
usb->setParity(QSerialPort::EvenParity);
usb->setStopBits(QSerialPort::OneStop);
usb->setFlowControl(QSerialPort::NoFlowControl);
if (usb->open(QIODevice::ReadWrite)) {
qDebug() << "Port open success!!";
} else {
qDebug() << "Port open failed!! + usb->errorString()";
} -
Hi
So you added the line
QSerialPort *usb = new QSerialPort(port);and it then worked or something else ?
-
@mrjj
Yes I have added this line only and its worked for me.. -
@vicksoccer Keep in mind that if you defined this "usb" variable somewhere else you're creating a new one with same name now.
If you already have one then do it like this:usb = new QSerialPort(port);
-
@jsulm
Yes,Sure :)
Thanks -
I thought we are talking about HID devices ?
Whatever, if you need driver support for USB HID devices take look at www.hidxplat.com.
Thanks sammy