2015-02-12

USB

root@office:/usr# lsusb -t
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
    |__ Port 2: Dev 7, If 0, Class=Vendor Specific Class, Driver=, 12M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
    |__ Port 2: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/8p, 480M

root@office:~# lsusb
Bus 005 Device 007: ID 0403:0000 Future Technology Devices International, Ltd H4SMK 7 Port Hub

usbreset:
http://askubuntu.com/questions/645/how-do-you-reset-a-usb-device-from-the-command-line

sudo su -

stty -F /dev/ttyUSB0 speed 9600 cs8 -cstopb -parenb -echo 
 
echo -en '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' > /dev/ttyUSB0
 
while read -r line
do
  echo -en $line > /dev/ttyUSB0
done < "$1" 

stty -F /dev/ttyUSB0 speed 9600 cs8 -cstopb -parenb
while true; do         read -n 1 LINE < /dev/ttyUSB1;         echo $LINE | xxd -p; done
 
stty -F /dev/ttyUSB0 9600 cs8 -cstopb -parenb -icanon min 1 time 1
while true; do
        cat -v < /dev/ttyUSB0
done


 
while read -rs -n 1 c; do echo $c | xxd -p; done < /dev/ttyUSB0
while read -rs -n 1 c; do echo $c | od -x; done < /dev/ttyUSB0

 Text2Conv="Aa"
root@encaps-System-Product-Name:~# for letter in $(echo "$Text2Conv" | sed "s/\(.\)/'\1 /g");do printf '%x' "$letter";done
4161

openwrt

http://cyber-place.ru/download/packages/libusb_0.1.12-3_ar71xx.ipk
opkg -i ./libusb_0.1.12-3_ar71xx.ipk

https://manoftoday.wordpress.com/2007/10/11/writing-and-compiling-a-simple-program-for-openwrt/

libc - 0.9.33.2-1
libelf - 0.8.13-1
libgcc - 4.6-linaro-1

2015-02-09

SIM900A





AT+GMM

SIMCOM_SIM900A


AT+CPIN?

+CPIN: PH-NET PIN #Locked

UNLOCK:
+ http://www.geekonfire.com/wiki/index.php?title=GPRS_Shield%EF%BC%88SIM900%EF%BC%89_Firmware_Update

http://www.instructables.com/id/Using-a-SIM900A-GSMGPRS-module-in-Australia/?ALLSTEPS

fix FTDI
+ http://www.eevblog.com/forum/reviews/ftdi-driver-kills-fake-ftdi-ft232/1695/?PHPSESSID=2a52cb2f8984571712cbdefc17dcbe64
https://mrcn.st/t/ftdi_clone_tool.py

AT+CGMR

Revision:1137B03SIM900A64_ST_ENHANCE

AT+GMM

SIMCOM_SIM900 

GSM signal strength:
AT+CSQ

+CSQ: 10,0 

Уровень сигнала:
0 -115 дБл и меньше
1 -112 дБл
2-30 -110..-54 дБл
31 -52 дБл и сильнее
99 – нет сигнала.


AT+COPS?

+COPS: 0,0,"MTS UKR"  


 AT+CNUM

+CNUM: "","+380661546***",145,7,4



SMS
http://tronixstuff.com/2014/01/08/tutorial-arduino-and-sim900-gsm-modules/
Sample code to receive SMS using SIM900 and Arduino

http://www.smssolutions.net/tutorials/gsm/sendsmsat/
http://tronixstuff.com/2014/01/08/tutorial-arduino-and-sim900-gsm-modules/
http://www.expertcore.org/viewtopic.php?f=18&t=4347
AT+CMGD=1,4"); // Delete all SMS
 sendATcommand("AT+CMGF=1", "OK", 1000);    // sets the SMS mode to text
    sendATcommand("AT+CPMS=\"SM\",\"SM\",\"SM\"", "OK", 1000);    // selects the memory

    answer = sendATcommand("AT+CMGR=1", "+CMGR:", 2000);    // reads the first SMS 

AT+CMGF=OKSpecifies the input and output format of the short messages. 0 for PDU mode and 1 for text mode.








AT+IPR=9600

AT+CPMS=?

+CPMS: ("SM"),("SM"),("SM")   #read, save, receive


AT+CMGF=1  
OK

AT+CPMS="SM"

+CPMS: 6,20,6,20,6,20


AT+CMGR=1  

+CMGR: "REC READ","MTS","","14/02/26,21:16:21+08"
Otrymano 5.00 UAH, 26.02.2014. Vash balans: 9.94 UAH. Termin diji do 26.02.2015. * MMS za 1 kopiyku! Aktyvacija Super MMS: *101*206# (10,63grn)
 


AT+CMGD=1 #delete msg 1 
AT+CMGD=1,4 #delete ALL

+CMTI: "SM",1  #new msg

AT+CMGR=1  

+CMGR: "REC UNREAD","+380664989***"," 0 7 0","15/02/13,19:30:15+08"
Test2

OK  


AT+CMGL="ALL" 

+CMGL: 1,"REC READ","+380664989***"," 0 7 0","15/02/13,19:35:05+08"
Test3

+CMGL: 2,"REC UNREAD","+380664989***"," 0 7 0","15/02/13,19:35:48+08"
Tesy 


SEND:
AT+CMGS="+380664989***"
Water sensor heartbeat active.
 SIM900.print((char)26); // ASCII code of the Ctrl+z is 26
SIM900.putc(0x1A)

Send to GSM: 'ASD
GS="+380664989***" 

> ^z
+CMGS: 3

OK


 delay(100);
 SIM900.println()

ATD*101#
380664989***"


OK

+CUSD: 0,"Zaraz na Vashomu rahunku 2.98 grn. Vash tarif Taryf 'Prostyi MTS' diisny do 07.02.2016. Kil'kist' bonusiv za vhidni dzvinky 0.",64

############################33
misc:
https://github.com/ekapujiw2002/sim900-avr-gcc
http://www.blog.zapro.dk/?p=368
+ http://pixelatedpic.blogspot.nl/2013/08/simcom-sim900a-fixed.html
http://amichalec.net/2014/08/sim900a-fixed-for-europe/
http://forum.arduino.cc/index.php?topic=186374.0
+ http://amichalec.net/2014/08/sim900a-fixed-for-europe/
 
+ http://alex-exe.ru/radio/wireless/gsm-sim900-firmwar-all-in-one/

http://forums.kuban.ru/f1060/gsm_modul-_sim900a_-_kak_zastavit-_rabotat--5363026.html
http://electronix.ru/forum/index.php?s=9f70250bbf1779417aaa05d653006b83&showtopic=117351

Example of how to store your own mobile phone number into your SIM:

AT+CPBS="ON"

OK

AT+CPBW=1,"99XXXXXXXX",129,"Voice"

OK

Your phone number should now be stored. Use the AT+CNUM command to verify.

AT+CNUM

+CNUM: "Voice","99XXXXXXXX",129

OK

AT+CNUM may not return phone number on SIM based products - SIM Provider may not always program

PROBLEM: The AT+CNUM command just returns OK instead of the SIM's phone number.

SOLUTION: The +CNUM command reads a special phone book storage area reserved for the SIM's own phone numbers. The service provider may or may not store the phone number for you. If you want to read the MDN with the +CNUM command and it is not currently programmed, use the following procedure:

AT+CPBS="ON"                            # Select MSISDN(s) phone book
AT+CPBW=,,,  # Write phone number to MSISDN phone book.
AT+CPBS="SM"                            # Optionally re-select default ("SM") phone book


Another way of setting the number on the SIM can be accomplished with one command AT#SNUM which appears in MultiTech's Lxxx, H5, and G3 product user guides. For example,
AT#SNUM=1,"5554443333"

See the AT command manuals for syntax details.

For the rCell 100 Series (MTR) products, go to the Cellular -> Radio Status page and set the MDN through the UI by clicking the MDN Update button.

http://android.stackexchange.com/questions/39748/how-do-i-find-out-my-sim-number

for sim900 AT+CCIDgives CCID.e.g.89912200000280775659
The first two digits (89 in the example) refers to the Telecom Id. The next two digits (91 in the example) refers to the country code (91-India). The next two digits (22 in the example(MNC of IDEA)) refers to the network code.
 http://www.knowreviewtip.com/check-find/know-check-your-mobile-number-sim-card-no/

Incoming call:

RING

+CLIP: "+3***",145,"",," 0 7 0",0

RING

+CLIP: "+3***",145,"",," 0 7 0",0

RING

+CLIP: "+3***",145,"",," 0 7 0",0

NO CARRIER 

2015-02-08

Android tips

int lHeigh = LinearLayout.LayoutParams.MATCH_PARENT;
int lWidth = LinearLayout.LayoutParams.WRAP_CONTENT;

  Log.d(TAG, "iv.getDrawable().getBounds().width(): " + iv.getDrawable().getBounds().width());
    Log.d(TAG, "iv.getDrawable().getIntrinsicWidth(): " + iv.getDrawable().getIntrinsicWidth());
    Log.d(TAG, "iv.getMeasuredWidth(): " + iv.getMeasuredWidth());
    Log.d(TAG, "iv.getWidth(): " + iv.getWidth());

Android framework src:
http://grepcode.com/file/repo1.maven.org/maven2/org.robolectric/android-all/4.4_r1-robolectric-1/android/telephony/TelephonyManager.java#TelephonyManager.getSubscriberInfo%28%29

Syslog dump
*#9900#