Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Thursday, April 26, 2012

Linux Troubleshooting: Boot

boot เครื่องใหม่และกำหนด kernel parameter เพิ่ม "init=/bin/bash" เข้าไป

วิธีนี้จะทำให้หลังจาก boot kernel เสร็จมันจะ execute /bin/bash แทนที่จะเป็น init
และมันจะไม่ execute rc script ตัวใหนเลย แต่เราจะสามารถใช้ shell บน terminal ได้

ตอนที่ boot โดยใช้ init=/bin/bash (หรือ init=/bin/sh )
root file system จะ mount เป็น read only เราจะไม่สามารถแก้ไขอะไรบน file system ได้

ลองใช้ คำสั่ง "ls > /tmp/x" ดูนะครับ จะเห็นว่ามันไม่สามารถสร้างไฟล์ได้

จะต้อง remount มันให้เป็นแบบ read/write ก่อน โดยการใช้คำสั่ง

# mount -o remount,rw /

หลังจากนั้น ลองใช้คำสั่ง "ls > /tmp/x" จะเห็นว่ามันสามารถสร้างไฟล์ /tmp/x ขึ้นมาได้

หลังจาก filesystem mount เป็นแบบ read/write แล้ว เราก็จะสามารถแก้ไข ลำดับ หรือ script
ที่ init จะ execute ได้

สมมตว่า สงสัยว่า rc script ที่ชื่อ /etc/rcS.d/S06hwclockfirst.sh เป็นตัวทำให้เครื่องหยุดทำงาน
ก็ลอง rename มันชื่ออื่นก่อน เช่น

# cd /etc/rcS.d
# mv S06hwclockfirst.sh _S06hwclockfirst.sh

เปลี่ยนชื่อไฟล์ ให้ตัวอักษรตัวแรก ไม่เป็น 'S' -- สำหรับ Start หรือ 'K' -- Kill สำหรับ
stop script จะทำให้ในขั้นตอนของการ boot up หรือ shutdown เครื่อง มันไม่ execute script
เหล่านั้น

rename โดยให้ยังคงชื่อเดิมเอาไว้เพราะในครั้งต่อไป เราอาจจะต้อง rename มันกลับเป็นชื่อเดิมอีกครั้ง
ผมใช้วิธีการเพิ่ม '_' เข้าไปหน้าชื่อ

หลังจากนี้ ก็ต้อง reboot เครื่อง แต่จะใช้คำสั่ง reboot หรือ shutdown ไม่ได้เพราะเราไม่ได้ boot เครื่อง
โดยใช้ init ตามปกติ ... ผมไม่แน่ใจว่ามีคำสั่งใหนบ้างที่จะ force reset มันได้ โดยไม่ไป execute script
ผมใช้วิธีการกดปุ่ม reset หรือ ปุ่ม power เลย

แต่ก่อนที่จะทำอย่างนั้น เพื่อความสบายใจว่า เรา mount filesystem เป็นแบบ read/write อยู่ อาจจะทำให้
file เสียหายถ้ากดปุ่ม reset เลย ก็ใช้วิธีการ remount ให้มันกลับเป็น แบบ read only ก่อน

# sync
# mount -o remount,ro /

แล้วค่อยกดปุ่ม reset ครับ

คราวนี้ให้มัน boot แบบ verbose ตามปกติแล้วดูว่ามันไปหยุดที่ใหน
แล้ว reboot เครื่องใหม่ โดยใช้ init=/bin/bash อีกครั้ง
เข้าไปดูว่ามันหยุดที่ script ตัวใหน
ใช้ คำสั่ง grep หรือ more สำหรับ ดูข้อมูลในไฟล์ได้ ว่า script ตัวใหน
เป็นตัวพิมพ์ string ล่าสุดออกมาก่อนที่มันจะหยุดไป
หลีกเลี่ยงการใช้ editor แบบ nano/vi/... นะครับ :)

ที่มา http://debianclub.org/node/736

Friday, November 25, 2011

multi monitor on linux xfce compiz

ถ้าจะใช้งาน เช่น ต่อ notebook ออก Projector หรือทำงาน 2 จอ
แนะนำ sudo apt-get install arandr ครับ

เลือกตำแหน่ง output ได้ครับ ว่าจะให้
แสดงซ้อนกัน
จอ notebook อยู่ซ้าย อีกจออยู่ขวา
หรือ จอ notebook อยู่ขวา อีกจออยู่ซ้าย
เป็นต้น

รวมถึง กรณี เช่น กำหนดให้ panel อยู่ด้านล่างของจอ (ผมชอบ interface แบบ win 3.11)
เลือกให้ 2 จอ แสดงผลซ้อนกัน
ความละเอียดจอภายนอกสูงกว่า (เวลาทำงานที่บ้าน ต่อ notebook ออกจอใหญ่ แล้วทำงานผ่านจอใหญ่เป็นหลัก)
เผลอ hibernate เครื่อง โดยที่ยังไม่ได้ปิด output จอภายนอก
หิ้วเครื่องไปทำงานที่อื่น
เมื่อเปิดเครื่อง ที่ๆไม่มีจอภายนอก
มันดันไม่ refresh ขนาดหน้าจอให้
ทำให้เลื่อนเมาส์ลงไปข้างล่างแล้วมองไม่เห็น

แก้ไขผ่านหน้า xfce-display-settings ก็ไม่ได้ (คงเป็น bug อยู่)
ลอง reload หลายอย่างเช่น
xfce-panel
compiz (ผมใช้ compiz แทน default)
ก็ไม่ได้ผล

จนลงเอยด้วย arandr

เอามาแชร์เผื่อคนอื่นเจอปัญหาเดียวกันครับ

Friday, November 18, 2011

Drupal Debian Linux VirtualBox TroubleShooting Tips

Fix Virtual Network Interface Card to eth0
===========================================
When we move the image to various hosts,
1) the interface name will keep running to eth1, eth2, eth3 and so on
2) the ip address will not automatically obtained.
because inside /etc/network/interfaces
....
iface eth0 inet dhcp
...

For solution Go To network-interface-in-linux.html


HTTP request status Fails
==========================
http://drupal.org/node/588186

Network interface in Linux

How to reorder or rename logical interface names in Linux
===========================================================
$ sudo apt-get install ifrename
$ cat /etc/iftab
eth0 mac E0:*

Other ways are detailed at http://www.science.uva.nl/research/air/wiki/LogicalInterfaceNames


It's quite useful in case of install Linux on a virtual machine.

When we move the image to various hosts,
1) the interface name will keep running to eth1, eth2, eth3 and so on
2) the ip address will not automatically obtained.
because inside /etc/network/interfaces
....
iface eth0 inet dhcp
...


New method
=========
use the udev-sanctioned method of statically-naming each interface.
Create the following file to bind the MAC address of each of your cards to a certain interface name:
/etc/udev/rules.d/10-network.rules
SUBSYSTEM=="net" KERNEL=="eth*", ATTR{address}=="00:12:34:fe:dc:ba", NAME="eth0"

note:
  • To get the MAC address of each card, use this command: cat /sys/class/net/device-name/address
  • When syntax errors, look at /etc/udev/rules.d/70-persistent-net.rules
  • Make sure to use the lower-case hex values in your udev rules. It doesn't like upper-case.

  • When choosing the static names it should be avoided to use "ethX" and "wlanX", because this may lead to race conditions between the kernel and udev during boot. Instead, it is better to use interface names that are not used by the kernel as default, e.g. "net0, net1, wifi0, wifi1".


Ref:
http://www.debianhelp.co.uk/udev.htm
https://wiki.archlinux.org/index.php/Udev#Network_device

equivalent Microsoft Project Linux

I'm looking for a free of the equivalent of Microsoft Project on linux.

ganttproject meet my need.



ganttproject
============
http://ganttproject.biz/
java-based


OpenProj
========
http://openproj.org
Licence terms: CPAL

openproj_1.4-2.deb 2008-10-02
http://sourceforge.net/projects/openproj/files/OpenProj%20Binaries/1.4/


Pleno
=====
- URL: http://sourceforge.net/projects/pleno/
- Licence terms: GPL


Projectivity
============
- URL: http://www.projectivity.biz
- Licence terms: GPL


Todoyu
======
- URL: http://todoyu.sourceforge.net
- Licence terms: BSD
Require Apache, PHP, MySQL


Project HQ
==========
- URL: http://projecthq.org/
- Licence terms: GPL



Taskjuggler
===========
Modern and powerful open source project management tool.
www.taskjuggler.org
Free
written in Ruby
sudo apt-get install rubygems
gem install taskjuggler


Planner
=======
The GNOME project management tool
sudo apt-get install planner



Koffice KPlato
===============



Web-based
=========
Feng Office Web Office focused on productivity, collaboration, communication and management
eGroupWare Enterprise ready web-based groupware suite with project management
dotProject Web-based, multi-user, multi-language project management application
Redmine Flexible application written using the Ruby on Rails framework

Monday, October 24, 2011

XML HTML Editor IDE for Linux

Name Version Free WYSIWYG Code Support inline script (PHP) Auto Complete Highlight Match Bracket Folding Tag Toggle Comment Note
KompoZer 0.8b3
20081229
Y +Prop. Dialog Box
+ HTML Form
BP: Y
RC: fill later
Y N N N N my note is here
Seamonkey
Composer
2.4.1 Y + Prop. Dialog Box
(No HTML Form)
BP: Y

N N N

less features than Komposer
BlueGriffon 1.2.1 Y + Prop. Dialog Box
+ HTML5
+ SVG
BP: Y N HTML N N
Because Gecko lives inside, the
document will look exactly the same in Firefox.
Amaya 11.3.1
May 11 2011
Y + HTML5
+ SVG
BP:Y




my note is here
Aptana 3.0.5
20111006
Y N BP: Y
RC: Y
Y Excellent
PHP+HTML
Y Y
+ outline
Excellent Eclipse Base
Eclipse
PHP
Helios
20100617-1415
Y N


Y Y
+ outline


Eclipse
HTML Editor










Netbean 7.0.1 Y N Poor
more info
Y Y
+ help
Y Y
+ outline


Intellij IDEA
Community Edition
10.5 Y N Customizable Y HTML Y Y

serna free
Y Y






Serna enterprise XML
N Y






Emacs 23

nXhtml nXhtml




Bluefish 2.0.3 Y N external
tools
Y HTML
PHP (pop up)
Y Y Y
Geany 0.2
Jun 23 2011
Y N external tools Y HTML
PHP (fix)
no build-in Y Y more
info
gedit 2.30.4 Y N external
tools
simple text editor no build-in no build-in no build-in no build-in
sublime 2 No but no enforced time limit for the evaluation





SciTE 2.25
Apr 14 2011



Partial no build-in no build-in HTML
Lightweight GTK-based
Programming Editor
kate 3.6.5

?




KDE app
OpenBEXI
Y Y






Arachnophilia 5.5 Y N RC: Y but not quite good




Java App.
Quanta Plus
Y






KDE App.
Quanta Gold
N







Komodo Edit 6 Y
No Build-in





Komodo IDE
N
Y





phpstorm
N






30-day trial
jedit 4.4 Y N Y (UTF8?)
more info





java app
medit 1.0.3 Y N No Build-in





gphpedit






bug

UniversalIndentGUI









EditiX
N






Evaluation : 30 days
oXygen
N






Evaluation : 30 days
Screem








Dead Project


Code
BP = Beauty Print : the code output when use ide to create html element
RC = Reformat Code : existing code including Javascript/PHP/JSP snippet.

Some External tools for tidy/beautify/reformat html code are
http://tidy.sourceforge.net (my note
on tidy here)
http://phptidy.berlios.de/

More info at
http://en.wikipedia.org/wiki/Comparison_of_HTML_editors
http://www.linuxdocs.org/HOWTOs/PHP-HOWTO-9.html
http://drupal.org/node/147789

Or Edit online at
http://lifehacker.biz/articles/web-developers-package-code-beautifier-and-formatter/


Conclusion
=======
I choice KompoZer as my primary WYSIWYG for HTML
,1) Bluefish 2) Aptana as PHP text editor (b/c of its help when autocomplete)
,Geany for small change in code and other xml files
,Inkscape when draft SVG
serna ??


Eclipse PHP Development Tools

Intellij IDEA

NetBeans

NetBeans Result

tidy reformat beautify html xml gedit


Using tidy.sourceforge.net
==========================
sudo apt-get install tidy
sudo apt-get install gedit-plugins

Under Plugins Tab:
Enable External tools

(My note on tidy is here)



Using PHP_Beautifier
======================
http://pear.php.net/package/PHP_Beautifier
This tool will not be able to beautify inline html and php together.

sudo apt-get install php-pear
# Still in Beta state

sudo pear install PHP_Beautifier
sudo pear install PHP_Beautifier-0.1.15.tgz

php_beautifier -s4 -l "ArrayNested() IndentStyles(style=bsd) NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT)"


Full instruction at http://www.masnun.me/2010/04/10/using-gedit-as-a-php-ide.html


Plug-in
=====
http://yuix.org/web-development/ubuntu-11-10-oneiric-ocelot-gedit-indent-lines-plugin/184



More info
==========
gedit-3 : http://live.gnome.org/Gedit/Plugins#third_party
gedit-2 : http://live.gnome.org/Gedit/PluginsOld

http://www.micahcarrick.com/gedit-html-editor.html

Tidy/reformat/beautify html in Bluefish

Setting
========
Menu Edit -> Preference(s) -> External filters -> Tiny HTML
Change Command from 'tiny' to 'tiny -i'
(My note on tiny is here)


Reformat Code
=============
Tools -> Filters -> Tiny HTML

tidy/reformat/beautify html/xml in Geany

tidy.sourceforge.net
====================
Menu Edit -> Format -> Send Selection to ->
tidy -config /path/to/tidy.conf
(My tidy.conf is here)

phptidy.berlios.de
===================


Autocomplete
============
http://www.krutant.com/2011/05/geany-perfect-web-development-ide.html


Geany = ?
==========
Geany is a small and lightweight integrated development environment.
It was developed to provide a small and fast IDE, which has only a few dependencies from other packages.
It is using only the GTK2 toolkit and therefore you need only the GTK2 runtime libraries to run Geany.

The basic features of Geany are:
 - syntax highlighting
 - code completion
 - auto completion of constructs like if, for and while, XML and HTML
 - call tips
 - folding
 - many supported filetypes like C, Java, PHP, HTML, Python, Perl, Pascal
 - symbol lists
 - embedded terminal emulation

https://github.com/codebrainz/geany-zencoding


tidy/reformat/beautify/pretty-print html by tidy.sourceforge.net

HTML syntax checker and reformatter

Corrects markup in a way compliant with the latest standards, and optimal for the popular browsers.
It has a comprehensive knowledge of the attributes defined in the HTML 4.0 recommendation from W3C, and understands the US ASCII, ISO Latin-1, UTF-8 and the ISO 2022 family of 7-bit encodings.

In the output:
 * HTML entity names for characters are used when appropriate.
 * Missing attribute quotes are added, and mismatched quotes found.
 * Tags lacking a terminating '>' are spotted.
 * Proprietary elements are recognized and reported as such.
 * The page is reformatted, from a choice of indentation styles.


Installation
=======
sudo apt-get install tidy


tidy.conf
======
// tidy version 25 March 2009


//markup: yes
//break-before-br: no
indent: yes
//indent-attributes: no
// add indent-spaces to avoid bug
indent-spaces: 2
vertical-space: yes
wrap: 0
wrap-php: yes
//char-encoding: utf8
input-encoding: utf8
output-encoding: utf8
tidy-mark: no
// output-xhtml to avoid error of save same buffer many times
output-xhtml: yes
// w/o quiet: yes option, error might show
quiet: yes
doctype: strict



Useful options
================
-indent, -i
= indent element content

-utf8
= use UTF-8 for both input and output

-asxml, -asxhtml
= convert HTML to well formed XHTML (output-xhtml: yes)

-wrap , -w
= wrap text at the specified .
Set wrap to zero if you want to disable line wrapping.
0 is assumed if is missing.

--tidy-mark no
= if Tidy should add a meta element to the document head to indicate that the document has been tidied.
(Default: yes)



More info
==========
http://tidy.sourceforge.net
http://tidy.sourceforge.net/docs/quickref.html
man tidy
http://www.w3.org/People/Raggett/tidy/

Subproject:
http://us3.php.net/manual/en/intro.tidy.php

Saturday, October 15, 2011

Zoneminder Troubleshooting Guide

Is the card working properly?
======================
Try out these commands:
$ dmesg | grep bttv
....

$ sudo tail -f /var/log/syslog
.....

$ ls -ls /dev/video*
0 crw-rw-rw-+ 1 root video 81, 0 Oct 15 22:46 /dev/video0
0 crw-rw-rw-+ 1 root video 81, 2 Oct 15 22:46 /dev/video1
0 crw-rw-rw-+ 1 root video 81, 4 Oct 15 22:46 /dev/video2
0 crw-rw-rw-+ 1 root video 81, 6 Oct 15 22:46 /dev/video3

$ v4l-info /dev/video0
.....

$ ffmpeg -f video4linux2 -s 320x240 -r 30000/1001 -i /dev/video0 -y webcam.avi


Other useful commands
=================
$ sudo /etc/init.d/apache2 force-reload
$ sudo service zoneminder restart



Got unexpected memory map file size
===========================
$ sudo tail -f /var/log/syslog
....
Oct 14 17:17:52 penguin zmc_dvideo0[9153]: ERR [Got unexpected memory map file size 10801524, expected 12166644]
....

Solution
======
Open the file “/etc/sysctl.conf”, and paste these lines at the bottom of the file, then reboot.
kernel.shmall = 167772160
kernel.shmmax = 167772160

Ref: http://www.zoneminder.com/wiki/index.php/Debian_Squeeze#Inadequate_Memory_Allocation




Failed to set video format: Invalid argument
================================
$ sudo tail -f /var/log/syslog
.....
Oct 14 17:18:11 penguin zmc_dvideo1[9158]: FAT [Failed to set video format: Invalid argument]
.....

Solution
======
Change Configuration in Monitor -> Source
Device Format, Capture Palette, Capture Width, and Capture Hight
to be compatible with your camera


DVR Geovision GV-800 Zoneminder Linux

GV-800
Hardware version 3.5
16 ch video and 4 ch audio,120/100fps


Specification
==========
$ lspci -n
...
04:00.0 0400: 109e:036e (rev 11)
04:00.1 0480: 109e:0878 (rev 11)
04:04.0 0400: 109e:036e (rev 11)
04:04.1 0480: 109e:0878 (rev 11)
04:08.0 0400: 109e:036e (rev 11)
04:08.1 0480: 109e:0878 (rev 11)
04:0c.0 0400: 109e:036e (rev 11)
04:0c.1 0480: 109e:0878 (rev 11)
...

$ lspci -k
04:00.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
    Subsystem: Device 800a:763d
    Kernel driver in use: bttv
04:00.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
    Subsystem: Device 800a:763d
04:04.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
    Subsystem: Device 800b:763d
    Kernel driver in use: bttv
04:04.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
    Subsystem: Device 800b:763d
04:08.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
    Subsystem: Device 800c:763d
    Kernel driver in use: bttv
04:08.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
    Subsystem: Device 800c:763d
04:0c.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
    Subsystem: Device 800d:763d
    Kernel driver in use: bttv
04:0c.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
    Subsystem: Device 800d:763d

$ ls -ls /dev/video*
0 crw-rw----+ 1 root video 81, 0 Oct 14 06:41 /dev/video0
0 crw-rw----+ 1 root video 81, 2 Oct 14 06:41 /dev/video1
0 crw-rw----+ 1 root video 81, 4 Oct 14 06:41 /dev/video2
0 crw-rw----+ 1 root video 81, 6 Oct 14 06:41 /dev/video3

$ uname -r
3.0.0-1-amd64


Installation
============
only http://www.zoneminder.com/wiki/index.php/Debian_Squeeze
then http://www.zoneminder.com/wiki/index.php/Ubuntu_9.04_%28Jaunty%29_desktop_with_graphical_interface
For adding cameras
*NOT require /etc/modprob.d/bttv.conf configuration

Camera 1 -> /dev/video0 channel 0
Camera 2 -> /dev/video1 channel 0
Camera 3 -> /dev/video2 channel 0
Camera 4 -> /dev/video3 channel 0

Camera 5 -> /dev/video0 channel 1
Camera 6 -> /dev/video1 channel 1
Camera 7 -> /dev/video2 channel 1
Camera 8 -> /dev/video3 channel 1

Camera 9 -> /dev/video0 channel 2
Camera 10 -> /dev/video1 channel 2
Camera 11 -> /dev/video2 channel 2
Camera 12 -> /dev/video3 channel 2

Camera 13 -> /dev/video0 channel 3
Camera 14 -> /dev/video1 channel 3
Camera 15 -> /dev/video2 channel 3
Camera 16 -> /dev/video3 channel 3


Useful Commands
===============
$ v4l-info /dev/video0
$ sudo /etc/init.d/apache2 force-reload
$ sudo service zoneminder restart
$ dmesg | grep bttv
$ sudo tail -f /var/log/syslog
$ ffmpeg -f video4linux2 -s 320x240 -r 30000/1001 -i /dev/video0 -y webcam.avi



Output in dmesg
============
$ dmesg | grep bttv
[    5.805510] bttv: driver version 0.9.18 loaded
[    5.805512] bttv: using 8 buffers with 2080k (520 pages) each for capture
[    5.805720] bttv: Bt8xx card found (0).
[    5.805740] bttv 0000:04:00.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21
[    5.805750] bttv0: Bt878 (rev 17) at 0000:04:00.0, irq: 21, latency: 64, mmio: 0xfdeff000
[    5.805770] bttv0: detected: GeoVision GV-800(S) (master) [card=157], PCI subsystem ID is 800a:763d
[    5.805772] bttv0: using: Geovision GV-800(S) (master) [card=157,autodetected]
[    5.805807] bttv0: gpio: en=00000000, out=00000000 in=00ff28ff [init]
[    5.806572] bttv0: tuner absent
[    5.806604] bttv0: registered device video0
[    5.806624] bttv0: registered device vbi0
[    5.806650] bttv0: PLL: 28636363 => 35468950 .. ok
[    5.839533] bttv: Bt8xx card found (1).
[    5.839544] bttv 0000:04:04.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21
[    5.839552] bttv1: Bt878 (rev 17) at 0000:04:04.0, irq: 21, latency: 64, mmio: 0xfdefd000
[    5.839573] bttv1: detected: GeoVision GV-800(S) (slave) [card=158], PCI subsystem ID is 800b:763d
[    5.839575] bttv1: using: Geovision GV-800(S) (slave) [card=158,autodetected]
[    5.839602] bttv1: gpio: en=00000000, out=00000000 in=00ff7cff [init]
[    5.839639] bttv1: tuner absent
[    5.839667] bttv1: registered device video1
[    5.839690] bttv1: registered device vbi1
[    5.839717] bttv1: PLL: 28636363 => 35468950 .. ok
[    5.871530] bttv: Bt8xx card found (2).
[    5.871540] bttv 0000:04:08.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21
[    5.871548] bttv2: Bt878 (rev 17) at 0000:04:08.0, irq: 21, latency: 64, mmio: 0xfdefb000
[    5.871568] bttv2: detected: GeoVision GV-800(S) (slave) [card=158], PCI subsystem ID is 800c:763d
[    5.871570] bttv2: using: Geovision GV-800(S) (slave) [card=158,autodetected]
[    5.871596] bttv2: gpio: en=00000000, out=00000000 in=00ffbeff [init]
[    5.871632] bttv2: tuner absent
[    5.871659] bttv2: registered device video2
[    5.871682] bttv2: registered device vbi2
[    5.871708] bttv2: PLL: 28636363 => 35468950 .. ok
[    5.903525] bttv: Bt8xx card found (3).
[    5.903534] bttv 0000:04:0c.0: PCI INT A -> GSI 21 (level, low) -> IRQ 21
[    5.903542] bttv3: Bt878 (rev 17) at 0000:04:0c.0, irq: 21, latency: 64, mmio: 0xfdef9000
[    5.903557] bttv3: detected: GeoVision GV-800(S) (slave) [card=158], PCI subsystem ID is 800d:763d
[    5.903559] bttv3: using: Geovision GV-800(S) (slave) [card=158,autodetected]
[    5.903584] bttv3: gpio: en=00000000, out=00000000 in=00fffcff [init]
[    5.903621] bttv3: tuner absent
[    5.903650] bttv3: registered device video3
[    5.903671] bttv3: registered device vbi3
[    5.903697] bttv3: PLL: 28636363 => 35468950 .. ok

DVR Techwell 6805a




$ uname -r
3.0.0-1-amd64


$ lspci -n
....
02:00.0 0c03: 1033:0194 (rev 03)
03:06.0 0400: 1797:6804 (rev 10)
03:06.1 0480: 1797:6805 (rev 10)
04:00.0 0101: 197b:2368
.....


$ lspci -k
.....
02:00.0 USB Controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 03)
    Subsystem: Micro-Star International Co., Ltd. Device 7599
    Kernel driver in use: xhci_hcd
03:06.0 Multimedia video controller: Techwell Inc. Device 6804 (rev 10)
03:06.1 Multimedia controller: Techwell Inc. Device 6805 (rev 10)
04:00.0 IDE interface: JMicron Technology Corp. JMB368 IDE controller
    Subsystem: Micro-Star International Co., Ltd. Device 7599
    Kernel driver in use: pata_jmicron
....


$ ls -ls /dev/video*
ls: cannot access /dev/video*: No such file or directory


DVR Card 104C-E zoneminder

work with Zoneminder + linux
follow instruction on
http://www.zoneminder.com/wiki/index.php/Debian_Squeeze
(include instruction on other issues)

no need to create or edit /etc/modprobe.d/bttv.conf
Camera 1 -> /dev/video0 channel 0
Camera 2 -> /dev/video0 channel 1
Camera 3 -> /dev/video0 channel 2
Camera 4 -> /dev/video0 channel 3


$ uname -r
3.0.0-1-amd64

Card Specification
============
http://www.tungson.cn/en/product_info.asp?InfoID=163



$ lspci -k
03:06.0 Multimedia video controller: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder (rev 05)
    Subsystem: Device c180:c980
    Kernel driver in use: cx8800
03:06.1 Multimedia controller: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder [Audio Port] (rev 05)
    Subsystem: Device c180:c980
    Kernel driver in use: cx88_audio


$ ls -ls /dev/video*
0 crw-rw-rw-+ 1 root video 81, 0 Oct 15 11:23 /dev/video0


$ v4l-info /dev/video0

### v4l2 device info [/dev/video0] ###
general info
    VIDIOC_QUERYCAP
    driver                  : "cx8800"
    card                    : "Shenzhen Tungsten Ages Tech TE-"
    bus_info                : "PCI:0000:03:06.0"
    version                 : 0.0.8
    capabilities            : 0x5010011 [VIDEO_CAPTURE,VBI_CAPTURE,TUNER,READWRITE,STREAMING]

standards
    VIDIOC_ENUMSTD(0)
    index                   : 0
    id                      : 0x1000 [NTSC_M]
    name                    : "NTSC-M"
    frameperiod.numerator   : 1001
    frameperiod.denominator : 30000
    framelines              : 525
    VIDIOC_ENUMSTD(1)
    index                   : 1
    id                      : 0x2000 [NTSC_M_JP]
    name                    : "NTSC-M-JP"
    frameperiod.numerator   : 1001
    frameperiod.denominator : 30000
    framelines              : 525
    VIDIOC_ENUMSTD(2)
    index                   : 2
    id                      : 0x4000 [?]
    name                    : "NTSC-443"
    frameperiod.numerator   : 1001
    frameperiod.denominator : 30000
    framelines              : 525
    VIDIOC_ENUMSTD(3)
    index                   : 3
    id                      : 0x7 [PAL_B,PAL_B1,PAL_G]
    name                    : "PAL-BG"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(4)
    index                   : 4
    id                      : 0x10 [PAL_I]
    name                    : "PAL-I"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(5)
    index                   : 5
    id                      : 0xe0 [PAL_D,PAL_D1,PAL_K]
    name                    : "PAL-DK"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(6)
    index                   : 6
    id                      : 0x100 [PAL_M]
    name                    : "PAL-M"
    frameperiod.numerator   : 1001
    frameperiod.denominator : 30000
    framelines              : 525
    VIDIOC_ENUMSTD(7)
    index                   : 7
    id                      : 0x200 [PAL_N]
    name                    : "PAL-N"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(8)
    index                   : 8
    id                      : 0x400 [PAL_Nc]
    name                    : "PAL-Nc"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(9)
    index                   : 9
    id                      : 0x800 [PAL_60]
    name                    : "PAL-60"
    frameperiod.numerator   : 1001
    frameperiod.denominator : 30000
    framelines              : 525
    VIDIOC_ENUMSTD(10)
    index                   : 10
    id                      : 0x10000 [SECAM_B]
    name                    : "SECAM-B"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(11)
    index                   : 11
    id                      : 0x40000 [SECAM_G]
    name                    : "SECAM-G"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(12)
    index                   : 12
    id                      : 0x80000 [SECAM_H]
    name                    : "SECAM-H"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(13)
    index                   : 13
    id                      : 0x320000 [SECAM_D,SECAM_K,SECAM_K1]
    name                    : "SECAM-DK"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625
    VIDIOC_ENUMSTD(14)
    index                   : 14
    id                      : 0x400000 [SECAM_L]
    name                    : "SECAM-L"
    frameperiod.numerator   : 1
    frameperiod.denominator : 25
    framelines              : 625

inputs
    VIDIOC_ENUMINPUT(0)
    index                   : 0
    name                    : "Television"
    type                    : TUNER
    audioset                : 0
    tuner                   : 0
    std                     : 0x7f7ff7 [PAL_B,PAL_B1,PAL_G,PAL_I,PAL_D,PAL_D1,PAL_K,PAL_M,PAL_N,PAL_Nc,PAL_60,NTSC_M,NTSC_M_JP,?,SECAM_B,SECAM_D,SECAM_G,SECAM_H,SECAM_K,SECAM_K1,SECAM_L]
    status                  : 0x0 []
    VIDIOC_ENUMINPUT(1)
    index                   : 1
    name                    : "Composite1"
    type                    : CAMERA
    audioset                : 0
    tuner                   : 0
    std                     : 0x0 []
    status                  : 0x0 []
    VIDIOC_ENUMINPUT(2)
    index                   : 2
    name                    : "S-Video"
    type                    : CAMERA
    audioset                : 0
    tuner                   : 0
    std                     : 0x0 []
    status                  : 0x0 []

tuners
    VIDIOC_G_TUNER(0)
    index                   : 0
    name                    : "Television"
    type                    : ANALOG_TV
    capability              : 0x70 [STEREO,LANG2,LANG1]
    rangelow                : 0
    rangehigh               : 4294967295
    rxsubchans              : 0x1 [MONO]
    audmode                 : MONO
    signal                  : 65535
    afc                     : 0

video capture
    VIDIOC_ENUM_FMT(0,VIDEO_CAPTURE)
    index                   : 0
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "8 bpp, gray"
    pixelformat             : 0x59455247 [GREY]
    VIDIOC_ENUM_FMT(1,VIDEO_CAPTURE)
    index                   : 1
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "15 bpp RGB, le"
    pixelformat             : 0x4f424752 [RGBO]
    VIDIOC_ENUM_FMT(2,VIDEO_CAPTURE)
    index                   : 2
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "15 bpp RGB, be"
    pixelformat             : 0x51424752 [RGBQ]
    VIDIOC_ENUM_FMT(3,VIDEO_CAPTURE)
    index                   : 3
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "16 bpp RGB, le"
    pixelformat             : 0x50424752 [RGBP]
    VIDIOC_ENUM_FMT(4,VIDEO_CAPTURE)
    index                   : 4
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "16 bpp RGB, be"
    pixelformat             : 0x52424752 [RGBR]
    VIDIOC_ENUM_FMT(5,VIDEO_CAPTURE)
    index                   : 5
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "24 bpp RGB, le"
    pixelformat             : 0x33524742 [BGR3]
    VIDIOC_ENUM_FMT(6,VIDEO_CAPTURE)
    index                   : 6
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "32 bpp RGB, le"
    pixelformat             : 0x34524742 [BGR4]
    VIDIOC_ENUM_FMT(7,VIDEO_CAPTURE)
    index                   : 7
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "32 bpp RGB, be"
    pixelformat             : 0x34424752 [RGB4]
    VIDIOC_ENUM_FMT(8,VIDEO_CAPTURE)
    index                   : 8
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "4:2:2, packed, YUYV"
    pixelformat             : 0x56595559 [YUYV]
    VIDIOC_ENUM_FMT(9,VIDEO_CAPTURE)
    index                   : 9
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "4:2:2, packed, UYVY"
    pixelformat             : 0x59565955 [UYVY]
    VIDIOC_G_FMT(VIDEO_CAPTURE)
    type                    : VIDEO_CAPTURE
    fmt.pix.width           : 320
    fmt.pix.height          : 240
    fmt.pix.pixelformat     : 0x33524742 [BGR3]
    fmt.pix.field           : INTERLACED
    fmt.pix.bytesperline    : 960
    fmt.pix.sizeimage       : 230400
    fmt.pix.colorspace      : unknown
    fmt.pix.priv            : 0

vbi capture
    VIDIOC_G_FMT(VBI_CAPTURE)
    type                    : VBI_CAPTURE
    fmt.vbi.sampling_rate   : 35468950
    fmt.vbi.offset          : 244
    fmt.vbi.samples_per_line: 2048
    fmt.vbi.sample_format   : 0x59455247 [GREY]
    fmt.vbi.start[0]        : 6
    fmt.vbi.start[1]        : 318
    fmt.vbi.count[0]        : 17
    fmt.vbi.count[1]        : 17
    fmt.vbi.flags           : 0

controls
    VIDIOC_QUERYCTRL(BASE+0)
    id                      : 9963776
    type                    : INTEGER
    name                    : "Brightness"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 127
    flags                   : 0
    VIDIOC_QUERYCTRL(BASE+1)
    id                      : 9963777
    type                    : INTEGER
    name                    : "Contrast"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 63
    flags                   : 0
    VIDIOC_QUERYCTRL(BASE+2)
    id                      : 9963778
    type                    : INTEGER
    name                    : "Saturation"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 127
    flags                   : 0
    VIDIOC_QUERYCTRL(BASE+3)
    id                      : 9963779
    type                    : INTEGER
    name                    : "Hue"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 127
    flags                   : 0



Useful Commands
============
sudo service zoneminder restart
sudo /etc/init.d/apache2 force-reload
sudo /etc/init.d/udev restart
dmesg
sudo tail -f /var/log/syslog
ffmpeg -f video4linux2 -s 352x288 -r 30000/1001 -i /dev/video0 -y webcam.avi

sudo apt-get install xawtv
xawtv -nodga -device /dev/video3
xawtv -c /dev/video0

Adding Cameras:
go to http://www.zoneminder.com/wiki/index.php/Ubuntu_9.04_%28Jaunty%29_desktop_with_graphical_interface