View Single Post
Old 08-11-2017, 10:24 PM   #2
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
MiniCom Installation and Setup

The following presumes your PC is running some flavor of Linux.

There are a few PC system commands used here but the users of MacOSx and any *BSD should not have any trouble translating them.
  1. Check your system's USB serial handling.
    • Clear the kernel's message buffer.
      Code:
      knc1:~> sudo dmesg -c
      * * * All of the old messages * * *
      ## to see that it is now empty: ##
      knc1:~> dmesg 
      * * * Nothing * * *
    • Plug in the USB cable.
    • Discover what device the system just assigned to it.
      Code:
      knc1:~> dmesg 
      
      [38539.539322] usb 4-5.7: new full-speed USB device number 7 using ehci-pci
      [38539.653972] usb 4-5.7: New USB device found, idVendor=0403, idProduct=6001
      [38539.653975] usb 4-5.7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
      [38539.653977] usb 4-5.7: Product: TTL232RG-VREG1V8
      [38539.653979] usb 4-5.7: Manufacturer: FTDI
      [38539.653980] usb 4-5.7: SerialNumber: FTZ6UQSB
      [38539.656520] ftdi_sio 4-5.7:1.0: FTDI USB Serial Device converter detected
      [38539.656551] usb 4-5.7: Detected FT232RL
      [38539.656896] usb 4-5.7: FTDI USB Serial Device converter now attached to ttyUSB0
    • Check the ownership and permissions of that device.
      Code:
      knc1:~> stat /dev/ttyUSB0
      
        File: /dev/ttyUSB0
        Size: 0         	Blocks: 0          IO Block: 4096   character special file
      Device: 6h/6d	Inode: 68428       Links: 1     Device type: bc,0
      Access: (0660/crw-rw----)  Uid: (    0/    root)   Gid: (   16/ dialout)
      Access: 2017-08-12 07:14:30.967526088 -0500
      Modify: 2017-08-12 07:14:30.967526088 -0500
      Change: 2017-08-12 07:14:30.967526088 -0500
       Birth: -
  2. Allow yourself to use those device assignments.
    • Discover your group membership.
      Code:
      knc1:~> id
      uid=1000(knc1) gid=100(users) groups=100(users),469(vboxusers)
      You are not a member of the 'dialout' group.
    • Ensure your user name is set in the environment.
      Code:
      knc1:~> echo $USER
      knc1
    • Add yourself to the 'dialout' group.
      Code:
      knc1:~> sudo usermod -a -G dialout $USER
    • Check that you are now a member of the 'dialout' group.
      Code:
      knc1:~> grep dialout /etc/group
      dialout:x:16:knc1
  3. Install minicom if not already installed.
    Your package manager's command will be similar to one of these:
    • knc1:~> sudo zypper install minicom
    • knc1:~> sudo yum install minicom
    • knc1:~> sudo app-get install minicom
  4. Configure minicom's system-wide defaults
    1. Start minicom in its setup mode.
      Code:
      knc1:~> sudo minicom -s
      Which will display minicom's top level menu.
      The default settings will be set to match the Kindle and serial adapter cable above.
      Use the keyboard arrow keys to maneuver in this top level menu.
      Code:
                  +-----[configuration]------+
                  | Filenames and paths      |
                  | File transfer protocols  |
                  | Serial port setup        |
                  | Modem and dialing        |
                  | Screen and keyboard      |
                  | Save setup as dfl        |
                  | Save setup as..          |
                  | Exit                     |
                  | Exit from Minicom        |
                  +--------------------------+
      To match the Kindle's serial line and the system USB serial setup shown above, make your configuration look like:
      1. Filenames and paths
        Code:
            +-----------------------------------------------------------------------+
            | A - Download directory : /ken/PW3                                     |
            | B - Upload directory   : /ken/PW3                                     |
            | C - Script directory   :                                              |
            | D - Script program     : runscript                                    |
            | E - Kermit program     : /usr/bin/kermit -l %l -b %b                  |
            | F - Logging options                                                   |
            |                                                                       |
            |    Change which setting?                                              |
            +-----------------------------------------------------------------------+
        The settings for 'A' and 'B' should be either empty or set to match your own usage.
        The other entries shown are not used here.
        'Esc' to exit.
      2. File transfer protocols
        Code:
        +------------------------------------------------------------------------------+
        |     Name             Program                 Name U/D FullScr IO-Red. Multi  |
        | A  zmodem     /usr/bin/sz -vv -b              Y    U    N       Y       Y    |
        | B  ymodem     /usr/bin/sb -vv                 Y    U    N       Y       Y    |
        | C  xmodem     /usr/bin/sz -X -vv              Y    U    N       Y       N    |
        | D  zmodem     /usr/bin/rz -vv -b              N    D    N       Y       Y    |
        | E  ymodem     /usr/bin/rb -vv                 N    D    N       Y       Y    |
        | F  xmodem     /usr/bin/rx -vv                 Y    D    N       Y       N    |
        | G  kermit     /usr/bin/kermit -i -l %l -b %b  Y    U    Y       N       N    |
        | H  kermit     /usr/bin/kermit -i -l %l -b %b  N    D    Y       N       N    |
        | I  ascii      /usr/bin/ascii-xfr -dsv         Y    U    N       Y       N    |
        | J    -                                                                       |
        | K    -                                                                       |
        | L    -                                                                       |
        | M  Zmodem download string activates... D                                     |
        | N  Use filename selection window...... Yes                                   |
        | O  Prompt for download directory...... No                                    |
        |                                                                              |
        |   Change which setting? (SPACE to delete)                                    |
        +------------------------------------------------------------------------------+
        These are the original defaults.
        None of them are used (yet).
        But keep in mind that they are here, the Kindle's u-boot build does support file transfer over the serial port.
        'Esc' to exit.
      3. Serial port setup
        Code:
            +-----------------------------------------------------------------------+   
            | A -    Serial Device      : /dev/ttyUSB0                              |   
            |                                                                       |   
            | C -   Callin Program      :                                           |   
            | D -  Callout Program      :                                           |   
            | E -    Bps/Par/Bits       : 115200 8N1                                |   
            | F - Hardware Flow Control : No                                        |   
            | G - Software Flow Control : No                                        |   
            |                                                                       |   
            |    Change which setting?                                              |   
            +-----------------------------------------------------------------------+
        This is the most critical one, it needs to match the system device setting and the requirements of the Kindle serial line.
        The 'C' and 'D' fields are not used here.
        The other fields should be set as shown, including the disabling of all flow control.
        Note: In the event that your serial line should have poor signal quality, try: 115200 8N2, in some cases that extra stop bit helps the hardware stay in-sync.
        'Esc' to exit.
      4. Modem and dialing
        Code:
         +--------------------[Modem and dialing parameter setup]---------------------+
         |                                                                            | 
         | A - Init string .........                                                  | 
         | B - Reset string ........                                                  | 
         | C - Dialing prefix #1.... ATDT                                             | 
         | D - Dialing suffix #1.... ^M                                               | 
         | E - Dialing prefix #2.... ATDP                                             | 
         | F - Dialing suffix #2.... ^M                                               | 
         | G - Dialing prefix #3.... ATX1DT                                           | 
         | H - Dialing suffix #3.... ;X4D^M                                           | 
         | I - Connect string ...... CONNECT                                          | 
         | J - No connect strings .. NO CARRIER            BUSY                       | 
         |                           NO DIALTONE           VOICE                      | 
         | K - Hang-up string ...... ~~+++~~ATH^M                                     | 
         | L - Dial cancel string .. ^M                                               | 
         |                                                                            | 
         | M - Dial time ........... 45      Q - Auto bps detect ..... No             | 
         | N - Delay before redial . 2       R - Modem has DCD line .. No             | 
         | O - Number of tries ..... 10      S - Status line shows ... DTE speed      | 
         | P - DTR drop time (0=no). 1       T - Multi-line untag .... No             | 
         |                                                                            | 
         | Change which setting?     Return or Esc to exit. Edit A+B to get defaults. |
         +----------------------------------------------------------------------------+
        Set 'A' and 'B' to empty strings as shown.
        We don't want to send anything to the Kindle in case it is listening when we start up minicom.
        Note that 'R' has been changed.
        The rest of the options are not significant to using minicom with a Kindle serial port.
        'Esc' to exit.
      5. Screen and keyboard
        Code:
                      +-----------------[Screen and keyboard]-----------------+        
                      | A - Command key is         : ^A                       |         
                      | B - Backspace key sends    : BS                       |         
                      | C - Status line is         : enabled                  |         
                      | D - Alarm sound            : Yes                      |         
                      | E - Foreground Color (menu): WHITE                    |         
                      | F - Background Color (menu): BLACK                    |         
                      | G - Foreground Color (term): WHITE                    |         
                      | H - Background Color (term): BLACK                    |         
                      | I - Foreground Color (stat): WHITE                    |         
                      | J - Background Color (stat): BLACK                    |         
                      | K - History Buffer Size    : 2000                     |         
                      | L - Macros file            : .macros                  |         
                      | M - Edit Macros                                       |         
                      | N - Macros enabled         : Yes                      |         
                      | O - Character conversion   :                          |         
                      | P - Add linefeed           : No                       |         
                      | Q - Local echo             : No                       |         
                      | R - Line Wrap              : No                       |         
                      | S - Hex Display            : No                       |         
                      | T - Add carriage return    : No                       |         
                      |  Change which setting?  (Esc to exit)                 |        
                      +-------------------------------------------------------+
        The 'A' setting you might want to change, shown is the built-in default.
        'Esc' to exit.
      6. Save setup as dfl
        Select this one when ready to save the system wide defaults.
      7. Save setup as
        Code:
                           +-----------------------------------------+                  
                           |Give name to save this configuration?    |                  
                           |>                                        |                  
                           +-----------------------------------------+
        This allows you to save the configuration that is set as a named file in your home directory.
        Later, you can pass that name as the first argument to minicom when you start it.
        Since in this example the defaults are now set to match this specific purpose, this feature is not needed here.
      8. Exit
        Meaning: Exit from the configuration menu into minicom screen.
        To reach 'command mode' while in the terminal, enter the command key (default ctrl-a).
        To get out of minicom from the terminal: ctrl-a x
      9. Exit from Minicom
        This one does what the label says.

    You should not have to use 'sudo' to run and use minicom now.
    (But you might, depends on your Linux distribution.)

    The setup here is to match the current system device assignment (/dev/ttyUSB0).
    Note that system device assignment in Linux is dynamic, if this setup stops working, the device setting is the first thing you should check.

    While in the terminal mode, you can reach the command menu by using the ctrl-a z key combination.
    Code:
         +-------------------------------------------------------------------+
         |                      Minicom Command Summary                      |
         |                                                                   |
         |              Commands can be called by CTRL-A <key>               |
         |                                                                   |
         |               Main Functions                  Other Functions     |
         |                                                                   |
         | Dialing directory..D  run script (Go)....G | Clear Screen.......C |
         | Send files.........S  Receive files......R | cOnfigure Minicom..O |
         | comm Parameters....P  Add linefeed.......A | Suspend minicom....J |
         | Capture on/off.....L  Hangup.............H | eXit and reset.....X |
         | send break.........F  initialize Modem...M | Quit with no reset.Q |
         | Terminal settings..T  run Kermit.........K | Cursor key mode....I |
         | lineWrap on/off....W  local Echo on/off..E | Help screen........Z |
         | Paste file.........Y  Timestamp toggle...N | scroll Back........B |
         | Add Carriage Ret...U                                              |
         |                                                                   |
         |             Select function or press Enter for none.              |
         +-------------------------------------------------------------------+
    Pressing 'Enter' here returns you to terminal mode.
    The two command combinations you will be most interested in while running minicom:
    • ctrl-L :: toggle capture on/off - the capture file name can be set from this menu.
      Code:
                         +-----------------------------------------+            
                         |Capture to which file?                   |            
                         |> minicom.cap                            |            
                         +-----------------------------------------+
    • ctrl-Q :: Exit from minicom without sending anything to the Kindle's serial line.
  5. Usage
    Use the '-o' start-up option to prevent minicom from sending anything to the Kindle.
    Using that option gives you some protection from stray changes in the minicom configuration.
    Code:
    knc1:~> minicom -o
    Cannot create lockfile for /dev/ttyUSB0: Permission denied
    That is the error message I am getting when trying to run minicom under my username.
    It should not be happening, but I haven't figured out how to fix it (yet).

    You should be able to run minicom using sudo without any harm to anything.
    Code:
    knc1:~> sudo minicom -o

Last edited by knc1; 08-14-2017 at 08:49 AM. Reason: Label to reference D.1.b
knc1 is offline   Reply With Quote