Search This Blog

Tuesday, January 21, 2014

A little note about ALSA and x220i thinkpad


First of all you need to find out sound cards indexes.
#> cat /proc/asound/cards
0 [PCH]:         HDA-Intel - HDA Intel PCH
                 HDA Intel PCH at 0xf2520000 irq 42
29 [ThinkPadEC]: ThinkPad EC - ThinkPad Console Audio Control
                 ThinkPad Console Audio Control at EC reg 0x30, fw unknown
so HDA Intel PCH has index 0

#> /etc/asound.conf
pcm.!default {
   type hw
   card 0
}
ctl.!default {
   type hw
   card 0
}


cat /etc/modprobe.d/alsa-base
options snd-hda-intel model=laptop index=0
options snd-hda-intel model=thinkpad

Monday, January 20, 2014

Remote reset or reboot Yealink T20\T22


Just send HTTP POST to:
http://192.168.1.2/cgi-bin/ConfigManApp.com (192.168.1.2 - phone address)
with header for basic auth:
'Authorization: Basic KJDSGHj54KLDSJ3='
and content:
PAGEID=7&CONFIG_DATA=RESETFACTORY - for reset

PAGEID=7&CONFIG_DATA=REBOOT - for reboot

Python example

#> python
import urllib2
post = urllib2.Request('http://192.168.1.2/cgi-bin/ConfigManApp.com?Id=7')
post.add_header('Authorization','Basic KJDSGHj54KLDSJ3=')
response = urllib2.urlopen(post, 'PAGEID=7&CONFIG_DATA=RESETFACTORY')

response.msg.lower() == 'ok'
response.code == 200

response.read()
>>> '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html><body><script type="text/javascript">if(parent && parent.onloadIFrame)\n   parent.onloadIFrame("Talking");\nelse\n   window.location.replace(\'/cgi-bin/ConfigManApp.com?Id=13\');\n</script></body></html>'

>>> '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html><body><script type="text/javascript">if(parent && parent.onloadIFrame)\n   parent.onloadIFrame("RESETFACTORY");\nelse\n   window.location.replace(\'/cgi-bin/ConfigManApp.com?Id=13\');\n</script></body></html>'