This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Messages can not be aligned

Other Parts Discussed in Thread: ASH

Hello,

I recompiled the busybox 1.22.1,and it is working fine in AM335X
But, The udhcpc output message always can not be aligned,as following

Sending discover...
                                   Sending discover...
                                                                      udhcpc leasefail
Sending discover...
                                   Sending discover...
                                                                      Sending discover...
                                                                                                         udhcpc leasefail
Sending discover...
                                   Sending discover...
                                                                      Sending discover...
                                                                                                         udhcpc leasefail


It should look like the following normal

Sending discover...
Sending discover...
Sending discover...
udhcpc leasefail
Sending discover...
Sending discover...
Sending discover...
udhcpc leasefail
Sending discover...
Sending discover...
Sending discover...
udhcpc leasefail
Sending discover...
Sending discover...
Sending discover...
udhcpc leasefail
Sending discover...
Sending discover...

Does anyone know why????

  • Hi Justin,

    What terminal emulator are you using? Can you try with another?

    Best regards,
    Miroslav

  • Hi Miroslav

    I use  HyperTerminal in Microsoft Windows XP

    if i run udhcpc by am335x linux  console ,it is aligned,

    if  i run udhcpc by my Application program,it is Non-aligned

    Regards

     

     

  • Justin,

    Please explain what do you mean by "run udhcpc by your Application program". If I understand you correctly, the default dhcpc program works correctly and prints aligned messages. What does your application program do?

    Best regards,
    Miroslav

  • I think you are dealing with line endings.

    '\r' = return = CR = Carriage Return = 0x0D = 13
    Historically on typewriters, this moved the carriage to the left. On actual terminals, this moved the cursor to the beginning of line leaving the row unchanged.

    '\n' = newline = LF = Line Feed = 0x0A = 10
    Historically on typewriters, this moved the roller up one line. On actual terminals, this moved the cursor to next line leaving the column unchanged.

    Terminal emulation programs like Hyperterminal and TeraTerm can interpret the line endings. On linux systems, the terminals send and receive just a '\n' to mean "\r\n". The terminal program will translate this to "\r\n".  Windows systems will send and receive "\r\n".

    Sounds like your application program is on the Windows PC running udhcpc across the COM port. You need to interpret the '\n' as a '\r\n' before writing to a text window.

    http://en.wikipedia.org/wiki/Newline
    http://en.wikipedia.org/wiki/Carriage_return

  • Hello,

    I know the "\r\n" problem , but my program only call system() function

    I did not do any special settings

  • Much clearer. Should have started with that. That said, I don't know why the line endings would get messed up. In theory, the system() command should share your app's stdout. HyperTerminal should see no difference. Perhaps the system() process uses a shell with different tty settings. That's all I got.

  • A request to forum guys. I did not mark my post as "Suggested Answer". Who does these things? Can you remove "Suggested Answer" off my post.

  • I've tried udhcpc and system("udhcpc") on my target. I do not see the misaligned results.

    Shell Paths
    /bin/sh -> busybox
    /bin/ash -> busybox

    Versions:
    Linux 3.13.0
    Busybox 1.21.1

    Output of stty in ash or sh:
    speed 115200 baud; line = 0;
    intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol =
    ; eol2 = <undef>;
    swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
    lnext = ^V; flush = ^O; min = 1; time = 0;
    -brkint ixoff -imaxbel
    -iexten -echoctl

    HyperTerminal Properties/Settings:
    Emulation: VT100
    Terminal Settings: Cursor=Blink, Character set=ASCII
    ASCII Setup: All unchecked.

  • Hello Norman

    Thanks for your help :)

    I do not know why non-aligned when call system(udhcpc -xxxx - xxx  )

    I use TI SDK 6.0, kernel 3.2

    and i recompiled busybox 1.22.2 to overwrite busybox files in arago-base-tisdk-image-am335x-evm

  • I only get misaligned output if I intentionally alter the line ending translation of the terminal:

    stty ocrnl -onlcr

    Perhaps the system() function is doing something to the terminal. Try printing out the tty settings directly "stty -a" and indirectly with system("stty -a"). See if they are different.