[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

C og seriel port (USB)



Hejsan

Jeg er ved at rykke håret ud over det her problem.
Jeg har en RFID læser til USB, med almindelig seriel IF.

Når jeg anvender minicom og sætter porten korekt op, fungere det som det 
skal. 2400 baud, 8n1.
Men jeg kan simpelthen ikke få det til at virke i c.
read() returnere -11 før jeg fører et tag forbi læseren, og -14 når den har 
aflæst et tag.

Jeg har forsøgt stort set alt jeg har kunne finde på google, uden succes.
Seneste forsøg ser således ud:
    fdPort = open(path, O_RDWR | O_NOCTTY | O_NDELAY);
    struct termios oldtio, newtio;
    tcgetattr(fdPort, &oldtio);
    //    cfsetispeed(&oldtio, B2400); // set baud rates
    //    cfsetospeed(&oldtio, B2400);
    oldtio.c_cflag &= ~PARENB; // set no parity, stop bits, data bits
    oldtio.c_cflag &= ~CBAUD;
    oldtio.c_cflag |= B2400;
    oldtio.c_cflag |= CS8;
    tcsetattr(fdPort, TCSANOW, &oldtio); // apply the settings to the port

Gode bud søges ?

\Henrik


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2011-02-01, 02:01 CET [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *