pmodemdiag 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. #!/bin/bash
  2. #Barry Kauler, LGPL 2010
  3. #120828 rerwin: various.
  4. NAMEDATE="`date -u +%Y%m%d`"
  5. if [ "$1" = "--help" ];then
  6. cat 1>&2 << EOT
  7. Usage: `basename $0` [options]
  8. --help This small usage guide
  9. Default action is to collect modem-relevant files into a compressed archive
  10. (tarball) named such as pmodemdiag-$NAMEDATE.tar.gz in your root/home directory.
  11. That file can be submitted to Puppy developers for analysis and possible problem
  12. resolution.
  13. EOT
  14. exit
  15. fi
  16. [ -e ~/pmodemdiag-$NAMEDATE.tar.gz ] && echo -e " A file already exists with the intended name of the new tarball file:\n pmodemdiag-$NAMEDATE.tar.gz\n Please rename or delete it and then rerun pmodemdiag." && exit
  17. if [ "`grep '\--silent' /usr/sbin/pupscan 2>/dev/null`" != "" ];then
  18. echo " Running PupScan silently to get hardware IDs and drivers."
  19. else
  20. echo " Running PupScan to get hardware IDs and drivers - please close its window manually."
  21. sleep 5
  22. fi
  23. pupscan --silent
  24. echo -e " Collecting various modem-related files into an archive tarball:\n pmodemdiag-$NAMEDATE.tar.gz."
  25. cd /
  26. rm -f -r /tmp/pmodemdiag-$NAMEDATE
  27. mkdir -p /tmp/pmodemdiag-$NAMEDATE
  28. cp -f /tmp/chipnummod.txt /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  29. cp -f /tmp/usbchipnummod.txt /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  30. cp -f /tmp/udevtrace.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  31. cp -f /tmp/udevtrace-modem.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  32. cp -f /tmp/bootsysinit.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  33. cp -f /var/log/messages /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  34. cp -f /etc/rc.d/MODULESCONFIG /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  35. lsmod > /tmp/pmodemdiag-$NAMEDATE/lsmod.txt
  36. ls -l /etc/init.d &> /tmp/pmodemdiag-$NAMEDATE/ls-etc-init.d.txt
  37. ls -l -R -A /dev &> /tmp/pmodemdiag-$NAMEDATE/ls-dev.txt
  38. [ -s /etc/wvdial.conf ] && sed -e 's/^\(Username *= *\).*/\1XXXXXXXX/' \
  39. -e 's/^\(Password *= *\).*/\1XXXXXXXX/' \
  40. -e 's/\(AT+CPIN=\)..*/\1XXXX/' \
  41. /etc/wvdial.conf > /tmp/pmodemdiag-$NAMEDATE/wvdial.conf.txt 2> /dev/null
  42. cp -f /tmp/pupdial.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  43. cp -f /etc/ppp/peers/wvdial /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  44. [ -e /etc/ppp/peers/gprsmm ] && grep '^[^#]' /etc/ppp/peers/gprsmm > /tmp/pmodemdiag-$NAMEDATE/gprsmm 2> /dev/null
  45. cp -f /tmp/logwvdialprobe /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  46. cp -f /tmp/usb_modeswitch.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  47. cp -f /tmp/usb_modeswitch.temp.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  48. cp -f /tmp/usb_modeswitch.active /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  49. #@cp -f /tmp/ozerocdoff.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  50. #@cp -f /tmp/osetsuspend.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  51. if [ "`lsmod | grep '^hso '`" != "" ];then
  52. ls -1 /sys/class/tty/ttyHS* > /tmp/pmodemdiag-$NAMEDATE/ls-ttyHS.txt 2> /dev/null
  53. TTYS=`find /sys/class/tty -name "ttyHS*"`
  54. for i in $TTYS; do
  55. echo "$i/hsotype: `cat $i/hsotype`" >> /tmp/pmodemdiag-$NAMEDATE/ttyHS_hsotypes
  56. done
  57. fi
  58. [ "`which pup_event_backend_modprobe_protect`" != "" ] \
  59. && /sbin/pup_event_backend_modprobe_protect --dump 2> /dev/null
  60. sleep 1
  61. cp -f /tmp/pup_event_backend_modprobe_protect.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  62. [ -s /tmp/pup_event_backend_modprobe_protect_daemon.log ] \
  63. && cp -f /tmp/pup_event_backend_modprobe_protect_daemon.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null #110209
  64. cp -f /etc/modules.conf /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  65. cat /proc/devices > /tmp/pmodemdiag-$NAMEDATE/proc_devices.txt 2> /dev/null
  66. cp -f /tmp/usb_modeswitch_scsi-info.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  67. cp -f /etc/rc.d/rc.local /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  68. ifconfig > /tmp/pmodemdiag-$NAMEDATE/ifconfig.txt 2> /dev/null
  69. cp -f /root/.packages/user-installed-packages /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  70. cp -f /etc/rc.d/pupstate /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  71. touch /tmp/pmodemdiag-$NAMEDATE/kernel-`uname -r`
  72. cp -f /tmp/xerrs.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  73. cp -f /tmp/.usbserial_dependents /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  74. ls -1 /etc/modprobe.d/* > /tmp/pmodemdiag-$NAMEDATE/ls-grep-etc-modprobe.d.txt 2> /dev/null
  75. echo >> /tmp/pmodemdiag-$NAMEDATE/ls-grep-etc-modprobe.d.txt 2> /dev/null
  76. grep -H '' /etc/modprobe.d/* 2> /dev/null | sed -e 's%/etc/modprobe.d/%%' -e 's/:/: /' >> /tmp/pmodemdiag-$NAMEDATE/ls-grep-etc-modprobe.d.txt
  77. #For reworked modem support in Wary/Quirky+:
  78. cp -f /var/log/usb_modeswitch_* /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  79. cp -f /tmp/pupdial_port_test /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  80. cp -f /var/local/pupdial/usb_modem_port /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  81. cp -f /var/local/pupdial/usbids /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  82. if [ -d /tmp/pup_event_backend ];then
  83. grep -H '' /tmp/pup_event_backend/pup_event_module_devpath_log* 2> /dev/null | sed -e 's%/tmp/pup_event_backend/pup_event_module_%%' -e 's/:/: /' >> /tmp/pmodemdiag-$NAMEDATE/grep-tmp-module_devpath_log.txt
  84. cp -f /tmp/pup_event_backend/preferences.log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  85. cp -f /tmp/pup_event_backend/preferences-* /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  86. fi
  87. [ -d /tmp/rc_sysinit ] \
  88. && grep -H '' /tmp/rc_sysinit/* 2> /dev/null | sed -e 's%/tmp/rc_sysinit/%%' -e 's/:/: /' >> /tmp/pmodemdiag-$NAMEDATE/grep-tmp-rc_sysinit.txt
  89. if [ "`which hciconfig`" != "" ];then
  90. cp -f /etc/bluetooth/*.conf /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  91. hciconfig -a 2>&1 > /tmp/pmodemdiag-$NAMEDATE/hciconfig.txt
  92. if [ "`which hcitool`" != "" ];then
  93. hcitool dev 2>&1 > /tmp/pmodemdiag-$NAMEDATE/hcitool.txt
  94. hcitool inq 2>&1 >> /tmp/pmodemdiag-$NAMEDATE/hcitool.txt
  95. hcitool con 2>&1 >> /tmp/pmodemdiag-$NAMEDATE/hcitool.txt
  96. fi
  97. [ "`which rfcomm`" != "" ] \
  98. && rfcomm -a 2>&1 > /tmp/pmodemdiag-$NAMEDATE/rfcomm.txt
  99. [ "`which sdptool`" != "" ] \
  100. && sdptool browse 2>&1 > /tmp/pmodemdiag-$NAMEDATE/sdptool.txt
  101. fi
  102. grep -H -s 'Interrupt' /sys/bus/usb/devices/*-*:*.*/ep_??/type 2> /dev/null | sed -e 's%/sys/bus/usb/devices%%' -e 's/:/: /' > /tmp/pmodemdiag-$NAMEDATE/grep-sys-bus-usb-devices-ep-type-interrupt.txt
  103. cat /tmp/usb_modeswitch*/usb_modeswitch* > /tmp/pmodemdiag-$NAMEDATE/usb_modeswitch_logs 2> /dev/null
  104. cat /var/lib/usb_modeswitch/* > /tmp/pmodemdiag-$NAMEDATE/var_lib_usb_modeswitch_lists 2> /dev/null
  105. grep -E 'agrmodem|intelmodem' /lib/modules/2.6.*/modules.dep > /tmp/pmodemdiag-$NAMEDATE/grep-modem-modules_dep.txt 2> /dev/null
  106. cat /proc/asound/cards /proc/asound/modules > /tmp/pmodemdiag-$NAMEDATE/proc_asound.txt 2> /dev/null
  107. [ -e /initrd/pup_ro1/root ] \
  108. && ls -l -R -A /initrd/pup_ro1/dev &> /tmp/pmodemdiag-$NAMEDATE/ls_pup_ro1_dev.txt 2> /dev/null
  109. grep -H '' /etc/network-wizard/*/*/* 2> /dev/null | sed -e 's%/etc/network-wizard%%' -e 's/:/: /' > /tmp/pmodemdiag-$NAMEDATE/network-wizard.txt
  110. grep -H '' /etc/simple_network_setup/* 2> /dev/null | sed -e 's%/etc/simple_network_setup%%' -e 's/:/: /' > /tmp/pmodemdiag-$NAMEDATE/simple_network_setup.txt
  111. cp -f /tmp/sns_wireless_log /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  112. cp -f /tmp/sns_connections_available /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  113. cp -f /tmp/sns_connections_wireless /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  114. cp -f /tmp/sns_interface_success /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  115. cp -f /tmp/sns_interfaces /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  116. cp -f /tmp/ssb_dependers /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  117. cp -f /etc/modules/firmware.dep.inst.* /tmp/pmodemdiag-$NAMEDATE/ 2> /dev/null
  118. sync
  119. cd /tmp
  120. tar -czf ~/pmodemdiag-$NAMEDATE.tar.gz pmodemdiag-$NAMEDATE
  121. cd
  122. echo " Diagnostic file collection complete."
  123. echo -e " Tarball /root/pmodemdiag-$NAMEDATE.tar.gz can be attached to a posting or\n personal message (PM) in the Puppy forum, for analysis of dialup-modem\n or other issues."
  124. echo " The content can be viewed in /tmp/pmodemdiag-$NAMEDATE/."