Tuesday, December 17, 2013

fixing Sony Xperia SP sudden music stops and other sound problems


1. The most common problem in Xperia devices: music playing sudenly stops while browsing with chrome or other browser. Pressing "pause/play" button does not help, have to restart the player. Happens in all players, including Walkman. Most common solution is to do a clean firmware reinstall.

Steps:
1) backup everything (i use Titanium Backup pro, root required)
2) download Sony Update Services tool:  http://www.sonymobile.com/gb/tools/update-service/
3) run it, follow the steps on screen
4) wait for applications to auto-reinstall, restore your backup users data, enjoy.

UPDATE:  it helped only for a while. after i some useage, especially, the software reinstall, the problems repeat. V6 SUPERCHARGE script did not help either. Only option is to use OperaMini.

2. Second most annoying problem, is not sufficient music volume in headphones. Most people say, that is done by manufacturer on purpose due to some law and sanitary restrictions to prevent ear damage. Well, if you are no afraid of ear damage, you may try apps like Volume+ (Sound Boost) in Play Market. (needs root) -- results vary. Personally I used this: http://forum.xda-developers.com/showthread.php?t=2370047&highlight=volume+boost . But the next thing works also good.

3. Music  sound enhancer: I recomend Viper4Android (root required, /system remount fix also needed): http://vipersaudio.com/blog/, far better than anything built in. Install the driver in normal mode, use "force" install, plug in the headphones, go into Settings -> Sound -> Sound Effect and choose Viper4Android. Afterwards it works in every player app you have. If the phone spontanously reboots, see the /system fix below.

4. Folder play: Walkman is neat, but it cannot play music by folders. Use "Rocket Player" (more feature rich) or "FolderPlayer" (simplier, faster) instead. MX video player is beast for video.

Otherwise, its a great device! The first time i do not want to experiment with firmwares. Besides, Android 4.3 and Android 4.4 official updates are promised! Tested its LTE with Russian BeeLine provider -- great speed!

Prerequisites for the above:
Other info:

UPDATE 20.03.2014:  I hoped that update to v12.1.A.0.266 with Android version 4.3 would've solved first to problems, but it didnt

Wednesday, November 27, 2013

Cuda 5.5 on OpenSUSE 13.1

Seems to work OK. Although it is not supported officially. The default compiler in OpenSuSE is gcc-4.8.1

All you have to do is:

1) install NVIDIA drivers (from a repository via YaST or manually from .run file)
2) download CUDA v5.5 as "run" file, not as "rpm".
3) run installer as

./cuda_5.5.22_linux_64.bin -toolkit -samples -override

no additional fixes needed, samples compile and run just fine. Have Fun! 

Friday, March 22, 2013

QT-Creator 2.6 with Intel Compiler

Recently i started developing a heavy-calculations application, which required iMKL, so that i decided to use Intel  C++ Composer as well, both in Linux and in Windows. I also decided to use QT-creator as my primary IDE for GUI development, although i kept using other IDE-s (VS, Eclispe) for tests.

1) Linux experience: 

I used OpenSuSE 12.3, that comes with  qt4-devel v 4.8.4 and qtcreator 2.6 packages. Intel says that it does not support opensuse, and installer refuses to work, so a little override is required. How to install Intel Composer 2013 on OpenSuSE 12.3
1) unpack the Intel Composer (or Parallel Studio), and go into the unpacked distribution folder
2) edit  silent.cfg file -- set the correct serial number or license information, set INSTALL_MODE=RPM
3) run  ./install --silent silent.cfg
4) If you use Eclipse CDT, dont forget to add Intel Integrations for Eclipse CDT (here)

Open Qt-Creator,
1) open Menu -> Tools -> Options -> Build&Run -> Compilers press "Add" and select "Linux ICC".
2) go to "Kits" options tab, select the default "Desktop" toolkit, press "Clone",
3) set its compiler to the ICC selected from above
4) set mkspecs filename to linux-icc

now the helloworld should build and run, and GDB should work as debugger. At least it stops on breakpoints. 

2) Windows experience - with Visual Studio: 

You are supposed to have VisualStudio in order to use Intel C++ Composer. So far I tested with VS 2012.  Also, my application was 64bit only, and, for compatibility reasons, i decided to stick with QT-4.8.4. 

It could work with pre-compiled Qt-4.8 built with vs2010, but since i needed 64bit application, i had to compile it myself. Open the according 64-bit VisualStudio compiler command prompt, go to QT sources and build them as usual: 

configure -prefix C:/install/path 
nmake
nmake install 

Now you need to setup an Intel toolchain within QtCreator. For some reason it does not allow it to do in GUI, so a trick is required. 
1. Go to Menu-> Parameters-> Build and Run -> Compilers
2. Select the according VS compiler, the same you used to compile your QT with. and press "Clone" button. Rename the new compiler toolchain. 
3. We will need to change it's path to initialization .bat file, but the GUI does not allow to do it, and we have to do it manually in config files. Open the file Explorer and go to  %AppData%\QtProject\qtcreator  folder (just copy-paste it into address bar) and open the toolchains.xml file with your favorite editor. It is an XML file that consist of ... entries. Find the entry which correponds to the toolchain copy  that you created previously. (Normally, It should be the one with the largest ToolChain.N number.) And replace the     <value key="ProjectExplorer.MsvcToolChain.VarsBat" type="QString"> and  <value key="ProjectExplorer.MsvcToolChain.VarsBatArg" type="QString"> lines with the following values: 

   <value key="ProjectExplorer.MsvcToolChain.VarsBat" type="QString">c:\Program Files (x86)\Intel\Composer XE\bin\compilervars.bat</value>
   <value key="ProjectExplorer.MsvcToolChain.VarsBatArg" type="QString">intel64 vs2012shell</value>

See the compilervars.bat itself for details. Note, that you should set the VarsBatArgs value according to you compiler version and platform. 

3. Create a new "Toolkit".
Go to Menu->Parameters->Kits 
Add the one you have, if it is still absent. It is configured to work with the same compiler that was used to build it. Now press the "Duplicate" button, and rename the new option for your convenience. In its properties change the compiler to the intel toolchain, created previously, and set mkspecs option to win32-icc

Now select this toolkit in the project properties. The sample helloworld project should compile and run just fine. However, it is possible, that the debugger is still not working - it never stops on breakpoints. To fix this go to QT installation folder and open the mkspecs/win32-icc/qmake.conf file. 
find the   QMAKE_CFLAGS_DEBUG = -Zi -MDd -O2  line, and change -O2 parameter to -Od so that it looks like: 

QMAKE_CFLAGS_DEBUG = -Zi -MDd -Od  

(UPD: seems like the latest versions already have this fixed)

So now the debugging should work as well, at least it stops on breakpoints!.


3) Visual Studio Express Edition notes:

 If you only have Visual Studio Express edition , you may encounter "Visual Studio is not found in the system" error when launching Intel 64 command prompt from Start menu. It is said that Express Edition does not support the Composer integration, so we only can use the Command Prompt to build applications. That is OK with me since i wanted to use QtCreator for development.

For most cases see:  http://software.intel.com/en-us/articles/error-visual-studio-2005-2008-or-2010-is-not-found-in-the-system-when-launching-intel-64

I have only Visual Studio 2012 Express edition for Windows Desktop, so I did the following:

1) locate compilervars_arch.bat file in  c:\Program Files (x86)\Intel\Composer XE\bin\  and open it for editing.
2)
locate the following strings:

::VS2012
if /i "%TARGET_VS%"=="vs2012" (
  if defined VS110COMNTOOLS (
    if exist "%VS110COMNTOOLS%..\IDE\devenv.exe" (
      if exist "%VS110COMNTOOLS%..\..\VC\vcvarsall.bat" (
         set MSVS_VAR_SCRIPT="%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
         goto Calls
      )
    )

and promptly after them add the following:

    if exist "%VS110COMNTOOLS%..\IDE\WDExpress.exe" (
      if exist "%VS110COMNTOOLS%..\..\VC\vcvarsall.bat" (
         set MSVS_VAR_SCRIPT="%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
         if /i "%TARGET_ARCH%"=="intel64" set TARGET_VS_ARCH=x86_amd64
echo "VS 2012 express for Desktop found"
         goto Calls
      )
    )

just before the if exist "%VS110COMNTOOLS%..\IDE\VSWinExpress.exe"  string. 

Friday, March 15, 2013

Running NVidia CUDA SDK 5.0 on OpenSuSE 12.3

There is a number of difficulties installing NVIDIA CUDA SDK 5.0 onto OpenSUSE 12.3. The major reason that it does not support  gcc 4.7.2 compiler that is distribution's default. There is a number of ways to overcome it.

1. install drivers. You may use packages from  OpenSUSE's NVidia repository or use the ones that come with cuda-sdk package. Both cases work fine, just make sure your driver's version maches the requirement.
There may be a problem with missing libraries, like libglut.so, just fix them with appropriate symlinks in your /usr/lib64 .

2. install cuda-sdk. Get the package from https://developer.nvidia.com/cuda-downloads. I used version for openSuSE 12.1. Install as superuser it with the following options: 

su - 
./cuda_5.0.35_linux_64_suse12.1-1.bin -toolkit -samples -override 

These options disable installation of NVidia drivers and skip the dependency  checks. 

Consider you've installed it into its default directory, i.e. /usr/local/cuda-5.0
(for other options see ./cuda_5.0.35_linux_64_suse12.1-1.bin --help)

Go to this directory, and do the following

3. disable GCC version check: 
open  /usr/local/cuda-5.0/include/host_config.h  
find

  #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 6)

and replace it with 

  #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7)

That alone won't help, and if you try to compile the samples you'll most likely get compile time errors like: 

/usr/include/c++/4.7/ext/atomicity.h(48): error: identifier "__atomic_fetch_add" is undefined

/usr/include/c++/4.7/ext/atomicity.h(52): error: identifier "__atomic_fetch_add" is undefined

4. To disable there "__atomic_fetch_add is undefined" compiler errors: 

You have to include commands like  

#undef _GLIBCXX_ATOMIC_BUILTINS
#undef _GLIBCXX_USE_INT128

into beginning of you .cu file or put them into a separate include file. Lets put them into 

/usr/local/cuda-5.0/include/__cuda_gcc47_fix.h

or other name you like. Now you may compile a hello world application with 
nvcc --pre-include __cuda_gcc47_fix.h command

in order to have the whole "samples" directory compile with default makefiles, lets do a little trick. 
save nvcc binary into a separate file, and create a small wrapper script with the following commands: 

cd /usr/local/cuda-5.0
mv bin/nvcc bin/nvcc.bin
echo '#!/bin/sh 
$0.bin --pre-include __cuda_gcc47_fix.h $@' > bin/nvcc 
chmod +x bin/nvcc 

After that the whole samples directory should compile without errors. (check for mpicxx to work in order to build some samples). Warnings on delegating contructors may be ignored. 

I guess the same steps may apply to other Linux distributions with gcc 4.7, like Ubuntu 12.10 and etc, that it How to make nVidia cuda sdk 5.0 to work with gcc 4.7