Saturday, December 29, 2012

Pairing Bluetooth Keyboard on Windows and Linux using the same receiver

Found a solution on the web with authenticated connections here (the original description is far more detailed).

Short description (so that it is still available for me ;) ):

  1. Pair with (each) Linux
  2. Pair with Windows
  3. Extract authentication key from Windows from windows registry (stored in Windows/System32/config/system) using libhivex-bin
    hivexml system | perl -ane 's/</\n</g; print' | grep -i 'key="YOUR BLUETOOTH ID WITHOUT : "' 
  4. Decode the content of xml-entity with Base64
  5. Replace Linux authentication key with the extracteted version Linux /var/lib/bluetooth/RECEIVERID/linkkeys
  6. Restart Bluetooth service
    sudo service bluetooth restart

I can confirm that this works using Ubuntu 12.10 and Windows 8 with a Apple Wireless Keyboard.

Alternative solution without authentication (I WOULD NOT RECOMMEND THIS FOR A KEYBOARD) can be found here.

UPDATE: Still works with 13.04

Friday, December 28, 2012

HTML JS publish click-events to all childs

I have tables with one radio button per cell and its quite annoying to aim at the radio button completely...
<td onclick="for (var i in this.childNodes) 
if(typeof this.childNodes[i].click === 'function') 
    this.childNodes[i].click();">
  Just clickable text
  <input type="radio" />
</td>

Thursday, December 20, 2012

CSipSimple - Getting started to hack it (tailor to my needs)


Just one or two things I need to remember about CSipSimple:

Infrastructure
  • SipStack runs in background (communication via Parcable interface). It interacts with PJSIP.
    Important there is a watchdog timer (about 5s)!
  • pjsua.java, pjsuaConstants is the SWIG generated interface to PJSIP
  • Native functions never return boolean, check for pjSuaConstants.PJ_SUCCESS
  • Be aware of string exchange with the native stack: PjSipService.pjStrToString(...)
  • UAStateReceiver.java does the call creation and everything related to SipStack
  • PjSipService.java is deeply integrated with UAStateReceiver.java (for example does recording...)

UI
  • CustomDistribution.java defines some things for fast modifying the behavior
  • Main screen is created in SipHome.java (incl. the slidable tabs)
    To remove tabs, just disable tab.add (except for the warning tab and the message tab [message disable in CustomDistribution.java]: may be triggered from outside)
  • Notifications are handled in SipNotifications.java (but from Sip-Thread)
  • DialerFragment.java is the dialer incl. call button and account switcher...
    Here the re-dial functionality is missing... (press the call button twice without number should redial previous number)
  • InCallActivity.java :)
    Important call setup is done BEFORE launching the InCallActivity via SipManager.ACTION_SIP_CALL_UI from UAStateReceiver.launchCallHandler(...).
    There is even a activity start delay of 2000ms (UAStateReceiver.LAUNCH_TRIGGER_DELAY).
    I think it's not nice!!!! Because a user may hear sound of before the UI is ready, but there is might be a problem with race conditions...
  • InCallControls.java is the ui element on the bottom of InCallActivity to control Bluetooth and loudspeaker etc. (Deeply integrated with InCallActivity: sadly NO MVC...)
  • InCall.java is also related to Dialer