[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
 

Re: [PROGRAMMERING] C og seriel port (USB)



On Tue, 25 Jan 2011, Henrik Pedersen wrote:

Jeg går ud fra tcgetattr og tcsetattr erstatter ioctl uden problemer.

Jep, same same.

Har prøvet at koble nogle af díne settings på uden den store succes.
Når jeg forsøger at læse fra porten med
byteCount = read(fdPort, buffer, 255);
returnere read -1, og errno er 11, når jeg så fører et tag over skifter
errno til 14.

-1 betyder det gik galt.

Kald perror() når du får en fejl. Så bliver det skrevet i tekst på skærmen.

Fejlkoder ses i man siderne: man errno

Fejlkoder er her:
/usr/include/asm-generic/errno-base.h

Nu har jeg dog fundet af at stty -F /dev/ttyUSB0 fortæller mig hvordan
porten er konfigureret, og kan i den forbindelse se om baudrate med mere
bliver sat.

Min CrystalFontz ser p.t. sådan ud (hvis det skulle hjælpe):
$ stty -F /dev/ttyUSB0
speed 19200 baud; line = 0;
eof = ^A; min = 1; time = 0;
-brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe noflsh

RFID readerens manual siger følgende:
Communication Protocol
All communication is 8 data bits, no parity, 1 stop bit, and least
significant bit first (8N1) at 2400 bps.

Hvordan får jeg sat det, og hvad betyder fejlkoderne ?

Jeg syntes det ser ud til at du får sat de nævnte flag, men der skal sættes flere flag før det virker.

Har du læst relevante man sider?

Bruger du select(2)?
http://www.lowtek.com/sockets/select.html

/hans
--
Horsebakken 78, DK-2400 København NV


 
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] *