Reading devices under /dev/.
-
Hello,
I'm using qt for cross compile with qt 5.7
How to read device mounted under /dev/. in linux from qt.?Thank you,
-
It is like RPMSG device used for communication between multiple core for linux kernel.
I'm using linux kernel 4.9.59 . -
@jigarp OK, I don't know about it. I don't think it is really a Qt related topic. Is there any documentation for this device? Any examples in C/C++?
@jsulm
This link provides information for linux drivers
https://www.kernel.org/doc/Documentation/rpmsg.txtThis will provide interface for Ti processors
http://processors.wiki.ti.com/index.php/PRU-ICSS_Remoteproc_and_RPMsg
http://processors.wiki.ti.com/index.php/PRU-ICSS_Rpmsg_DriverIt is a kind of charcter device.
I'm able to write it using QFile
don't know how to read.Sample for linux userspace commands
echo Hello > /dev/rpmsg* cat /dev/rpmsg* C^
Can you provide details for how to read and write Character Device.
Thank you
-
@jsulm
This link provides information for linux drivers
https://www.kernel.org/doc/Documentation/rpmsg.txtThis will provide interface for Ti processors
http://processors.wiki.ti.com/index.php/PRU-ICSS_Remoteproc_and_RPMsg
http://processors.wiki.ti.com/index.php/PRU-ICSS_Rpmsg_DriverIt is a kind of charcter device.
I'm able to write it using QFile
don't know how to read.Sample for linux userspace commands
echo Hello > /dev/rpmsg* cat /dev/rpmsg* C^
Can you provide details for how to read and write Character Device.
Thank you
-
In this way i'm trying to write data to rpmsg
QFile armIpcWriteMsg("/dev/rpmsg_pru30"); QTextStream outstream(&armIpcWriteMsg); qDebug() << "Writing PRU Data"; if(armIpcWriteMsg.open(QIODevice::WriteOnly)) { outstream << "Hello"; armIpcWriteMsg.close(); }
In this way i'm trying to read.
QFile armIpcReadMsg("/dev/rpmsg_pru30"); if(armIpcReadMsg.exists()) { if(armIpcReadMsg.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) { char buff[20]; armIpcReadMsg.read(buff,1); qDebug() << "PRU2ARM:" << buff; armIpcReadMsg.close(); } }
Is it the right way?
-
In this way i'm trying to write data to rpmsg
QFile armIpcWriteMsg("/dev/rpmsg_pru30"); QTextStream outstream(&armIpcWriteMsg); qDebug() << "Writing PRU Data"; if(armIpcWriteMsg.open(QIODevice::WriteOnly)) { outstream << "Hello"; armIpcWriteMsg.close(); }
In this way i'm trying to read.
QFile armIpcReadMsg("/dev/rpmsg_pru30"); if(armIpcReadMsg.exists()) { if(armIpcReadMsg.open(QIODevice::ReadOnly | QIODevice::Unbuffered)) { char buff[20]; armIpcReadMsg.read(buff,1); qDebug() << "PRU2ARM:" << buff; armIpcReadMsg.close(); } }
Is it the right way?
-
I've tried it.
I'm able to write successfully.But while trying to read file it waits until data became available.
I wan't to check for data availability before reading that file.I've tried QFileinfo by monitoring its size but it is always zero.
Is there any way to check for ready read. -
I've tried it.
I'm able to write successfully.But while trying to read file it waits until data became available.
I wan't to check for data availability before reading that file.I've tried QFileinfo by monitoring its size but it is always zero.
Is there any way to check for ready read. -
I agree!
Create a separate thread to handle the device, use (select () or poll ()) and signals to notify other classes or get to the GUI.
-
Hi,
QFileSystemWatcher might be of interest.
-
I agree!
Create a separate thread to handle the device, use (select () or poll ()) and signals to notify other classes or get to the GUI.
@Cleiton-Bueno @jsulm
In my case i'm reading this file in a thread but there are some more work involved so it is necessory to check whether data available or not.I can not wait until data available.
Is there any way to check data available like size or any other.
File.size() always responds with 0Create a separate thread to handle the device, use (select () or poll ()) and signals to notify other classes or get to the GUI.
How to use Can you provide any samples???
-
@Cleiton-Bueno @jsulm
In my case i'm reading this file in a thread but there are some more work involved so it is necessory to check whether data available or not.I can not wait until data available.
Is there any way to check data available like size or any other.
File.size() always responds with 0Create a separate thread to handle the device, use (select () or poll ()) and signals to notify other classes or get to the GUI.
How to use Can you provide any samples???
-
@jigarp said in Reading devices under /dev/.:
Not Working..
Well, with such information it is impossible to say why it is not working.
Can you show what you tried and what the result was?