listing available devices in ComboBox
-
Re: Get the list of available audio devices in Linux
Hi,
I want to display the devices listed under /dev/ttyACM* as the ComboBox inputs.
Can we make this output as a input to the ComboBox? and How?Please guide me on this!
Thanks in advance!!
Regards,
Kripashree -
Re: Get the list of available audio devices in Linux
Hi,
I want to display the devices listed under /dev/ttyACM* as the ComboBox inputs.
Can we make this output as a input to the ComboBox? and How?Please guide me on this!
Thanks in advance!!
Regards,
Kripashree@kripashree said in listing available devices in ComboBox:
Can we make this output as a input to the ComboBox? and How?
comboBox->addItems( QDir("/dev/ttyACM").entryList() ); -
Hi Raven,
It is not displaying any combobox options!! now combobox is empty after adding your code!!
Regards,
Kripashree -
Hi Raven,
It is not displaying any combobox options!! now combobox is empty after adding your code!!
Regards,
KripashreecomboBox->addItems( QDir("/dev").entryList().filter("/dev/ttyACM"); -
comboBox->addItems( QDir("/dev").entryList().filter("/dev/ttyACM"); -
This also not working!! combobox is empty!!
-
@jsulm I have the strange feeling it does not work because the
tty*entries are no regular files, but character devices. For me, evenQDir("/dev").entryList();only gives the subdirectories, not the devices itself.@aha_1980 I don't have a linux system here to test, but is that also the case, if you specify
QDir::AllEntriesandQDir::HiddenandQDir::Systemas filters ?Especially
Systemseems to be important:List system files (on Unix, FIFOs, sockets and device files are included...)
-
@aha_1980 I don't have a linux system here to test, but is that also the case, if you specify
QDir::AllEntriesandQDir::HiddenandQDir::Systemas filters ?Especially
Systemseems to be important:List system files (on Unix, FIFOs, sockets and device files are included...)
@J.Hilk said in listing available devices in ComboBox:
QDir::System
Thanks, that helped :)
The following code shows all
ttydevices on my Ubuntu system:#include <QDir> #include <QDebug> int main(int argc, char *argv[]) { const QStringList entries = QDir("/dev").entryList(QDir::System).filter("tty"); qDebug() << entries; }Output:
10:16:37: Starting DirEntryList... ("tty", "tty0", "tty1", "tty10", "tty11", "tty12", "tty13", "tty14", "tty15", "tty16", "tty17", "tty18", "tty19", "tty2", "tty20", "tty21", "tty22", "tty23", "tty24", "tty25", "tty26", "tty27", "tty28", "tty29", "tty3", "tty30", "tty31", "tty32", "tty33", "tty34", "tty35", "tty36", "tty37", "tty38", "tty39", "tty4", "tty40", "tty41", "tty42", "tty43", "tty44", "tty45", "tty46", "tty47", "tty48", "tty49", "tty5", "tty50", "tty51", "tty52", "tty53", "tty54", "tty55", "tty56", "tty57", "tty58", "tty59", "tty6", "tty60", "tty61", "tty62", "tty63", "tty7", "tty8", "tty9", "ttyprintk", "ttyS0", "ttyS1", "ttyS10", "ttyS11", "ttyS12", "ttyS13", "ttyS14", "ttyS15", "ttyS16", "ttyS17", "ttyS18", "ttyS19", "ttyS2", "ttyS20", "ttyS21", "ttyS22", "ttyS23", "ttyS24", "ttyS25", "ttyS26", "ttyS27", "ttyS28", "ttyS29", "ttyS3", "ttyS30", "ttyS31", "ttyS4", "ttyS5", "ttyS6", "ttyS7", "ttyS8", "ttyS9") 10:16:37: DirEntryList exited with code 0Porting that to a
QComboBoxshould be easy... -
comboBox->addItems( QDir("/dev").entryList().filter("/dev/ttyACM");@jsulm Thank you.
comboBox->addItems( QDir("/dev").entryList().filter("/dev/ttyACM"); This is helped.
-
@jsulm Thank you.
comboBox->addItems( QDir("/dev").entryList().filter("/dev/ttyACM"); This is helped.
@kripashree then please mark this topic as SOLVED. Thanks