Date: Mon, 2 Apr 2001 21:41:15 +0000 From: David <david@angra.uac.pt> To: questions@FreeBSD.org Subject: Working with the serial port (cuaa0) Message-ID: <01040221502102.04098@david>
next in thread | raw e-mail | index | archive | help
--Boundary-=_eLgtKDcpCrgJOXsduHEhGLIBezgR Content-Type: text/plain Content-Transfer-Encoding: 8bit Hello! I was working with Mandrake but after finding some bugs in the operating system, I decided to move to freeBSD. I'm programming communications via RS-232 serial port. I'm using the same source code (except the change ttyS0 <-> cuaa0) that I was using with Mandrake but now I can't read from the serial port . I can write, though... Is ther any other change I have to the in my source in order to be able to read from the port? I'm sending my source code for the case someone can help ... Cheers David ------------------------------------------------------------ David Sousa Mendes LAMTec- Laboratório de Ambiente Marinho e Tecnologias Telefone : 96.4470312 Residência : R. da Graça, nº 90 9760 - Praia da Vitória Ilha Terceira --Boundary-=_eLgtKDcpCrgJOXsduHEhGLIBezgR Content-Type: text/x-c; name="parent.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="parent.c" I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzaWduYWwuaD4KI2luY2x1ZGUgPHN0ZGxpYi5o PgojaW5jbHVkZSA8ZmNudGwuaD4JCiNpbmNsdWRlIDx1bmlzdGQuaD4JCiNpbmNsdWRlIDx0ZXJt aW9zLmg+CiNpbmNsdWRlIDxzeXMvdGltZS5oPgojaW5jbHVkZSA8bWF0aC5oPgojaW5jbHVkZSA8 dGltZS5oPgoKCgoKCi8qKioqKioqKioqKioqKioqKioqKioqRGVmLiBleHRlcm5hbCB2YXJpYWJs ZXMqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCmludCBmZDsKc3RydWN0IHRl cm1pb3Mgb2xkdGlvOwovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCgoKCgoKCgoKLyoqKioqKioq KioqKioqKioqKioqKioqKioqKioqc2lnbmFsIGZ1bmN0aW9uKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqLwp2b2lkIHNpZ19oYW5kbGVyKGludCBzaWdudW0pCnsKZXh0ZXJuIGlu dCBmZDsKZXh0ZXJuIHN0cnVjdCB0ZXJtaW9zIG9sZHRpbzsKCnByaW50ZigicmVjZWl2ZWQgU0lH SU5UXG4iKTtmZmx1c2goc3Rkb3V0KTsKaWYoICAgICB0Y3NldGF0dHIoZmQsVENTQU5PVywmb2xk dGlvKT09LTEgICAgKQoJewogICAgCXBlcnJvcigiIGVycm8gZW0gdGNzZXRhdHRyIik7CiAgICAg ICAgZXhpdCgwKTsKCX0KY2xvc2UoZmQpOwpleGl0KDEpOyAKCn0KLyoqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqLwoKCgoKCgoKaW50IG1haW4odm9pZCl7CgoKLyoqKioqKioqKioqKioqKioqKioqRGVm LiBhdXRvbWF0aWMgZnVuY3Rpb25zKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq Ki8KZXh0ZXJuIGludCBmZDsKZXh0ZXJuIHN0cnVjdCB0ZXJtaW9zIG9sZHRpbzsKRklMRSAqIFJT OwppbnQgcmVzLCBuLGk7CmNoYXIgYnVmWzI1NV07CnN0cnVjdCB0ZXJtaW9zICBuZXd0aW87CnN0 cnVjdCBzaWdhY3Rpb24gc2E7ICAKLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioq KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwoKCgoKCgoKCi8q KioqKioqKioqKioqKioqKioqKioqIGluc3RhbGwgc2lnbmFsIGhhbmRsZXIgZm9yIFNJR0lOVCwg Q1RSTCtDICoqKioqKioqKioqKioqKi8Kc2Euc2FfaGFuZGxlciA9IHNpZ19oYW5kbGVyOwpzaWdl bXB0eXNldCgmc2Euc2FfbWFzayk7CnNhLnN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UkUnUyBXSEVS RSBJJ00gVFJZSU5HIFRPIFJFQUQhIQoKaT1nZXRjKFJTKTtwcmludGYoIiVkIixpKTtmZmx1c2go c3Rkb3V0KTsgICAgICAgICAvL0VJVEhFUiBXSVRIIFRISVMgQ09NTUFORCBMSU5FIE9SCnJlcz1y ZWFkKGZkLGJ1ZiwxMDApO2J1ZltyZXNdPTA7cHJpbnRmKCIlcyIsYnVmKTtmZmx1c2goc3Rkb3V0 KTsgICAgIC8vV0lUSCBUSElTIE9ORQoKCgoKCmlmKCAgICAgdGNzZXRhdHRyKGZkLFRDU0FEUkFJ Tiwmb2xkdGlvKT09LTEgICAgKQoJewogICAgCXBlcnJvcigiIGVycm8gZW0gdGNzZXRhdHRyIik7 CiAgICAgICAgZXhpdCgwKTsKCX0KCgpleGl0KDApOwp9CgoK --Boundary-=_eLgtKDcpCrgJOXsduHEhGLIBezgR-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?01040221502102.04098>