Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Linux stty

  1. #1
    The comeback tour
    Join Date
    Feb 2008
    Location
    On the wrong planet
    Posts
    6,732

    Default Linux stty

    stty -F /dev/ttyUSB0 57650 raw

    it doesn't like it (invalid argument 57650), it swallows

    stty -F /dev/ttyUSB0 ispeed 57650 ospeed 57650 raw

    but the output from a subsequent query implies the instructions to change the baud rate &c have been ignored.

    Yes, I am logged in as super user.

    anyone any ideas?
    He who laughs last ... is still using a slow modem

  2. #2
    Cockroaches & Keith Richards
    Join Date
    Nov 2003
    Location
    Chelmsford
    Posts
    33,353

    Default

    I'd say explain what you're trying to do and on what flavour of linux you're trying to do it

  3. #3
    The comeback tour
    Join Date
    Feb 2008
    Location
    On the wrong planet
    Posts
    6,732

    Default

    Quote Originally Posted by frankus View Post
    I'd say explain what you're trying to do and on what flavour of linux you're trying to do it
    er, set the baudrate of that port and remove "editing" for rx & tx of straight binary data.

    Debian Linux 2.6 on what appears to be a bog stock PC
    He who laughs last ... is still using a slow modem

  4. #4
    The comeback tour
    Join Date
    Feb 2008
    Location
    On the wrong planet
    Posts
    6,732

    Default

    Quote Originally Posted by musophilr View Post
    er, set the baudrate of that port and remove "editing" for rx & tx of straight binary data.

    Debian Linux 2.6 on what appears to be a bog stock PC
    of course I'm assuming I'm referring to the right port!
    He who laughs last ... is still using a slow modem

  5. #5
    Cockroaches & Keith Richards
    Join Date
    Nov 2003
    Location
    Chelmsford
    Posts
    33,353

  6. #6
    The comeback tour
    Join Date
    Feb 2008
    Location
    On the wrong planet
    Posts
    6,732

    Default

    Quote Originally Posted by frankus View Post
    yes, it says stty changes a terminal, setserial changes a port. have just done an apt-get install setserial ... need to suss out the parameters to if before I do anything else.

    fanx
    He who laughs last ... is still using a slow modem

  7. #7
    Cockroaches & Keith Richards
    Join Date
    Nov 2003
    Location
    Chelmsford
    Posts
    33,353

    Default

    good luck in getting it sorted, I found the unbuntu support pages pretty useful for my issues with sys admining

  8. #8
    The comeback tour
    Join Date
    Feb 2008
    Location
    On the wrong planet
    Posts
    6,732

    Default

    doh! it helps if you get the port speed right. I was probably rather silly in not checking what my colleague said about the default baud rate, I just used the numbers he gave me but 57600 makes far more sense than 57650! (although the spec doesn't lay restrictions on port speed, its worded so you can set it to whatever you like, which seems plausible so long as the hardware can divide a clock speed down to the number you chose).

    Anyway I've set the port speed & stop bits etc, done a

    cat file > /dev/ttyUSB0

    followed by a

    cat /dev/ttyUSB0 > response file

    and have definitely got the bytes back in response that the protocol spec says I should have

    So now I know I can communicate with the device in this simple manner, all I need to do is write more code that does what's wanted using the relevant techniques
    Last edited by musophilr; 22nd January 2013 at 12:44 PM. Reason: accuracy
    He who laughs last ... is still using a slow modem

  9. #9
    The comeback tour
    Join Date
    Nov 2007
    Posts
    6,678

    Default

    I'm an educated man but this might be the thread that I understand the least, ever. I assume it's about computers but I'm not 100% on that. Just thought I'd share. Kudos to anybody who does get this stuff.

    Carry on

  10. #10
    The comeback tour
    Join Date
    Feb 2008
    Location
    On the wrong planet
    Posts
    6,732

    Default

    The last time I used the program which talked to /dev/ttyUSB0 it did so no trubble. Now, the call to fread blocks for no readily apparent reason. I can see tx/rx lights on the RS485/USB converter box, so I know my commands are being transmitted to the device, and that the device is responding, but its responses are not coming back via the call to fread.

    However - and this is probably the cause of it - the PC running Linux has been booted since. The port setup has been lost and I've had to reconfigure it. I know the port speed, character size, and number of stop bits is right, but there's something else I've forgotten to do and I can't remember what!

    Funny thing is, the
    cat file> /dev/ttyUSB0
    works, but the
    cat /dev/ttyUSB0 > response file
    hangs, so it's not just my program. There's something I've forgotten to do to the port.
    Last edited by musophilr; 11th February 2013 at 10:54 PM.
    He who laughs last ... is still using a slow modem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •