SamithChathuranga / qextserialport

Automatically exported from code.google.com/p/qextserialport
Other
0 stars 0 forks source link

can't open port USB in debian #137

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.can't open port
2.
3.

What is the expected output? What do you see instead?

sp->open(QIODevice::ReadWrite| QIODevice::Unbuffered) is always false

What version of the product are you using? On what operating system?

qextserialport-1.2beta2

Please provide any additional information below.

    QString var = "/dev/" + ui->comboBox->currentText();

    var=var.toAscii().data();

   sp= new QextSerialPort(var, QextSerialPort::EventDriven);

    sp->setBaudRate(BAUD9600);
    sp->setFlowControl(FLOW_OFF);
    sp->setParity(PAR_NONE);
    sp->setDataBits(DATA_8);
    sp->setStopBits(STOP_1);
    sp->setTimeout(100);
    if (sp->open(QIODevice::ReadWrite| QIODevice::Unbuffered)==true) {

        connect(sp, SIGNAL(readyRead()), this, SLOT(onReadyRead_serie()));
        ui->lineEdit_3->setText("Conectado");
        ui->pushButton->setDisabled(1);
        ui->pushButton_3->setEnabled(1);
        ui->pushButton_2->setEnabled(1);

    }else{
        qDebug() << "port:" << sp->errorString();  // always port: "Permission denied" 
        ui->lineEdit_3->setText("No Conectado");
    }

}

Original issue reported on code.google.com by alvar...@egresados.ubiobio.cl on 22 Jun 2012 at 7:27

GoogleCodeExporter commented 8 years ago
;-) Look the same as Issue 136

First, "qDebug()<<var" to see whether the portname is right.

Then, 
you can write a simple program to test the return value of:

::open("/dev/ttyUSB0" ,O_RDWR | O_NOCTTY | O_NDELAY)

to see whether it equals -1 or not.

Regards,

Debao

Original comment by dbzhang...@gmail.com on 27 Jun 2012 at 6:23

GoogleCodeExporter commented 8 years ago
In linux, my app only opens the port if the app is running with "root" user.
How to fix it?
I need to fix this problem...

Original comment by da...@supridatta.com.br on 6 Aug 2012 at 9:03

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
maybe you should add your user to the dialout group, or whatever group your 
device belongs to.

Original comment by yangyj...@gmail.com on 14 Aug 2012 at 9:37

GoogleCodeExporter commented 8 years ago
Yes You need to add the users to dialout group!
In debian/ubuntu you could use this:

"awk -F: '$3 > 999 {print $1}' /etc/passwd | xargs -I USERNAME sudo usermod -a 
-G dialout USERNAME"

Original comment by da...@supridatta.com.br on 6 Dec 2012 at 7:29