Friday, 23 August 2013

How does a touchscreen work?

   Ever wondered how your touchscreen accepts the commands that you want it to undertake just by the touch of it using your finger or just using a stylus or some other stuff? And OOOww not all phones can accept both a stylus and a finger, some only accept finger touch while others the pen touch...
  Well below is an explanation of how all that stuff works courtesy of    #Hack_The_ universe
How Touchscreen Works ??

A touchscreen is an electronic visual display that the user can control through simple or multi-touch gestures by touching the screen with one or more fingers. Some touchscreens can also detect objects such as a stylus or ordinary or specially coated gloves.

Touchscreens are common in devices such as game consoles, all-in-one computers, tablet computers, and smartphones. They also play a prominent role in the design of digital appliances such as personal digital assistants (PDAs), satellite navigation devices, mobile phones, and video games.

Working of Touch Screen Are very Interesting. Here's How they Work:

There are three basic systems of Touch Screen:
1. Resistive System
2. Capacitive System
3. Surface Wave acoustic


The RESISTIVE SYSTEM consists of a normal glass panel that is covered with a conductive and a resistive metallic layer. These two layers are held apart by spacers, and a scratch-resistant layer is placed on top of the whole setup. An electrical current runs through the two layers while the monitor is operational. When a user touches the screen, the two layers make contact in that exact spot. The change in the electrical field is noted and the coordinates of the point of contact are calculated by the computer. Once the coordinates are known, a special driver translates the touch into something that the operating system can understand.

Working Of Resistive Touch Screen !!!

In the CAPACITIVE SYSTEM, a layer that stores electrical charge is placed on the glass panel of the monitor. When a user touches the monitor with his or her finger, some of the charge is transferred to the user, so the charge on the capacitive layer decreases. This decrease is measured in circuits located at each corner of the monitor. The computer calculates, from the relative differences in charge at each corner, exactly where the touch event took place and then relays that information to the touch-screen driver software. One advantage that the capacitive system has over the resistive system is that it transmits almost 90 percent of the light from the monitor, whereas the resistive system only transmits about 75 percent. This gives the capacitive system a much clearer picture than the resistive system

Working Of Capacitive Touch Screen !!!


The SURFACE WAVE ACOUSTIC SYSTEM works with help of wave energy. This enables a touch to transform into another form of energy and deliver the command which in response perform the desired action. A Pair of transducers is placed on glass plate sides. In the Glass Plates there are reflectors. On touching the screen wave produced and which transforms into energy for fulfilling the command. It tells where on the screen touch is detected.

Saturday, 17 August 2013

Linux Tweaks to Unlock Huawei Modem using Python

#borrowed from (Zenu)

  If you wonna unlock your 3G Modem and you have linux installed in your system you just need to follow the two stipulated steps below... They all are simple
  1. Unlock the modem using Simbwa Phillip steps.
  2. Set the APN of the SIM Network whenever initializing the modem 
A) Using the Simbwa Phillip Steps
Two ways of unlocking your 3G modem (first– the easyway, second, the geeky way).
Prerequisites:
a). Python 2.6 or greater
b). For the easyway (huawei modems), download and install pyhumod 0.03 from here . If you choose to go the geeky way, you don’t need the pyhumod. Also if the easy way fails, go the geeky way
The easy way Huawei modem:
Paste the following code in your preferred linux editor even if its the console  and save it as whatever name you choose (e.g huawei_unlocker.py)
#!/usr/bin/env python

import hashlib
import humod
UNLOCK_SALT = "5e8dd316726b0335"

def show_code(imei, salt):
    digest = hashlib.md5((imei+salt).lower()).digest()
    code = 0
    for i in range(0,4):
        code += (ord(digest[i])^ord(digest[4+i])^ord(digest[8+i])^ord(digest[12+i])) << (3-i)*8
        code &= 0x1ffffff
        code |= 0x2000000
    return code

mod = humod.Modem()
imei = mod.show_imei()
status = humod.at_commands.Command(mod,'AT^CARDLOCK="'+str(show_code(imei,UNLOCK_SALT))+'"\r')
#------------------- code ends here -----------------------------

After save the file and quit your editor
Check that you have plugged in your modem and has been detected by system. (“dmesg | tail” could help. Check that you have ttyUSB0, ttyUSBx where x could be 1 or 2)
Execute the python script on commandline like so:
python huawei_unlocker.py
Thats it!
2). The geeky way
Plug in your modem
Check that its has been read by the system
Then at your terminal type:
# cat /dev/ttyUSB0 &
We then extract the IMEI serial of the modem like so:
# echo -e “ATI\r” > /dev/ttyUSB0
Make note of the IMEI serial
In your favorite editor paste the following code and save it as unlock.py
 #!/usr/bin/env python

import hashlib
UNLOCK_SALT = "5e8dd316726b0335"

def show_codes(imei, salt):
    digest = hashlib.md5((imei+salt).lower()).digest()
    code = 0
    for i in range(0,4):
        code += (ord(digest[i])^ord(digest[4+i])^ord(digest[8+i])^ord(digest[12+i])) << (3-i)*8
        code &= 0x1ffffff
        code |= 0x2000000
    return code

# PLEASE TYPE YOUR IMEI  BELOW
imei = ' '
if(imei == ' '):
    print 'Please open this script from your editor and enter your IMEI'
else:
    print "Your Modem unlock code: %s" % show_codes(imei,UNLOCK_SALT);
Execute the above script to generate your modem unlock code
Now its time to unlock the modem and we do it like so:

# echo -e 'AT^CARDLOCK="XXXXXXXX"\r' > /dev/ttyUSB0

(Please use your generated modem unlock code in place of XXXXXXXX)
You should see the modem reply with an OK
Press CTRL + C



B)Set the APN of the SIM Network whenever initializing the modem

i - For linux if your using wvdial change the wvdial.conf or add the line below which sets the APN name
Init3 = AT+CGDCONT=1,"IP","TelecomNetworkAPNName"
ii - For windows users, go to the device manager -> Modems -> Open properties of the modem -> Under Advanced -> in the extra initialization commands field put the entry
AT+CGDCONT=1,"IP","TelecomNetworkAPNName"
The TelecomNetworkAPNName varies from Telecom, for UTL it is utweb and for Orange it is orange.ug.
So now you can create a connection with a dial number *99# or *99***1#.