Logitech M310

Since replacement mouse wheel encoder for my A4Tech X-710 turned out to be almost as imprecise as old one and it's USB cable has lost almost all isolation exposing wires (I guess chemical decomposition over time) and plastic cracked a little next to screws it's time to change mouse.
I've bought refurbished Logitech M310 for $12.
First impression:
  • it's "full size" mouse and it turns out it's very similar in size and shape to X-710
  • left and right button are nice but little louder than in A4Tech
  • middle/scroll button is slightly hard to use requiring some force to be pressed and pretty loud
  • scroll wheel moves quietly and with little resistance although still seems to be precise (contrary to opinions I've found on micro-precise scroll used e.g. in M325)
  • off-center optical sensor probably needs some time to adjust to (sensor in X-710 was placed exactly in the middle)
  • mouse feet seem interior to those (thicker and 6 instead of 4) in X-710
  • mouse worked out of the box (I'm not sure if paired earlier or does not require pairing), no software installation was necessary with Windows 7 
Because of asymmetric optical sensor location I wouldn't recommend it for people using left hand (or both hands) - when using with right hand it feels like it has lower dpi than X-710 (i.e. less than 1000) while using with left hand it behaves very strange. It must be related to anatomy - when rotating mouse with right hand cursor moves only a little (this is fine) while when rotating even little with left hand cursor moves whole screen length.
If you are using windows consider turning off "Allow this device to wake up the computer" option in device manager to not be surprised with accidental waking up of computer. Useful commands:
  • powercfg lastwake - check reason of last wakeup
  • powercfg -devicequery wake_armed - list devices allowed to wake PC
Although producer recommends alkaline cell (i.e. 1.5V cell) it works fine with charged NiMH eneloop 2000mAh cell. With my use (5-6 hours on work day, more on weekends, no ON/OFF switch used) it worked 2.5 months from this cell, down to 0.945V.

I am not noticing optical sensor performance drop after switching from X-710 which is probably good thing. I'm using cloth mouse pad thus these are not challenging conditions though.

Damage on button plastic was caused by using aggressive solvent for cleaning microswitch and not waiting for it to dry


Saleae logic analyzer clone

 Popular sub-$10 clone of USBee AX Pro / Saleae logic analyzer. Works with sigrok under Windows and under Linux (may require using unofficial package repository for ubuntu 14 or older). As open source firmware is used with sigrok there seems to be no copyright violation.
See also:
One of the limitations is incompatibility with 1.8V logic.
 Build quality might have been better as with one I bought case latches were not closing because LED diodes positions were not matching cuts in top cover.


ST-Link v2 clone

Popular cheap ST-Link v2 clone from China

STM32F101CBT6 is used instead of STM32F103CBT6 that may be found on "regular" ST-Link v2. Fun fact: STM32F101CBT6 does not officially has USB device.
See also: https://github.com/blacksphere/blackmagic/issues/62

Board markings MX-LINK V2 2016-01-18.


Promo: free C++ Builder 10.1 Berlin Starter

In the past few weeks price for C++ Builder Starter was jumping between €68 and €0 (free) while quoted regular price is €307. This IDE may have best days behind it but VCL still is my favorite GUI toolkit for native windows applications.
I've worked with it for about week porting some older application, so here are few notes:
  • as clearly stated it supports only Win32 target: I'm fine with it
  • limited commercial use: not a big problem
  • it cannot import project import from older BDS2006 thus project needs to be recreated manually - there are few gotchas for older BDS users
  • heavily reduced debugging functionality: no "Local variables", no "Attach to process", cannot expand/dererence aggregates - this is why I won't leave BDS2006
  • some code bloat, e.g. 2MB -> 4MB for not so complicated application
 There is also similar promotion for Delphi.


Eclipse usability notes

Remove unused toolbar items

Eclipse Mars installed as a part SW4STM32 uses two rows of toolbar items and most of them are probably not frequently used. To get rid of them use Window/Perspective/Customize perspective... menu.

Remove status bar

Status bar does not seem to present any useful information. Line numbers are displayed in editor window anyway, current column number and Insert/Overwrite mode state don't not seem important to me. To hide status bar open e4_basestyle.css file from Eclipse directory (in my case: Ac6\SystemWorkbench\plugins\org.eclipse.ui.themes_1.1.1.v20151026-1355\css) and add at the bottom of it:

#org-eclipse-ui-trim-vertical2 {
   visibility: hidden;

Update file timestamp before building

Project properties, C/C++ build, Settings, Build Steps, Pre-build steps:
${ProjDirPath}\build-tools/touch.exe ${ProjDirPath}\..\..\main.c
For a list of environment variables look at C/C++ Build, Build Variables and check "Show system variables":


Mocecom MC-STARTER mouse and replacing A4Tech X-708 encoder

Mouse wheel encoder in my old A4Tech X-708 started causing problems again (moving in opposite direction at one position and not moving at all at another position) and cleaning it with organic solvent was no help. Let's take a look inside:
As you can see it's covered with oil remains and some rust and it has miles behind it. On the bottom side of the wheel there are three contact springs - quite fragile as I broken one of them when trying to bend it. Well, it wouldn't help for long probably anyway.
Fortunately I had cheap Modecom MC-STARTER mouse lying around - almost unused as it just feels too cheap to use - little too small, little too light but still moving with too high resistance on cloth mouse pad.
It is based on MX8731 all-in-one chip - optical sensor and USB device in one from Shenzhen LIZE Electronic Technology Co., Ltd.
Mouse wheel encoder is identical as in A4Tech X-708/X-710.


RPS provisioning with yealink

It looks like awareness of security problems with yealink (and many other manufacturers for that matter) rised at the end of 2013:
Basically, if your phone can fetch configuration from publicly available server so can anybody else. There are no private certificates used, often no encryption of any kind at all. And what about yealink AES encryption? At first session phone fetches user-defined AES key for configuration file (y000000000000.cfg). This key is encrypted with AES and common key inside separate file (y000000000000_Security.enc).

Whiskey Tango Foxtrot

It shouldn't take long to recover common AES key either from windows/linux encryption tools provided by yealink or from phone firmware itself. Once it is known, AES key for configuration can be decrypted, then configuration can be decrypted (with operator configuration, including password) leading to toll frauds.

I know you're too lazy, I am too. Fear not, as someone found common AES key already:

# Yealink's encryption tool generates a "random" key using characters
# [a-zA-Z0-9].  It uses this key directly as a stream of bytes to
# encrypt the configuration file with AES-128-ECB.  Then it encrypts
# this key with a "common" key distributed as part of the firmware and
# the encryption tool and writes the result to a second file, also
# using AES-128-ECB.

encrypt () {
 local key="$1"
  openssl enc -aes-128-ecb -nopad \
    -K $(printf "$key" | xxd -p)

decrypt () {
  local key="$1"
  openssl enc -aes-128-ecb -d -nopad \
    -K $(printf "$key" | xxd -p)

encrypt_key () { encrypt 'EKs35XacP6eybA25'; }
decrypt_key () { decrypt 'EKs35XacP6eybA25'; }
encrypt_cfg () { encrypt "$1"; }
decrypt_cfg () { decrypt "$1"; }

test_lib () {
  printf "Test that key decryption/encryption produces identical results..."
  (decrypt_key < test/test_Security.enc | encrypt_key | diff test/test_Security.enc -) \
    && printf "Success\n" || printf "Failure\n"
  printf "Test that we produce identical encrypted configs..."
  local key=$(decrypt_key < test/test_Security.enc)
  (decrypt_cfg $key < test/test.cfg | encrypt_cfg $key | diff test/test.cfg -) \
    && printf "Success\n" || printf "Failure\n"

Source: https://github.com/traviscross/yealink-confenc.


FreeSWITCH on Windows - first impression

Few notes from compiling and running FreeSWITCH on Windows

In the hope of getting help with some faxing/T.30 problems from great VS debugger I've built FreeSWITCH 1.6.8 for Windows. So far I can say that Windows version is well prepared as contrary to building under Linux (tested Ubuntu 14 LTS) it works out of the box (i.e. without solving dependency puzzle).

From what I remember some earlier FreeSWITCH versions supported multiple VS versions or at least contained project files for older and relatively lightweight VS2008. With FS 1.6.8 only VS2015 is supported. Although this IDE still has free versions I definitely dislike that Microsoft forces installation of Visual Basic (which I have absolutely no intent to use) while making C++ optional. With all that .net baggage be prepared for 9GB disk usage (+ few extra hundreds for IE 10/11 if you don't have it with Windows 7) for VS2015 Community.

FreeSWITCH groups multiple project files. Although it seemed to me that building just FreeSwitchConsole project and mod_sofia from Endpoints group would create minimal functional set - it you don't build other modules, at least one that you would in /conf/autoload_conf/modules.conf.xml after building basic executable you'll gonna have bad time... With XML dialplan files ignored you won't be able making basic calls.

Configuring and debugging requires lot of try-and-error for me thus I've opted to completely disable UPnP that adds significant delay to application startup. Modified switch_nat.c:
#if 0
    if (!nat_globals.nat_type) {
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for UPnP\n");

To add SIP operator create new configuration file in conf/sip_profiles/external/<operator_name>.xml.
To check operator status use
sofia status
sofia status gateway <sip_provider>
"REGED" means registered.

To add internal SIP extension (softphones, desk phones to register) create configuration files in conf/directory/default/. Default configuration contains already extensions with numbers 1000 - 1019. Edit vars.xml file to change default password (from 1234) for all these extension, I think they are disabled until it is done as log says:
Open vars.xml and change the default_password

To check internal extensions status use list_users command.

Other useful commands:
  • shutdown or ... = quit
  • show calls
  • reloadxml
  • sofia global siptrace on - log RX/TX SIP messages



Small flashlight powered by 3 NiCd button cells, rechargeable directly from mains with simple inductorless charger. Made in (late) USSR, probably in the early 90s. Surprisingly reliable and very economical in use.
After cleaning cell contacts (residue in a form of crystal needles, most likely rich in cadmium) it still charges and works.


Manta MID721QC

Very cheap 7" tablet distributed probably under dozen different brands:
  • Allwinner A33, quad-core A7 running at 1.2GHz with Mali400 graphics
  • 7" 800x480 display with poor viewing angles (I can say that just viewing it in vertical position can give strange impression as left and right eye see slightly different images) and capacitive multitouch
  • WiFi
  • VGA front camera
  • accelerometer
  • Android 4.4.2
  • 512 MB RAM, 4 GB Flash
  • microphone and (poor) speaker
  • micro SD slot
  • roughly 4 hours on battery (WiFi, internet), up to 6 hours (WiFi disabled, minimum brightness, PDF reader)
 I believe this tablet had factory installed trojan - at least I don't think I could infect it just in an hour and such "accidents" are not rare. This must have pretty fresh mutations as VirusTotal says that file was first scanned on 2015-12-12 (https://www.virustotal.com/en/file/401a320b23213932b222cc0afb8c69acb12efb9cbeb1884f0873a581d0192f96/analysis/)
Trojan was embedded in GoogleQuickSearchBox.apk (system application) and required rooting to remove. I believe it was responsible for opening fishy "antivirus" site once or twice and it also tried to install "WiFi Booster" (another malware?).
Case is easy to open with bare hands.
PCB markings: AL-Ax3-Q8-V1.1 2015-01-21
Serial number from sticker vanished just after few hours of light use; nice trick to void varranty
2200mAh cell (still lot of spare space), main board
357090 (3.5mm x 70mm x 90mm) 2200mAh protected cell. It looks like 3575100 (3000-3500mAh) should fit also.
unpopulated: vibration motor?

ESP8089 WiFi (close cousin of ESP8266); FBNL83A51K3BAAWP 32Gb NAND from Spectek

2x K4B2G0846 2Gb DDR3

LPA4890CM audio amplifier; up to 350 mW output power in this configuration, in reality probably 50 mW, might be worth tweaking

'7660 voltage converter (backlight power supply?)

AXP223 power manager

miniature camera (VGA)

8 ohm speaker with no markings


Lenovo T500

Few notes on Lenovo T500 - in comparison with R500

  • slightly lighter and tinner, yet simingly on pair with durability to R500
  • LCD unit cover has rubbery finish; it feels nicer than hard plastic in R500 but is more susceptible to scratches
  • palmrest, keyboard and bevel above keyboard is virtually identical - one difference is speakers placement which are placed at the top instead of at the sides of keyboard; if feels little more solid under pressure but on the other hand keyboard seems to have less support in the top right corner
  • bottom part is made of metal instead of plastic; while R500 was already very solid it takes it one step further and from my perspective removes small problem with R500 - bottom plastic was easy to damage if using too much torque for the screws holding e.g. palmrest
  • it's easier to find unit with mid/top specification (Penryn, BT, camera) as T500 probably was not even sold with Merom
  • 1280x800 screen is no better than in R500 (quite low viewing angles), although it comes with LED backlight this time
  • same as with R500 it works great with Linux - in fact causing less problems (and these are common) that Windows
    • I had problems enabling bluetooth on Windows - it probably requires installing lenovo bloatware but it worked out of the box with Linux and stayed enabled when switching back to Windows
    • for unknown reason Conexant Audio 20561 muted speaker output (headphone output was fine) under Windows 7 while leaving no clue (i.e. OS did not saw output as muted); pressing Vol+ key on keyboard and/or upgrading driver helps for it although headphone output disappeared from available volume controls replaced by SPDIF (not a big loss)
  • it uses Ultrabay Slim instead of Ultrabay Enhanced - your DVD drive from R500 may not fit into T500

  •  same as R500 it is NOT spill resistant; yes, there are spill drains at the bottom but there is no way in hell water will flow through them instead of frying mainboard
    • there are no spill drains on the keyboard (at least not on mine - neither with R500 nor T500)
    • can you even spot drain holes looking from top?
    • spilled water can flow freely through gaps between palmrest , top bevel and keyboard
  • LCD unit is connected with flex connector instead of bunch of wires
  •  apparently different keyboards (despite being replaceable) can have slightly different construction

Notes from (almost) replacing fan

As original fan started making noises - especially when using in non-flat position - I've bought cheapest replacement. T500 seems to be starting fan even under light loads (CPU temperature less than 50C) but fan is very quiet then. This is original fan, MCF-224PAM05, it seemed that noised were caused by loose bearing:
And this is el cheapo replacement I bought on ebay for $2.69 with direct shipping from China, MCF-217PAM05, advertised as fitting ThinkPad T61 T61P R61 W500 T500 T400:
Both are using 3-pin connector. Although they seem similar new one did not fit too well - it was slightly higher and even after replacing ventilator with "original" (more fins but slightly lower profile) it required some bending (for its credit: original one apparently was also slightly bent). Apart from that its shape is slightly different, so piece of tape was required for sealing. Worst part is, new one was pretty loud right from the start and noises did not disappeared after a weak. Strangely, after switching back to original fan noises disappeared - perhaps cleaning/reassembling was enough.
More photos: