Configurar 3G
Publicado por julio cesar fais (última atualização em 08/02/2011)
[ Hits: 5.319 ]
Homepage: juliovarginha.blogspot.com
Script facilita a configuração de modems 3G.
Dependências: wvdial, libusb-dev, usb-modeswitch
#!/bin/bash ############################################### FIM ################################################# #script Júlio César Fais - 3G - 13 Janeiro 2011 #julio.tecnico@bol.com.br #juliovarginha.blogspot.com #Dependencias: wvdial, libusb-dev, usb-modeswitch ###########verifica se o usuario é root################## #se for root retorna 0 #se for usuario normal retorna 1000 userid=$(id -u) if [ $userid = 1000 ]; then `zenity --warning --text "Não Esta Sendo Executado Como Administrador (root)!" --title "AVISO DO JULIO!!!"` fi if [ $userid = 0 ]; then `zenity --warning --text "Cuidado!!! Script Sendo Executado Como Administrador (root)!" --title "AVISO DO JULIO!!!"` fi ################################################## inicio da função (8) function function_b () { vendor=$(zenity --entry --text="Digite o VENDOR (Código)." --title="Ex.: 19d2" --width=300) if [ $? == 1 ]; then exit fi product=$(zenity --entry --text="Digite o PRODUCT (Código)." --title="Ex.: 2000" --width=300) if [ $? == 1 ]; then exit fi echo "<!-- -*- SGML -*- -->" > /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "<deviceinfo version="0.2">" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "<device>" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "<!-- ZTE MF626 HSDPA USB Modem -->" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "<match key="@info.parent:usb.vendor_id" int="0x$vendor">" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "<match key="@info.parent:usb.product_id" int="0x$product">" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "<match key="@info.parent:usb.interface.number" int="3">" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "<append key="modem.command_sets" type="strlist">GSM-07.07</append>" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "<append key="modem.command_sets" type="strlist">GSM-07.05</append>" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "<append key="info.capabilities" type="strlist">modem</append>" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "</match>" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "</match>" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "</match>" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "</device>" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "</deviceinfo>" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi echo "#configurado via script => JULIO 3G<= julio.tecnico@bol.com.br" >> /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi cat /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi > /tmp/2345678.txt a=$(cat /tmp/2345678.txt) zenity --info --text "Veja o Arquivo Criado." zenity --info --text "$a" rm -fr /tmp/2345678.txt } ################################################### inicio da função (7) function function_manual () { vendor=$(zenity --entry --text="Digite o VENDOR (Código)." --title="Ex.: 19d2" --width=300) if [ $? == 1 ]; then exit fi product=$(zenity --entry --text="Digite o PRODUCT (Código)." --title="Ex.: 2000" --width=300) if [ $? == 1 ]; then exit fi modprobe -r usbserial rmmod usb_storage modprobe usbserial vendor=0x$vendor product=0x$product ls /dev/ttyUSB* > /tmp/2345678.txt a=$(cat /tmp/2345678.txt) zenity --info --text "$a" rm -fr /tmp/2345678.txt } ################################################### inicio da função (6) function function_tty () { find /dev | grep ttyUSB* > /tmp/2345678.txt a=$(cat /tmp/2345678.txt) zenity --info --text "$a" rm -fr /tmp/2345678.txt } ################################################### inicio da função (5) function function_regra () { vendor=$(zenity --entry --text="Digite o VENDOR (Código)." --title="Ex.: 19d2" --width=300) if [ $? == 1 ]; then exit fi product=$(zenity --entry --text="Digite o PRODUCT (Código)." --title="Ex.: 2000" --width=300) if [ $? == 1 ]; then exit fi echo "SUBSYSTEM==”block”, \" > /etc/udev/rules.d/15-regra-modem.rules echo "ACTION==”add”, \" >> /etc/udev/rules.d/15-regra-modem.rules echo "SYSFS{idVendor}==”$vendor″, \" >> /etc/udev/rules.d/15-regra-modem.rules echo "SYSFS{idProduct}==”$product″, \" >> /etc/udev/rules.d/15-regra-modem.rules echo "OPTIONS=”ignore_device”" >> /etc/udev/rules.d/15-regra-modem.rules echo "SUBSYSTEM==”usb”, SYSFS{idProduct}==”$product″, SYSFS{idVendor}==”$vendor″," >> /etc/udev/rules.d/15-regra-modem.rules echo "RUN+=”/usr/sbin/usb_modeswitch" >> /etc/udev/rules.d/15-regra-modem.rules echo "#configurado via script => JULIO 3G<= julio.tecnico@bol.com.br" >> /etc/udev/rules.d/15-regra-modem.rules /etc/init.d/udev stop /etc/init.d/udev start sleep 2 } #################################################### inicio da função (4) function function_wvdial () { phone=$(zenity --entry --text="Digite o Telefone." --title="Ex.: *99#" --width=300) if [ $? == 1 ]; then exit fi usuario=$(zenity --entry --text="Digite o Usuario." --title="Ex.: vivo" --width=300) if [ $? == 1 ]; then exit fi senha=$(zenity --entry --text="Digite a Senha." --title="Ex.: vivo" --width=300) if [ $? == 1 ]; then exit fi tty=$(zenity --entry --text="Qual tty seu Modem foi reconhecido." --title="Ex.: ttyUSB0" --width=300) if [ $? == 1 ]; then exit fi echo "[Dialer Defaults]" > /etc/wvdial.conf echo "Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0" >> /etc/wvdial.conf echo "Modem Type = Analog Modem" >> /etc/wvdial.conf echo "Phone = $phone" >> /etc/wvdial.conf echo "ISDN = 0" >> /etc/wvdial.conf echo "Username = $usuario" >> /etc/wvdial.conf echo "Init1 = ATZ" >> /etc/wvdial.conf echo "Password = $senha" >> /etc/wvdial.conf echo "Modem = /dev/$tty" >> /etc/wvdial.conf echo "Baud = 460800" >> /etc/wvdial.conf echo "Carrier Check = no" >> /etc/wvdial.conf echo "Auto Reconnect = yes" >> /etc/wvdial.conf echo "#configurado via script => JULIO 3G<= julio.tecnico@bol.com.br" >> /etc/wvdial.conf cat /etc/wvdial.conf > /tmp/2345678.txt a=$(cat /tmp/2345678.txt) zenity --info --text "Veja o Arquivo Editado." zenity --info --text "$a" rm -fr /tmp/2345678.txt } ################################inicio da função (3) function function_modes () { vendor=$(zenity --entry --text="Digite o VENDOR (Código)." --title="Ex.: 19d2" --width=300) if [ $? == 1 ]; then exit fi product=$(zenity --entry --text="Digite o PRODUCT (Código)." --title="Ex.: 2000" --width=300) if [ $? == 1 ]; then exit fi echo "DefaultVendor= 0×$vendor" > /etc/usb_modeswitch.conf echo "DefaultProduct= 0×$product" >> /etc/usb_modeswitch.conf echo "TargetVendor= 0×$vendor" >> /etc/usb_modeswitch.conf echo "TargetProduct= 0×$product" >> /etc/usb_modeswitch.conf echo "MessageContent=”55534243000000000000000000000011060000000000000000000000000000″" >> /etc/usb_modeswitch.conf echo "CheckSuccess=20" >> /etc/usb_modeswitch.conf echo "#configurado via script => JULIO 3G<= julio.tecnico@bol.com.br" >> /etc/usb_modeswitch.conf /usr/sbin/usb_modeswitch -W -c /etc/usb_modeswitch.conf cat /etc/usb_modeswitch.conf > /tmp/2345678.txt a=$(cat /tmp/2345678.txt) zenity --info --text "Veja o Arquivo Editado." zenity --info --text "$a" rm -fr /tmp/2345678.txt } ###################################inicio da função (2) function function_lsusb () { lsusb > /tmp/2345678.txt a=$(cat /tmp/2345678.txt) zenity --info --text "$a" rm -fr /tmp/2345678.txt } #####################################Início da função (1) function function_dep () { zenity --info --text "Dependencias: wvdial, libusb-dev, usb-modeswitch." zenity --info --text "Baixe e Extraia o usb-modeswitch com #make install." zenity --info --text "Apoś a Configuração Conecte com o Comando #wvdial, ou escolha um discador ex.: kppp, gnomeppp." exit 0 } ################################################## MENU ###################################################################### while true; do acao="$(zenity --width=570 --height=340 --list --column " Execute Como Root." --title="Script Júlio Fais 3G" \ "1) DEPENDENCIAS" \ "2) ANOTAR VENDOR/PRODUCT" \ "3) CONFIGURAR /etc/usb_modeswitch.conf" \ "4) CONFIGURAR /etc/wvdial.conf" \ "5) CONFIGURAR REGRAS /etc/udev/rules.d/15-regra-modem.rules" \ "6) VERIFICAR SE O MODEM FOI RECONHECIDO" \ "7) CARREGAR MODEM MANUAL" \ "8) IDENTIFICAR MODEM /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi" \ "SAIR")" case $acao in "1) DEPENDENCIAS") function_dep ;; "2) ANOTAR VENDOR/PRODUCT") function_lsusb ;; "3) CONFIGURAR /etc/usb_modeswitch.conf") function_modes ;; "4) CONFIGURAR /etc/wvdial.conf") function_wvdial ;; "5) CONFIGURAR REGRAS /etc/udev/rules.d/15-regra-modem.rules") function_regra ;; "6) VERIFICAR SE O MODEM FOI RECONHECIDO" ) function_tty ;; "7) CARREGAR MODEM MANUAL" ) function_manual ;; "8) IDENTIFICAR MODEM /usr/share/hal/fdi/information/20thirdparty/20-modem.fdi" ) function_b ;; *) exit ;; esac done ############################################### FIM ################################################# #script Júlio César Fais - 3G - 13 Janeiro 2011 #julio.tecnico@bol.com.br #juliovarginha.blogspot.com #Dependencias: wvdial, libusb-dev, usb-modeswitch
Script para desmontar partição/unidade
Verificar IP Externo no Linux.
Nenhum comentário foi encontrado.
Compartilhando a tela do Computador no Celular via Deskreen
Como Configurar um Túnel SSH Reverso para Acessar Sua Máquina Local a Partir de uma Máquina Remota
Configuração para desligamento automatizado de Computadores em um Ambiente Comercial
Como renomear arquivos de letras maiúsculas para minúsculas
Imprimindo no formato livreto no Linux
Vim - incrementando números em substituição
Efeito "livro" em arquivos PDF
Como resolver o erro no CUPS: Unable to get list of printer drivers
Não to conseguindo resolver este problemas ao instalar o playonelinux (1)
Excluir banco de dados no xampp (1)
[Python] Automação de scan de vulnerabilidades
[Python] Script para analise de superficie de ataque
[Shell Script] Novo script para redimensionar, rotacionar, converter e espelhar arquivos de imagem
[Shell Script] Iniciador de DOOM (DSDA-DOOM, Doom Retro ou Woof!)
[Shell Script] Script para adicionar bordas às imagens de uma pasta