Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Howto create a ebuild for a sq905 camcorder (alias sqcam)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Jimmy Jazz
Apprentice
Apprentice


Joined: 04 Oct 2004
Posts: 293
Location: Strasbourg

PostPosted: Sat Jan 14, 2006 1:56 pm    Post subject: Howto create a ebuild for a sq905 camcorder (alias sqcam) Reply with quote

Hello,

The post was initially written on the "unsupported software" forum. I will certainly delete it because this place looks more appropriate :)

i had managed to get an Argus DC-15 module working with a 2.6.12 kernel sometimes ago but know with the new kernel some part of the source need to be changed.

So here is the new ebuild. It was tested on a i386 computer family.

First, i'm not sure about how to make a clean ebuild but this one works for my needs :?

Many thanks to Marcell Lengyel and David Findlay the actual sq905 maintainer. You can read more on http://sqcam.sourceforge.net website

According the website, it works with a:
* Mito DG640E
* Mitek CD10
* Mitek 30P
* GTW Electronics/ ShuoYing Industrial(ShenZhen)Co.,Ltd SY-2102
* Condord Eye-Q Easy / Eye Q Easy Too
* Che-ez Snap
* Hercules DualPix
* Argus DC-1512
* Argus DC-1510
* Gear to go
* Magpix B350
* Jenoptik JD 350
* Concord Eye-Q Easy
* PockCam

and with a Waitec Caddy (openwengo)


For a while, i was offered a noname Che-ez clone digital camera. So i made myself on the seek for a driver compatible with the last linux kernel 2.6. The "camcorder" is a member of the sqcam family. You will find the source on the http://sourceforge.net/projects/sqcam/ website.

http://prdownloads.sourceforge.net/sqcam/sqcam_driver_for_kernel_2_6-0.1b.tar.gz

Copy it in your distfile directory.

My ebuild looks like this:

Code:


# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit kernel-mod eutils multilib linux-info linux-mod toolchain-funcs

DESCRIPTION="Linux Kernel Driver for a USB webcam based on the SQ 905 chipset
like Che-ez! Snap/iClick"
HOMEPAGE="http://sourceforge.net/projects/sqcam/"
SRC_URI="http://prdownloads.sourceforge.net/sqcam/sqcam_driver_for_kernel_2_6-${PV}b.tar.gz"
LICENSE="GPL"
SLOT="0"
KEYWORDS="~x86 ~ppc64 ~amd64"
IUSE=""

DEPEND="sys-kernel/linux-headers"
RDEPEND=""

S=${WORKDIR}/sqcam_driver_for_kernel_2_6

src_unpack() {
    unpack ${A}
    cd "${S}"
}
src_compile() {
    # fix for kernel 2.6.11 and over
    epatch ${FILESDIR}/sqcam-${PV}b-2.6.12.patch
    export ARCH="$(tc-arch-kernel)"
    emake KSRC="${KERNEL_DIR}" || die "make failed"
#    emake ARCH=i386 || die "make failed"

}

src_install() {

    if kernel_is 2 6; then
        einfo "Kernel ${KV_FULL} detected!"
        insinto "/lib/modules/${KV_FULL}/kernel/drivers/usb/media/"
        doins sqcam.ko
        echo "post-install sqcam /sbin/modprobe --force sqcam >& /dev/null 2>&1 || :" > usb-sqcam
    else
        eerror "No supported kernel version (2.6) detected."
    fi

    insinto /etc/modules.d

}

pkg_postinst() {
    if [ "${ROOT}" = "/" ]
    then
        # Update module dependency
        [ -x /usr/sbin/update-modules ] && /usr/sbin/update-modules
        depmod -a
    fi
    einfo "If you have problems loading the module, please check the \"dmesg\" output."
}



If i'm not mistaken, i was using the usb-pwc-re ebuild core file to make this one...
Now we need to apply a little patch to make it work with a 2.6.12+ kernel. Currently, i'm using a 2.6.14 kernel and the driver compiled well with it.

Let's name it sqcam-0.1b-2.6.12.patch

Code:

Index: sq905.c
===================================================================
--- sq905.c.old 2004-03-17 03:12:38.000000000 +0100
+++ sq905.c     2005-12-18 20:56:43.000000000 +0100
@@ -813,7 +813,7 @@
        pos = (unsigned long) (cam->framebuf);
        while (size > 0) {
                page = usbvideo_kvirt_to_pa(pos);
-               if (remap_page_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) {
+               if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, PAGE_SIZE, PAGE_SHARED)) {
                        up(&cam->busy_lock);
                        return -EAGAIN;
                }


Be award, there is a ^I (TAB) after the name of the file you want to apply the patch in both lines beginning with --- or +++, otherwise epatch will certainly complain.

You will find more information on the OpenWengo page http://dev.openwengo.com/trac/openwengo/trac.cgi/wiki/SqCam

Have a look there :)

Add the files in your $PORTDIR_OVERLAY directory,

Code:

cd $PORTDIR_OVERLAY
mkdir -p media-video/sqcam/files
cp sqcam-0.1-r1.ebuild media-video/sqcam
cp sqcam-0.1b-2.6.12.patch media-video/sqcam/files



You still need a digest file for the package

Code:

cd $PORTDIR_OVERLAY/media-video/sqcam
ebuild sqcam-0.1-r1.ebuild digest


Your ebuild is now ready to be used.

You can check it with gnomemeeting, openWengo or gphoto2 (as i know gphoto uses its own driver, but that doesn't harm anything, does it? ) or was ever will use the driver. The video quality is not what we can attempt from a more modern camcorder, but that's fun :) And no one hold you to tweak the driver...

Remember, if the driver get loaded twice at boot time, just comment out the line:
Code:

echo "post-install sqcam /sbin/modprobe --force sqcam >& /dev/null 2>&1 || :" > usb-sqcam


Jj
_________________
« La seule condition au triomphe du mal, c'est l'inaction des gens de bien » E.Burke
Code:

+----+----+----+
|    |::::|    |
|    |::::|    |
+----+----+----+

motto: WeLCRO
WritE Less Code, Repeat Often
Back to top
View user's profile Send private message
nivw
Apprentice
Apprentice


Joined: 09 Nov 2005
Posts: 261

PostPosted: Fri Feb 10, 2006 11:49 pm    Post subject: Reply with quote

posted to bugzilla
hope it works for my creative ultra live
https://bugs.gentoo.org/show_bug.cgi?id=122419
Back to top
View user's profile Send private message
nivw
Apprentice
Apprentice


Joined: 09 Nov 2005
Posts: 261

PostPosted: Sat Feb 11, 2006 12:16 am    Post subject: Reply with quote

***** sqcam-0.1b-2.6.12.patch *****

===================================

PATCH COMMAND: patch -p0 -g0 --no-backup-if-mismatch < /usr/local/portage/medi$

===================================
patching file sq905.c
Hunk #1 FAILED at 813.
1 out of 1 hunk FAILED -- saving rejects to file sq905.c.rej
===================================

PATCH COMMAND: patch -p1 -g0 --no-backup-if-mismatch < /usr/local/portage/medi$

===================================
missing header for unified diff at line 5 of patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: sq905.c
|===================================================================
|--- sq905.c.old 2004-03-17 03:12:38.000000000 +0100
|+++ sq905.c 2005-12-18 20:56:43.000000000 +0100
--------------------------
No file to patch. Skipping patch.
1 out of 1 hunk ignored
===================================

PATCH COMMAND: patch -p2 -g0 --no-backup-if-mismatch < /usr/local/portage/medi$

===================================
missing header for unified diff at line 5 of patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: sq905.c
|===================================================================
|--- sq905.c.old 2004-03-17 03:12:38.000000000 +0100
|+++ sq905.c 2005-12-18 20:56:43.000000000 +0100
--------------------------
No file to patch. Skipping patch.
1 out of 1 hunk ignored
===================================
Back to top
View user's profile Send private message
nivw
Apprentice
Apprentice


Joined: 09 Nov 2005
Posts: 261

PostPosted: Sat Feb 11, 2006 2:57 am    Post subject: Reply with quote

fine,
patched it by hand, loaded fine,
how to I create a /dev/v4l/video2 ?
how to tell linux to use the creative webcam with the sqcam module?

Niv
Back to top
View user's profile Send private message
Jimmy Jazz
Apprentice
Apprentice


Joined: 04 Oct 2004
Posts: 293
Location: Strasbourg

PostPosted: Sun Feb 12, 2006 9:24 am    Post subject: Reply with quote

nivw wrote:
***** sqcam-0.1b-2.6.12.patch *****

===================================

PATCH COMMAND: patch -p0 -g0 --no-backup-if-mismatch < /usr/local/portage/medi$

===================================
patching file sq905.c
Hunk #1 FAILED at 813.
1 out of 1 hunk FAILED -- saving rejects to file sq905.c.rej
===================================

PATCH COMMAND: patch -p1 -g0 --no-backup-if-mismatch < /usr/local/portage/medi$

===================================
missing header for unified diff at line 5 of patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: sq905.c
|===================================================================
|--- sq905.c.old 2004-03-17 03:12:38.000000000 +0100
|+++ sq905.c 2005-12-18 20:56:43.000000000 +0100
--------------------------
No file to patch. Skipping patch.
1 out of 1 hunk ignored
===================================

PATCH COMMAND: patch -p2 -g0 --no-backup-if-mismatch < /usr/local/portage/medi$

===================================
missing header for unified diff at line 5 of patch
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: sq905.c
|===================================================================
|--- sq905.c.old 2004-03-17 03:12:38.000000000 +0100
|+++ sq905.c 2005-12-18 20:56:43.000000000 +0100
--------------------------
No file to patch. Skipping patch.
1 out of 1 hunk ignored
===================================


Hi nivw,

did you pay attention about :

Code:

...
Be award, there is a ^I (TAB) after the name of the file you want to apply the patch in both lines beginning with --- or +++, otherwise epatch will certainly complain.
...


otherwise patches won't apply correctly ;)

PS: emerge sqcam works well with a 2.6.15-gentoo-r4 kernel too :)


Jj
_________________
« La seule condition au triomphe du mal, c'est l'inaction des gens de bien » E.Burke
Code:

+----+----+----+
|    |::::|    |
|    |::::|    |
+----+----+----+

motto: WeLCRO
WritE Less Code, Repeat Often


Last edited by Jimmy Jazz on Sun Feb 12, 2006 9:44 am; edited 2 times in total
Back to top
View user's profile Send private message
Jimmy Jazz
Apprentice
Apprentice


Joined: 04 Oct 2004
Posts: 293
Location: Strasbourg

PostPosted: Sun Feb 12, 2006 9:39 am    Post subject: Reply with quote

nivw wrote:
fine,
patched it by hand, loaded fine,
how to I create a /dev/v4l/video2 ?
how to tell linux to use the creative webcam with the sqcam module?

Niv


Hello again :),

try udev. Devices like /dev/v4l/video[0..9] will be applied automatically during startup or after the execution of udevstart.

To assign video2 to your webcam, add in your rules in /etc/udev/rules.d/10-udev.rules like the following,

Code:

BUS="usb", SYSFS{idProduct}=="IDPRODUCT_OF_YOUR_CAM", SYSFS{idVendor}=="IDVENDOR_OF_YOUR_CAM", NAME="video2", GROUP="video"


or even better, so you will avoid eventual conflicts.

Code:

BUS="usb", SYSFS{idProduct}=="IDPRODUCT_OF_YOUR_CAM", SYSFS{idVendor}=="IDVENDOR_OF_YOUR_CAM", SYMLINK="camera", GROUP="video"


idProduct and idVendor are obtained with lsusb command:

Code:


# lsusb
Bus 003 Device 004: ID 2770:9120 NHJ, Ltd Che-ez! Snap / iClick Tiny VGA Digital Camera


idProduct = 9120
idVendor = 2770

Jj
_________________
« La seule condition au triomphe du mal, c'est l'inaction des gens de bien » E.Burke
Code:

+----+----+----+
|    |::::|    |
|    |::::|    |
+----+----+----+

motto: WeLCRO
WritE Less Code, Repeat Often
Back to top
View user's profile Send private message
nivw
Apprentice
Apprentice


Joined: 09 Nov 2005
Posts: 261

PostPosted: Sun Feb 12, 2006 9:56 am    Post subject: Reply with quote

but ovcourse Jimmy Jazz,
emerged well,
However it looks that it doesnt work with the creative ultra live :-(
I submitted your ebuild at https://bugs.gentoo.org/show_bug.cgi?id=122419

Niv
Back to top
View user's profile Send private message
Jimmy Jazz
Apprentice
Apprentice


Joined: 04 Oct 2004
Posts: 293
Location: Strasbourg

PostPosted: Sat Feb 18, 2006 11:11 pm    Post subject: Reply with quote

nivw wrote:
but ovcourse Jimmy Jazz,
emerged well,
However it looks that it doesnt work with the creative ultra live :-(
I submitted your ebuild at https://bugs.gentoo.org/show_bug.cgi?id=122419

Niv


Hi,

have you tried the pwc driver? many creatives are supported but not all.

http://www.saillard.org/linux/pwc/

http://www.lavrsen.dk/twiki/bin/view/PWC/WorkingWebcamsWithPWC

Hope that help :)

Jj
_________________
« La seule condition au triomphe du mal, c'est l'inaction des gens de bien » E.Burke
Code:

+----+----+----+
|    |::::|    |
|    |::::|    |
+----+----+----+

motto: WeLCRO
WritE Less Code, Repeat Often
Back to top
View user's profile Send private message
nivw
Apprentice
Apprentice


Joined: 09 Nov 2005
Posts: 261

PostPosted: Sat Feb 18, 2006 11:54 pm    Post subject: Reply with quote

I am quite sure the chip is a SQ chip thus - the philips driver wont help.
thanks man :-)
Back to top
View user's profile Send private message
Jimmy Jazz
Apprentice
Apprentice


Joined: 04 Oct 2004
Posts: 293
Location: Strasbourg

PostPosted: Sun Feb 19, 2006 7:38 pm    Post subject: Reply with quote

nivw wrote:
I am quite sure the chip is a SQ chip thus - the philips driver wont help.
thanks man :-)


Last but not least ;) gtkam recognize an sq905 chip cam. So you could check your model with that tool.
_________________
« La seule condition au triomphe du mal, c'est l'inaction des gens de bien » E.Burke
Code:

+----+----+----+
|    |::::|    |
|    |::::|    |
+----+----+----+

motto: WeLCRO
WritE Less Code, Repeat Often
Back to top
View user's profile Send private message
nivw
Apprentice
Apprentice


Joined: 09 Nov 2005
Posts: 261

PostPosted: Sun Feb 19, 2006 10:30 pm    Post subject: Reply with quote

thanks a lot Jimmy,
:-( it didnt find it
must I start scauting for data and write my own driver :-(
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum