Random Linux

Linux, video games and web hosting

qpythonEver want to try your hand at developing applications for Android but don’t want or like java, don’t want to have to deal with the hassle of getting a c program to run on android, or simply just want to play around with the android SDK or system it self with out having to learn another language. Well you can with Qpython and SL4A you can do just that. Qpython acts as a wrapper to the standar python system and SL4A android toolkit so you can quickely write up python applications that can make use of amdroids hardware abstraction.

qpython also includes support for pygame as well as natively creating GUIs to be used in your applications. The package installs the python interpreter, an editor and a function to install additional pythong packages through pypi.

You can install pypi and pthyon through the google play store. For more information on this goto www.qpython.com

April 24th, 2014

Posted In: Uncategorized

Tags: ,

Leave a Comment

In this article I outline how to instlall Linux to your Android device using a chroot environment to mount a disk image. Installing Linux will not overwrite your existing android installation on your device and it will continue to function as it always has, the only thing different is that it will mount a virtual disk image of a Linux installation.

Prerequisites: Your Android device must be rooted ,and USB Debugging must be enabled. (Not required  but optional your kernel should support loop devices,)

For example
Use mount command as follows to mount iso file called disk1.iso:
# mount -o loop disk1.iso /mnt/disk

Now that we have verified that we can mount loop images you will need to download and execute “Deploy Linux” which you can download from the google play store.

linuxdeply Now with “Linux Deploy” installed we need to configure the installation starting with the distribution, Deploy linux has a number of distributions and version to choose from. In this article I will be using debian as my distribution and sid as my version.  Now we are going to want to select our processory type ( the default arm selection should be appropriate) , I am going to leave the mirror field blank in this case.  Next we will select the type of disk we are going to install to. For this article I am going to use a disk image based installation, although you could install to a directory or another partition if you should choose to.  If you are using a tablet or phone that has  a large amount of internal storage it would be recommended to set your installation path to your internal storage. In this articles case we do not and have opted to install to /mnt/sdcard/linux. For the disk size I have set it to 5GB so as to have extra space to perform other installs. I have left the disk type to auto you can however select ext2, ext4, etc. For desktop environment I have selected Xfce For this artical I have changed the  user name to “Debian”. And finally the last two steps we configure whether we want ssh and vnc to start when the installation is loaded. To access the desktop you will need VNC to start so keep this option enabled.

Once we have all of our configuration options set click the install button

The installation procession in Linux Deploy is completely automated.

When the installation operation is completed, you should see the following status message:

<<< end: install

Then, tap the Start button to boot the installed Linux distro. Note the IP address of the running Linux instance and launch the terminal emulator app

Figure 4: Establish an SSH connection in the terminal emulator with your username and the IP address of the Linux instance.

Establish an SSH connection to the running Linux instance using its IP address and the default android username (or the username you specified in the Propertieswindow). When prompted, enter the default changeme password.

The first thing you might want to do is change the default passwords. Issue thepasswd command to change the user password and run sudo passwd root to assign root password. Accessing the graphical desktop environment is equally easy: Launch the VNC client app and connect to the running VNC server using the default changeme password (Figures 5 and 6).

Figure 5: You can access the graphical desktop using a VNC client directly on Android …

 

April 24th, 2014

Posted In: Uncategorized

Leave a Comment

In this article I outline how to instlall Linux to your Android device using a chroot environment to mount a disk image. Installing Linux will not overwrite your existing android installation on your device and it will continue to function as it always has, the only thing different is that it will mount a virtual disk image of a Linux installation.

Prerequisites: Your Android device must be rooted and your kernel must support mounting loop block devices( most roms support this already but if you aren’t sure try mounting your image using the loop flag, if it errors your kernel doesn’t support it, if you get no error then it does support loops.), USB Debugging must be enabled.

For example
Use mount command as follows to mount iso file called disk1.iso:
# mount -o loop disk1.iso /mnt/disk

Now that we have confirmed our kernel supports loop devices we will want to download “Complete Linux Installer” from the google play store. Also make sure your device has usb debugging enabled as this is necessary. Now that we have the installer we will need a base linux image to install from. sourceforge.com/projects/linux/android/ has a number of images to choose from. For the purposes of this article I will be downloading and installing the Debian small image which will include the base of the operating sytem a few applications and a desktop. After the file is downloaded, extract the zip to a directory, if you are using a tablet or netbook with plenty of drive space it is recommended that you extract it to your system such as /mnt/local/debian. In my case I am using a netbook that has little internal storage so I will be extracting my image to /mnt/sdcard/linux/debian

Once you have the image extracted you will want to download and install vncviewer and a terminal if you do not have them installed already, they can be downloaded from the google play store.  Now that we have all of the tools we need installed execute “Complete Linux Installer” and click “launch” In the configuration you will need to add the path for your debian instllation so it will show up in the list. Once you have added the debian image click it to launch the image.

The script that is launching the image will ask you a few questions such as screen resolution,create a password, whether or not to start SSH or VNC. To access the desktop environment you will need to enable VNC. Now that every thing is setup launch the VNC viewer and configure it with the username, password (usually the user is the distribution in this case debian) and localhost for the address. If all went well you should be able to login and access the desktop.

April 24th, 2014

Posted In: Uncategorized

One Comment

We don’t usually write articles about rooting or jailbreaking phones and tablets but this particular model was hard to find any information on the system and what firmware it uses.

This method should work on most any tablet , phone or netbook using Wondermedias wm8850 processor. First what we’re going to do is identify the model of your tablet or netbook. To do this download  wonder media analyzer to your phone/tablet/netbook. Before running the analyzer make sure you have a SD card inserted and mounted. When you run the analyzer it will generate a file in the root of your SD card with all of the device configuration. What we are looking for is the model type this should be at the top of the report.

Model
wmt.model.no
PID10_8199

In this case the wm8850 netbook is model pid10_8199 with that information check to see if your model is supported (Most 8850 devices are at this point). Once you have confirmed your device is in the supported list we’rewgoing to download and run uberoid which will root your phone/tablet/netbook and install an updated firmware. Download 8850_Univeral_Uberoid and extract the Firmwareinstall directory and wmt_scriptcmd to the root of your SD card.

Now that we have the firmware we need to change a few configurations to make it update the right firmware for your device. Open the Firmwareinstall/config directory. Find the file that starts with “+” and rename it with out the “+” for example “+testfirmware.bla” to “testfirmware.bla”, afer you have changed that file locate the file with your model number and add “+” to it. In my case PID10_8199.fwc to +PID10_8199.fwc.  Open the file and make sure it has all of the appropriate entries in <cmd> that were in the model.txt file. Add any that aren’t present, sometimes you will need to add “<cmd>setenv wmt.gpo.wifi 6:1:6:0xD8110040:0xD8110080:0xD81100C0</cmd>” as it is missing in some firmwares. You may also want to edit settings_remove line to not include developer_options and tethering which will give you access to them.

Once you’ve made all the necessary changes reboot your tablet/phone/netbook, remember to keep the SD card in your system when you reboot, so it will load the firmware update. Once it has completed installing remove the SD card and it will reboot. If every thing was done correctly you should be rooted and firmware updated.

April 21st, 2014

Posted In: General

Tags:

Leave a Comment

If you’re like me and a large majority of computer/tech geeks, its not enough to have the sweetest gadget and they can’t be given the full stamp of approval unless you can install linux on it.   Over the past few years there hasve been several projects aimed at doing just that. Those projects ultimately turned into two virtual machine softwares which you can use to use a emiulate a virtual disk image which doesn’t require root , Alternativeluy several Linux “installers” have been deveoped which mounts an image deisnged for arm processors natively (This method does require root and and a kernel that supports loop )this along with several prebuilt distro disk images and you are ready to go.

The two virtual machine softares are based on qemu at their cores including support for other popular VM images. Limbo x86 emulator is the more feature rich of the two softwares allowing you to configure what processor type will be used, how much ram, howmany cpu core the list goes on, unfortunately limbo is nolonger maintained and the software was removed from source forge luckily I was able to find a copy You can download limbo from www.4shared.com/get/T0r0EUFO/limbo_pc_emulator__qemu_x86__0.html

The second of the two softwares is named :windows, linux,unix emulator” this app can be downloaded from the  google play store. which is a light weight no frills implementation of a the quem  virtual machine . You can find many pre-built disk images at the following address sourceforge.com/projects/linux/android/files The virtual machines are not limited to running linux images if you have a qemu, vmware  or boches images of a legacy windows installation you can use that too.

If you have a rooted that has loop support Android device I would recommend using one of the linux installers that can be found in the google play store. Instead of emulating a virtual machine it will basically run the linux image natively and then you would use a vnc applicatioon to connect to the xserver instance. Complete linux installer is free to use but does have more options if you purchase a key by donating.

April 19th, 2014

Posted In: Uncategorized

Tags:

Leave a Comment

If you’re going to write a series of articles on GUI design and implementation you might as well start from the beginning with Tkinter/TK pythons defacto GUI framework. Almost since the beginning the developers of python knew there woud be a need for a GUI frame work so they adapted tcl/tk for use with python by including a tcl interpreter into python. While it is functionhal and effective it did have a few draw backs being that it wasn’t very robust, included the most basic of widgets, didn’t look very good (think back to the early days of any X11 window manager and how unappealing their dialogs looked, and could be slow running.

In recent years a lot of Tkinter has been rewritten to be faster , include more widgets and support better theming so the dialogs will look less out of place on windows, linux and mac. The benfit of using tkinter is that it is almost always installed by default with python so usability from system to system is almost guaranteed even if you forgot to build your application package to include it’s module. While it is still a little underfeatured if all you need are some simple dialogs the the basic controls you would expect from the average dialog driven application Tkinter is still quite effectice and easy to implement without much experience, allowing you to create and use dialogs in your applications very quickly and effortlessly.

This article does not aim to be a complete reference to using Tkinter but only to show a few basic examples, basic features and provide links to other tutorials and reference materials. Tkinter provides the following widgets several of which are updated and overridden through TTK.

Button The Button widget is used to display buttons in your application.

CanvasThe Canvas widget is used to draw shapes, such as lines, ovals, polygons and rectangles, in your application.

CheckbuttonThe Checkbutton widget is used to display a number of options as checkboxes. The user can select multiple options at a time.

EntryThe Entry widget is used to display a single-line text field for accepting values from a user.

FrameThe Frame widget is used as a container widget to organize other widgets.

LabelThe Label widget is used to provide a single-line caption for other widgets. It can also contain images.

ListboxThe Listbox widget is used to provide a list of options to a user.

MenubuttonThe Menubutton widget is used to display menus in your application.

MenuThe Menu widget is used to provide various commands to a user. These commands are contained inside Menubutton.

MessageThe Message widget is used to display multiline text fields for accepting values from a user.

RadiobuttonThe Radiobutton widget is used to display a number of options as radio buttons. The user can select only one option at a time.

ScaleThe Scale widget is used to provide a slider widget.ScrollbarThe Scrollbar widget is used to add scrolling capability to various widgets, such as list boxes.

TextThe Text widget is used to display text in multiple lines.

ToplevelThe Toplevel widget is used to provide a separate window container.

SpinboxThe Spinbox widget is a variant of the standard Tkinter Entry widget, which can be used to select from a fixed number of values.

PanedWindowA PanedWindow is a container widget that may contain any number of panes, arranged horizontally or vertically.

LabelFrameA labelframe is a simple container widget. Its primary purpose is to act as a spacer or container for complex window layouts.

tkMessageBoxThis module is used to display message boxes in your applications.

The following are expanded widgets in TTK.

ttk.Button

ttk.Checkbutton

ttk.Combobox

ttk.Entry

ttk.Frame

ttk.Label

ttk.LabelFrame

ttk.Menubutton

ttk.Notebook

ttk.PanedWindow

ttk.Progressbar

ttk.Radiobutton

ttk.Scale

ttk.Scrollbar

ttk.Separator

ttk.Sizegrip

ttk.Treeview

It starts with Hello.

As with every programming or scripting tutorial we are going to create a hello world program. In this case we are going to create a simple window with a button that when clicked will cause a popup dialog

import Tkinter
import tkMessageBox

root = Tkinter.Tk()

def OnButtonClick():

tkMessageBox.showinfo( “Hello Python”, “Hello World”)

button = Tkinter.Button(root, text =”Click Me!”, command = OnButtonClick)

button.pack()

root.mainloop()

It’s that simple to create a dialog box, tkinter was designed to be simple and easy to use, the following example will demonstrate taking input through a text box and changing the text in a label when a button is clicked

 

#!/usr/bin/python

# -*- coding: iso-8859-1 -*-

import Tkinter

class simpleapp_tk(Tkinter.Tk):
    def __init__(self,parent):
        Tkinter.Tk.__init__(self,parent)
        self.parent = parent
        self.initialize()

    def initialize(self):
        self.grid()

        self.entryVariable = Tkinter.StringVar()
        self.entry = Tkinter.Entry(self,textvariable=self.entryVariable)
        self.entry.grid(column=0,row=0,sticky=’EW’)
        self.entry.bind(“<Return>”, self.OnPressEnter)
        self.entryVariable.set(u”Enter text here.”)

        button = Tkinter.Button(self,text=u”Click me !”,
                                command=self.OnButtonClick)
        button.grid(column=1,row=0)

        self.labelVariable = Tkinter.StringVar()
        label = Tkinter.Label(self,textvariable=self.labelVariable,
                              anchor=”w”,fg=”white”,bg=”blue”)
        label.grid(column=0,row=1,columnspan=2,sticky=’EW’)
        self.labelVariable.set(u”Hello !”)

        self.grid_columnconfigure(0,weight=1)
        self.resizable(True,False)
        self.update()
        self.geometry(self.geometry())       
        self.entry.focus_set()
        self.entry.selection_range(0, Tkinter.END)

    def OnButtonClick(self):
        self.labelVariable.set( self.entryVariable.get()+” (You clicked the button)” )
        self.entry.focus_set()
        self.entry.selection_range(0, Tkinter.END)

    def OnPressEnter(self,event):
        self.labelVariable.set( self.entryVariable.get()+” (You pressed ENTER)” )
        self.entry.focus_set()
        self.entry.selection_range(0, Tkinter.END)

if __name__ == “__main__”:
    app = simpleapp_tk(None)
    app.title(‘my application’)
    app.mainloop()

handling events and creating key bindings is east and quick in the code samoke below we create a windo window and we create a binding to button 1 on your mouse./

 

from Tkinter import *
root = Tk()
def callback(event):    print “clicked at”, event.x, event.y
frame = Frame(root, width=100, height=100)
frame.bind(“<Button-1>”, callback)

frame.pack()

root.mainloop()

 

You can find more information on Tkinter at the following sites.

An non-official  manual and reference for tkinter, very complete in providing information on all of tkinters features,

http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/index.html

Tkinter examples and tutorials can be found at
http://www.openbookproject.net/py4fun/gui/tkPhone.html

http://www.tkdocs.com/tutorial/firstexample.html

 

A great book on tkinter can be found at
http://www.asiaa.sinica.edu.tw/~ctli/python-and-tkinter-programming.pdf

This book goes into great detail on explaining all of the features of tkinter.

April 19th, 2014

Posted In: Uncategorized

Tags: , , ,

Leave a Comment

In this series of articles  I will be writing articles aimed at explaining how to build/design GUIs for your python projects using Tkinter, wxPython/wxWidgets, PyQT, PyGTK, amongst others. The goal is to provide information and examples from building simple GUIs to more advanced methods and more complex GUI applications.As well as demonstrating the use of several different applications used to build these GUIs. Each series of articles will tackle more complex GUI design methods and various editor softwares.

The reason for writing articles on several GUI frameworks is to allow you to try each of them out and find out which of them you may like more and to give a jumping off point for people who intend to write their programs for a specific framework or OS.

 

April 17th, 2014

Posted In: Uncategorized

Tags: , ,

Leave a Comment

This article aims to be a more updated and clear instructional on how to install the Easycap video capture device in Ubuntu and it’s variants . Given the price of these capture devices and there relatively good video quality they are fairly popular devices, at an average cost of $10-$15 how can you not pick one up to at least check it out. Until not to recently there wasn’t a great deal of support for the devices and what support and drivers there were weren’t always the greatest for all of the Easycap versions and hardware.

The old driver had bad video quality and compatibility for all hardware types is pretty low and finicky. Additionally you had to use their capture software piped through Mplayer to capture video unless you installed the slightly more finicky kernel patch. And that is what I will be guiding you through now is installing the current stable kernel module you will need to properly install and use your Easycap device in ubuntu.

Description

Linux kernel module driver for the Somagic Easycap capture device.

  • EasyCAP Model DC60, with CVBS, S-VIDEO, AUDIO(L), and AUDIO(R) inputs. The uninitialized device shows in lsusb as “1c88:0007 Somagic, Inc.”. Once initialized, it shows as “1c88:003c Somagic, Inc”.
  • EzCAP USB 2.0, with unlabeled CVBS, S-VIDEO, AUDIO(L), and AUDIO(R) inputs. The device is initialized automatically and shows in lsusb as “1c88:003d Somagic, Inc”.
  • EasyCAP Model 002 (or EasyCAP002), with 1, 2, 3, 4, and unlabeled microphone inputs. The uninitialized device shows in lsusb as “1c88:0007 Somagic, Inc.”. Once initialized, it shows as either “1c88:003e Somagic, Inc” or “1c88:003f Somagic, Inc”.

Identification

Indentify the device before buying

It is hard to identify the chipset of any EasyCAP device before buying because most onlineshops (ebay, amazon) do not mention in the provided technical data the chipset of the device. Example from logilik.de where the chipset is declared

Identify device using installation instructions for Windows
Windows-installer.png

If the chipset is not mentioned in device specifications on the website, one way to figure out the chipset inside the EaysCAP is to read through the installation instructions for Windows (if provided for download).

Screenshots of the windowsinstaller often reveal the devicename.

  • STK1160 EasyCAP is in Windows: (Syntek) STK1160 or STK1150
  • Empia EasyCAP is in Windows: USB 2861 Device or EMP
  • Somagic EasyCAP is in Windows: SM-USB 007 or SMI Grabber Device
  • UTV007 based EasyCAP is in Windows: USBTV007e

Known Easycap devices

 STK1160 EasyCAP

For the stk1160 based EasyCAPs exists another article on this wiki with further information.

It is assumed that the stk1160 based “EasyCAP DC60” ist the “originally” EasyCAP device. This device is sold in different varieties (models) and even under different names like: EzCap, LogiLink, Mumbi, Weltbild, and some more.

Components Used

  • Syntek STK1160 (USB video bridge)
  • Silan SC8113 or GM7113 (Philips SAA7113 compatible video decoder)
  • AC’97 audio processor (In the 4 inputs model this chip is missing. Audio capturing is done by the STK1160 chips built-in ADC for mono microphone audio recording.)

Indentification

# lsusb
Bus 001 Device 003: ID 05e1:0408 Syntek Semiconductor Co., Ltd STK1160 Video Capture Device

Making it work

STK1160 based devices are supported (video and audio) under Linux by the easycap kernel module (kernel 2.6.38 and later) and further on by the stk1160 kernel module (kernel 3.7). More information on this wiki: Stk1160

Audio support

More information on this wiki: Stk1160#Drivers

 


Empia EasyCAP

The Empia EasyCAP is based on the EM2860 chip from Empia.

Components Used

  • Empia EM2860 (EM2861 ?) (USB video bridge)
  • Silan SC8113 (Philips SAA7113 compatible video decoder)
  • AC’97 audio processor

Indentification

# lsusb
Bus XXX Device XXX: ID eb1a:2861 eMPIA Technology, Inc.

Making it work

EM2860 (EM2861) based devices are supported in Linux by the em28xx kernle module. More information on this wiki: Em28xx_devices

Audio support

The em28xx kernel module should create a Em28xx Audio ALSA soundcard which can be used for sound capturing.

 


 Somagic EasyCAP

The Somagic EasyCAP is based on the SMI-2021 chip from Somagic. It needs a firmware for operation.

Components Used

  • Somagic SMI-2021CBE (USB video bridge)
  • SAA7113 compatible video decoder
  • Cirrus Logic 5340-CZZ audio processor

Indentification

# lsusb
Bus XXX Device XXX: ID 1c88:0007 Somagic, Inc. 
and after loading the firmware
# lsusb
Bus XXX Device XXX: ID 1c88:003c Somagic, Inc. or Bus XXX Device XXX: ID 1c88:003f Somagic, Inc.

Making it work

For SMI-2021 based devices exists a proceeding Linux-driver project: easycap-somagic-linux which this tutorial explains the installation process for Ubuntu. Continue to the installation portion of this instructional

More information on this wiki: Somagic

Audio support

Audio support is provided by the easycap-somagic-linux driver at an unknown stage.


USBTV007 EasyCAP

This EasyCAP is based on a single UTV007 labeled chip.

This device is sold as “USB video capture QS702” from SHENZHEN FUSHICAI ELECTRONIC CO.,LTD

lsusb reports

  • Manufacturer: Fushicai
  • Product: usbtv007

 Components Used

  • Single chip: UTV007 A614231.1 1136L1BK
  • Inscriptions on the board: FSC VIDEO DVR

Indentification

# lsusb Bus XXX Device XXX: ID 1b71:3002

Full lsusb -v

Making it work

Linux kernel driver, enable CONFIG_VIDEO_USBTV: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/media/usb/usbtv

  • From 3.11 (“Linux for Workgroups”) on: Supports NTSC, Composite input
  • From 3.12 : S-Video input, Fixed deinterlacing, Throw corrupted frames away
  • From 3.13 (rc5) : PAL support
  • In works: Controls (brightness, …)

Also, a very experimental (for testing purposes only) userspace driver is available on github: http://github.com/memeruiz/usbtv007

  • Currently doesn’t do anything beyond what kernel driver does
  • Written using Python libusb1 and v4l bindings
  • Requires v4l loopback
  • Could be useful for easy protocol testing, prototypin
Audio support

A work in progress on the audio support can be found at: https://github.com/simon3z/usbtv

Status: tested and working for composite input (48Khz 2ch 16bit).

Work needed

  • Testing and fixing of eventual bugs is very welcome!
  • Audio is currently not supported on the last Linux kernel. Audio is working with the Windows driver (tested on Windows 2000 with the XP driver not on a virtualized computer with a playstation PSX for the video and audio inputs with the software “honestech HD DVR 2.5”).

The Windows driver shipped with the device was for another model. Here’s the correct one: http://v3.sk/~lkundrak/usbtv/usbtv-wxp32.zip

Slides from talk describing setup for reverse-engineering what does the hardware do are available: http://www.slideshare.net/LubomirRintel/usb-reversing

List of known Easycap capture devices  Identify your USB device from this list and continue to the kernel module only installation

 


Somagic-Easycap Installation

Prerequisites

All developement and testing of this driver has been done on a computer running Xubuntu 13.10 but should be no different for any other Ubuntu distribution or version provided you are using Kernel 3.11 or newer. If you are running another distribution, you’ll should visit http://code.google.com/p/easycap-somagic-linux/wiki/BuildingKernelModule and read their installation instructions as they apply to a generic linux in general.

You will of course also need:

  • Kernel 3.11.x
  • Kernel source and headers
  • git
  • gcc/make and friends
  • wget
  • wine
  • mplayer (for testing the device)
  • vcl
  • available hard-disk space for the kernel tree source and headers
  • The firmware for your EasyCap device installed in /lib/firmware
  • Somagic variant of the EasyCAP. To determine that: plug in the EasyCAP, run “lsusb“, and verify “1c88:0007 Somagic, Inc” or “1c88:003f Somagic, Inc“.
  • EasyCAP USB 2.0 Video Adapter with Audio or EasyCAP002 4-Channel USB 2.0 DVR installation CD-ROM.

Somagic-Easycap Getting started

Firstly we will need  to update our packages and download and install the following dependencies

sudo apt-get update

Were first going to download the current kernel header source code.

All of the Ubuntu Kernel source is maintained under git. The source for each release is maintained in its own git repository on kernel.ubuntu.com. To obtain a local copy you can simply git clone the repository for the release you are interested in as shown below.

  • git clone git://kernel.ubuntu.com/ubuntu/ubuntu-<release>.git

For example to obtain the precise tree:

git clone git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git kernel-source
change into the kernel source directory and use the following command to update the drivers for the kernel
git remote add linuxtv git://linuxtv.org/media_tree.git
git remote update    
git checkout -b media-master remotes/linuxtv/master

This will download the whole kernel, and also the media-tree into a directory called “kernel-source” under your current directory.

All commands from here on should be typed while you are in the linux source-tree unless specified otherwise.

If you are already tracking Linus’ kernel-tree, or are using your distribution’s current kernel-tree, you don’t have to download the media-tree, but then you will need up to six additional patches to build the module (These patches should not be necessary after kernel version 3.12)

To determine your kernel version run “uname -r” this should return something like “3.14.0-rc1-custom”

Here we’re going to install the needed dependencies. (The following is meant to be entered as one line)

sudo apt-get install libncurses5-dev fakeroot wget bzip2 libusb-1.0-0 libusb-1.0-0-dev libgcrypt11 libgcrypt11-dev mplayer usbutils libgcrypt11 wine make gcc mplayer git build-essential

sudo apt-get build-dep linux-image-$(uname -r)

Then you will need to download either somagic-easycap-tools_1.1_i386.deb  or somagic-easycap-tools_1.1_amd64.deb and  somagic-easycap_1.1_i386.deb  or somagic-easycap_1.1_amd64.deb  depending on your architecture from the original drivers site because we will need the firmware extractor for the Somagic-EasyCap hardware to work.

Extracting firmware

  1. Please do not ask for or provide links to the copyrighted firmware. If you don’t have your driver CD, you might be able to find the firmware online via a web search.
  2. Using wine, run “Drivers/Setup.exe” (or sometimes “Driver/Setup.exe”), on the EasyCAP installation CD. For the EasyCAP DC60, this should create a file named “Program Files/Common Files/Somagic/SmiUsbGrabber3C/xp/SmiUsbGrabber3C.sys”. For EasyCAP002 this should create a file named either “Program Files/Common Files/Somagic/SmiUsbGrabber3E/xp/SmiUsbGrabber3E.sys” or “Program Files/Common Files/Somagic/SmiUsbGrabber3F/xp/SmiUsbGrabber3F.sys”.
  3. Run “
  4. Run as root “somagic-extract-firmware SmiUsbGrabber.sys”, to create “/lib/firmware/somagic_firmware.bin”.
  5. Depending on whether the installation created SmiUsbGrabber3C.sys or SmiUsbGrabber3D.sysSmiUsbGrabber3E.sys or SmiUsbGrabber3f.sys you will copy /lib/firmware/somagic_firmware.bin to /lib/firmware/smi2021_3f.bin

Testing The EasyCap Device

This test is to ensure the device is functioning properly before continuing to install the kernel module.

  1. Plug in the EasyCAP device.
  2. Run “somagic-init” to initialize the EasyCAP device, which changes its USB id. This step is not necessary for the EzCAP USB 2.0, which is automatically initialized. If there is no output, initialization was successful. However, to manually verify whether initialization was successful, re-run “somagic-init” or check “lsusb” for the new id “1c88:003c Somagic, Inc” (EasyCAP DC60), “1c88:003e Somagic, Inc” (EasyCAP002), or “1c88:003f Somagic, Inc” (EasyCAP002). You can also run “somagic-capture --test-only” and check for a return code of 0 with “echo $?“.
  3. For EzCAP USB 2.0 only, run “modprobe -r usbhid“.
  4. Activate your video source and ensure video is connected, either via CVBS/composite (any device), or S-VIDEO (EasyCAP DC60 or EzCAP USB 2.0). For the EasyCAP002 the correct plug may vary. First try “2”, then “3”.
  5. Choose and run a usage example depending on your input type
    Play PAL video from CVBS/composite input
    somagic-capture | mplayer -vf yadif,screenshot -demuxer rawvideo -rawvideo “pal:format=uyvy:fps=25” -aspect 4:3 –
    Play NTSC video from S-VIDEO input
    somagic-capture -n | mplayer -vf yadif,screenshot -demuxer rawvideo -rawvideo “ntsc:format=uyvy:fps=30000/1001” -aspect 4:3 –


    Installing Somagic Easycap Kernel Module Only

    Add supporting modules

    The smi2021 driver is depending on the saa7115 module.  Some changes had to be made to that module to make the driver work. We will have to download and install 3 or 6 more patches before we can build the kernel Module.

    From here we will change to our kernel headers directory to download the updated saa7115 module and patches

    cd /usr/src/linux-headers-$(uname -r)    (or where ever you have downloaded your kernels headers and source)

    Download the patch with the smi2021 driver module

    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/20010/mbox/ -O smi2021v3.patch

    git checkout -b smi2021v3
    git am smi2021v3.patch

    If your kernel-tree is older than 3.11, you will first need these three patches.

    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/18233/mbox/ -O saa7115-0001.patch
    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/18232/mbox/ -O saa7115-0002.patch
    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/18368/mbox/ -O saa7115-0003.patch

    If your kernel-tree is older than 3.12 – and you didn’t download the media-master tree – you will need these three patches.

    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/19535/mbox/ -O saa7115-0004.patch
    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/19536/mbox/ -O saa7115-0005.patch
    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/19537/mbox/ -O saa7115-0006.patch

  6. When you have downloaded the needed patches we need to apply them. This will count the patch files in the saa7115 patch files and apply them all.
  7. git am saa7115-000*

    Compile smi2021 module only

    This is how you just compile the module, without having to compile the whole kernel. If your kernel is older than 3.11 continue to the “Compiling Kernel” section.

    This will only work if the kernel source-tree is the same version as the kernel you are currently running

    First you will need to patch your kernel tree with the smi2021v3.patch, and the three or six saa7115 patches as described above.

    Then you will have to build both the saa7115 module and the smi2021 module. These commands are typed when you are in the root of the kernel-source tree.

    make M=drivers/media/i2c modules
    make M=drivers/media/usb/smi2021 modules

    Then we install the modules.

    sudo /sbin/insmod drivers/media/i2c/saa7115.ko
    sudo /sbin/insmod drivers/media/usb/smi2021/smi2021.ko

    If you get errors about missing symbols when trying to insmod the saa7115 module, this is probably because the saa7115 module needs some other modules that aren’t loaded yet. We can force them to be loaded if do this before the insmod saa7115 command:

    sudo /sbin/modprobe saa7115
    sudo /sbin/rmmod saa7115

    You should now be able to insert your EasyCap, and you will see this line in your kernel log:

    smi2021 2-1.1:1.0: Somagic Easy-Cap Video Grabber

Compiling A New Kernel And Modules

change directory to the root of where your kernel headers are located

First, we copy the configuration of your current kernel.

sudo cp /boot/.config$(name -r)* > .config

Then we check that we can compile the smi2021 module

Modifying the configuration

This step can be skipped if no configuration changes are wanted. The build process will use a configuration that is put together from various sub-config files. The simplest way to modify anything here is to run:

chmod a+x debian/scripts/*
chmod a+x debian/scripts/misc/*
fakeroot debian/rules clean fakeroot debian/rules editconfigs

This takes the current configuration for each architecture/flavour supported and calls menuconfig for that. The chmod is needed because the way the source package is created loses the executable bits on the scripts.
Device drivers --->
Multimedia support --->
Media USB Adapters --->

Find the entry called “Somagic SMI2021 USB video/audio capture support“. Check that it’s marked with <M>, if not, press m to mark it as a module or y to compile it into the kernel.

Check the config for other options you would like, exit and save the config.

Building the kernel

Building the kernel is quite easy. Change your working directory to the root of the kernel source tree and then type the following commands:

  • fakeroot debian/rules clean
    fakeroot debian/rules binary-headers binary-generic

 

Now, just wait, and hope you’ve done everything correct (and that I didn’t forget anything).

If the build is successful, a set of three .deb binary package files will be produced in the directory above the build root directory. For example after building a kernel with version “2.6.38-7.37” on an amd64 system, these three .deb packages would be produced:

cd ..
ls *.deb
    linux-headers-2.6.38-7_2.6.38-7.37_all.deb
    linux-headers-2.6.38-7-generic_2.6.38-7.37_amd64.deb
    linux-image-2.6.38-7-generic_2.6.38-7.37_amd64.deb

When the compile ends, and there are no errors, we install the modules.

sudo make modules_install

This should complete in a few minutes, and then we are ready to install the kernel.

Install all packages that were created except the tools-generic package as this sometimes doesn’t have the dependency to properly install. Once that is done you can restart your computer and when it loads up you should see another video device in /dev likely video1

Testing the driver

Insert your device, and type this:

vlc v4l2:///dev/videoX :v4l2-standard= :input-slave=alsa://plughw:X,0

In /dev/videoX, the X is the number of the device, on my computer it’s 1, because my web_cam is 0, but it might be any number.

You can get a list of video devices by typing

ls /dev/video*

You can figure out the value of plughw:X,X by typing:

arecord -l

This should give you a list like this:

**** List of CAPTURE Hardware Devices ****
card 0: MID [HDA Intel MID], device 0: 92HD73C1X5 Analog [92HD73C1X5 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: MID [HDA Intel MID], device 2: 92HD73C1X5 Alt Analog [92HD73C1X5 Alt Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: smi2021Audio [smi2021 Audio], device 0: smi2021 Audio [Somagic smi2021 Capture]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Where you see that card2 is smi2021Audio, so the audio-device is plughw:2,0.

March 7th, 2014

Posted In: Uncategorized

Tags: ,

4 Comments

The quick launch bar so familiar to pretty much every operating system and window manager these days, is a valuable asset, simplifying the need to navigate through several menus to start up any application you use regularly. XFCE is no different. XFCE has a quick way to add applications to your launch bar but when you look through the list of applications it provides it is far from complete and in many cases may not contain the application you want to add. No worries  This article will show you step by step how to add a “custom” program launcher to your bar.

Add launch bar menu

Add launch bar menu

First we’re going to right-click a space on the launch bar at the top or bottom of the screen as this can be done to the popup launcher as well, and were going to select “Panel” -> “Add New Items…:  This will bring up an item list of objects you can add. From this list select “Launcher” and click the “Add” button and then click “Close”. You should now see a screen icon in the right side of your launcher bar. Now, right-click this icon and select “Properties.”  When the dialog open there are going to be some icons to the right that allow you to manage your launcher items as each launcher can have several sub application items. Select the “+” which will bring up another Dialog with a list of applications for you to add. If you can’t find the application you want to add close this window and click the icon below the “+” and you can create a custom launcher item,

 

 

Adding the launcher item

Adding the launcher item

This part is pretty straight forward. You will give it a name for the launcher to have, in my case I’m adding “Gui2Py”, add comment if any “This is a GUI editor for Python”,add the full path to the command you would like to run in my case it’s “python -m gui.tools.designer”,the working directory is going to be the directory it loads by default using your home directory by either using “~” or “$home” should work as a default. Otherwise provide the full path, you can then set a custom icon either from their list or one you provide, when startup notification is set, the panel and cursor notifies the user that the application has started. When the application appears onscreen, the panel and cursor return to normal. This enables the desktop to use whatever startup notification is built in to either your applicationMost modern toolkits work transparently with the startup notification system.  And finally “Run In Termial” will launch a terminal window and then execute the program, This is particularly useful if the program has verbose output in addition to a GUI. With all of that done all you gotta do is click create and your done. Remember this can also be one for the lower popup launcher as well.

To move the launcher icon elsewhere in the “Quick Launch Bar” simply right-click and select “Move” then move your cursor where you would like it and left-click and it will be placed where your cursor is.

 

February 27th, 2014

Posted In: Ubuntu, Uncategorized

Tags: , , ,

Leave a Comment

Sometimes after installing XFCE/Xubuntu along side Ubuntu LightDM the configuration for your present and active sound devices will get overwritten or removed. The first thing you should do is go to “Application Menu -> Multimedia -> Pulse Volume Control” Click the “Configuration” tab and check what audio devices it is listing. If it doesn’t display any skip to the section titled “Update”.

 

Check:

Configuration

Configuration

Output Devices

Output Devices

 

If it shows your sound devices click the “Output Devices” tab and make sure the sound device which should be outputting sound is not muted and that it has “Speakers” or “Headphones” in the “port” dropdown box which ever the case may be. Your sound should be functional now

 

Update:

If the “Configuration” tab doesn’t show any of your audio devices run the following commands from a terminal window.

killall pulseaudio; rm -r ~/.config/pulse/* ; rm -r ~/.pulse*
If it says it couldn't remove the files in question it means pulse never created them when it was loaded. 

Now run the following commands from terminal, once they have completed reboot your computer, once you are back in XFCE open “Pulse Volume Control” and  follow the directions from the section titled Check.

sudo add-apt-repository ppa:ubuntu-audio-dev/ppa; sudo apt-get update;sudo apt-get dist-upgrade; sudo apt-get install pavucontrol linux-sound-base alsa-base alsa-utils lightdm ubuntu-desktop  linux-image-`uname -r` libasound2; sudo apt-get -y –reinstall install linux-sound-base alsa-base alsa-utils lightdm ubuntu-desktop  linux-image-`uname -r` libasound2; killall pulseaudio; rm -r ~/.pulse*; ubuntu-support-status; sudo usermod -aG `cat /etc/group | grep -e ‘^pulse:’ -e ‘^audio:’ -e ‘^pulse-access:’ -e ‘^pulse-rt:’ -e ‘^video:’ | awk -F: ‘{print $1}’ | tr ‘\n’ ‘,’ | sed ‘s:,$::g’` `whoami`

 

October 28th, 2013

Posted In: General, How To

Tags: , , , , , , , , , , , , , , ,

Leave a Comment

« Previous PageNext Page »