rssi - Trying to use the AT command with an Huawei E3531 -
i want read rssi of huawei e3531. found documentations show easy way informations using @ command. problem can't connect huawei e3531. mean, works modem. have connection. when looking device in dev, find 2 devices ("sdb" , "sgm") seem 2 disc, nothing serial port.
so tried somethin found: -after plugged huawei, find idvendor , idproduct doing lsusb. -they sudo modprobe usbserial vendor=0x"idvendor" product=0x"idproduct" -and when dmesg can read:
[ 1038.498282] usbcore: registered new interface driver usbserial [ 1038.498299] usbcore: registered new interface driver usbserial_generic [ 1038.498312] usbserial: usb serial support registered generic
normally should have like:
usb 1-1: generic converter attached ttyusb0
i think have not possible see sdb , sgm mac, doing ubuntu. , if enable wifi, modem cannot connect ( not see sdb , sgm)
if need here first part of dmesg:
[ 742.756888] usb 3-1: usb disconnect, device number 6 [ 743.123706] usb 3-1: new high-speed usb device number 7 using xhci_hcd [ 743.252854] usb 3-1: new usb device found, idvendor=12d1, idproduct=14dc [ 743.252861] usb 3-1: new usb device strings: mfr=1, product=2, serialnumber=0 [ 743.252865] usb 3-1: product: huawei mobile [ 743.252868] usb 3-1: manufacturer: huawei [ 743.482312] cdc_ether 3-1:1.0 usb0: register 'cdc_ether' @ usb-0000:00:14.0-1, cdc ethernet device, 9a:c2:9b:ee:4c:d9 [ 743.482859] usb-storage 3-1:1.2: usb mass storage device detected [ 743.483249] scsi11 : usb-storage 3-1:1.2 [ 743.520839] audit: type=1400 audit(1427889713.269:79): apparmor="denied" operation="file_inherit" profile="/usr/lib/networkmanager/nm-dhcp-client.action" pid=3414 comm="nm-dhcp-client." lport=29180 family="inet" sock_type="dgram" protocol=17 [ 743.520857] audit: type=1400 audit(1427889713.269:80): apparmor="denied" operation="file_inherit" profile="/usr/lib/networkmanager/nm-dhcp-client.action" pid=3414 comm="nm-dhcp-client." lport=47709 family="inet6" sock_type="dgram" protocol=17 [ 744.481267] scsi 11:0:0:0: direct-access huawei tf card storage 2.31 pq: 0 ansi: 2 [ 744.481722] sd 11:0:0:0: attached scsi generic sg2 type 0 [ 744.482933] sd 11:0:0:0: [sdb] attached scsi removable disk [ 753.752310] audit: type=1400 audit(1427889723.496:81): apparmor="denied" operation="file_inherit" profile="/usr/lib/networkmanager/nm-dhcp-client.action" pid=3423 comm="nm-dhcp-client." lport=29180 family="inet" sock_type="dgram" protocol=17 [ 753.752328] audit: type=1400 audit(1427889723.496:82): apparmor="denied" operation="file_inherit" profile="/usr/lib/networkmanager/nm-dhcp-client.action" pid=3423 comm="nm-dhcp-client." lport=47709 family="inet6" sock_type="dgram" protocol=17 [ 1038.498282] usbcore: registered new interface driver usbserial [ 1038.498299] usbcore: registered new interface driver usbserial_generic [ 1038.498312] usbserial: usb serial support registered generic
thank again, if can give me small idea, take it! see soon
edit 9/04/2015 found something. lsusb see device as:
bus 003 device 020: id 12d1:1f01 huawei technologies co., ltd.
1f01 idproduct, can change sometime, because modem goes different mode on own. if 1f01, do:
sudo usb_modeswitch -v 12d1 -p 1f01 -m '55534243123456780000000000000011062000000100000000000000000000'
this force device device change mode. device have idproduct iqual 1001. lsusb see it:
bus 003 device 023: id 12d1:1001 huawei technologies co., ltd. e169/e620/e800 hsdpa modem
and have 4 new usb dev: usb0, usb1, usb2 , usb3. going try minicom send @ command.
so basically, problem not see modem serial. explained how that, have force modem command:
sudo usb_modeswitch -v 12d1 -p 1f01 -m '55534243123456780000000000000011062000000100000000000000000000'
then tried minicom, nice, have connect using right parameters baud rate , port. , test. see writing in minicom, enable local echo (ctrl+a z option). can send information want.
but wanted integrate in python script here code:
def terminalcomandread(a,b) : found = false proc = subprocess.popen([a], stdout=subprocess.pipe, shell=true)#send command (out, err) = proc.communicate() string=str(out) #print(string) foundstring=string.find(b, 0, len(string))#look string b in serial answer of device if foundstring != -1 : found= true #send true if found return found def send(data,ser): try: ser.write(data)#write command serail port except exception e: print "couldn't send data serial port: %s" % str(e) else: try: sleep(1) data = ser.read(1)#read serial except exception e: print "couldn't read data serial port: %s" % str(e) else: if data: # if data = none, timeout occurr n = ser.inwaiting() if n > 0: data += ser.read(n) return data def searchmodem(): foundmob= false foundusb= false sudopassword='figaro5558_'#my sudo password command="usb_modeswitch -v 12d1 -p 1f01 -m '55534243123456780000000000000011062000000100000000000000000000'" # command ce modem on serial mode while foundusb!= true : # allows me modem usb , force foundmob=terminalcomandread("lsusb",'12d1:1f01')#doing ls usb , looking id of device changemob=terminalcomandread("lsusb",'12d1:1001')#this id of device when in serial mode if foundmob == true : sleep(1) os.system('echo %s|sudo -s %s' % (sudopassword, command))# line execute command on sudo foundusb=terminalcomandread("ls /dev/ttyusb*",'ttyusb1') if changemob == true : foundusb=terminalcomandread("ls /dev/ttyusb*",'ttyusb1') if foundusb == true : print('modem ready connection') ttyusb0=terminalcomandread('dmesg | tail -50','now attached ttyusb0') #look int dmesg if there new usb port if ttyusb0 == true : usbport='/dev/ttyusb0'#give path return usbport ser = serial.serial(usbport, 9600, bytesize=8, parity='n', stopbits=1, timeout=1, rtscts=false, dsrdtr=false) #connect serial cmd="at^hcsq?\r\n"#the @ command msg=str(send(cmd,ser))#use send function send @ command print(msg)
so worked me, hope you! cheers
Comments
Post a Comment