home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / hardware / pcimodem < prev    next >
Text File  |  2004-07-25  |  1KB  |  27 lines

  1. #!/bin/sh
  2. ##
  3. ## Adapted by Rick Moen in 2004 based on a long-ago co-worker's script 
  4. ## fragment.  This script may be freely copied, modified, or
  5. ## distributed, with attribution.  (I'd credit the core fragment, 
  6. ## too, if only I remembered who wrote it.)
  7. ## 
  8. ## Configures /dev/ttyS2 serial port for a US Robotics PCI modem.
  9. ##
  10. ## This startup Bourne shell script for Linux, written for a USR model 5610 PCI 
  11. ## non-winmodem, searches lines of "lspci" output until a line contains the 
  12. ## string "US Robotics", then parses from that line the IRQ and I/O port 
  13. ## assigned to that device by the PCI controller chip, then runs 
  14. ## "setserial" to initialise serial port /dev/ttyS2 (COM3, to MS-DOS people) 
  15. ## with those hardware settings.  With minimal work, the script should
  16. ## be adaptable to any other PCI non-winmodem.
  17. ## 
  18. DEVICE=$(lspci | grep "US Robotics" | awk '{print $1}')
  19. IRQ=$(lspci -v -s $DEVICE | head -n 3 | tail -n 1 | cut -d ' ' -f 5)
  20. PORTS=$(lspci -v -s $DEVICE | head -n 4 | tail -n 1 | cut -d ' ' -f 4)
  21.  
  22. echo US Robotics modem is at IRQ $IRQ
  23. echo ...and the base of the I/O port range is $PORTS
  24.  
  25. setserial /dev/ttyS2 port 0x$PORTS irq $IRQ autoconfig
  26.  
  27.