Reading devices under /dev/.
-
wrote on 22 Mar 2018, 10:07 last edited by jigarp
It is like RPMSG device used for communication between multiple core for linux kernel.
I'm using linux kernel 4.9.59 . -
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++?
-
@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++?
wrote on 22 Mar 2018, 10:19 last edited by jigarp@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
@jigarp You read like any other file
-
wrote on 22 Mar 2018, 11:49 last edited by
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?
@jigarp Should be OK. Did you try it out?
-
wrote on 22 Mar 2018, 13:33 last edited by
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.@jigarp I don't think there is anything in Qt for that.
I see two possibilities:- Use a second thread where you call read()
- Use C API call select() (see man select)
-
wrote on 22 Mar 2018, 14:25 last edited by
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.
wrote on 23 Mar 2018, 03:55 last edited by jigarp@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?
12/16