Hi all,
I have been working on motion in order to use it on an embedded device, the fox board (www.acmesystems.it ).
I am also using 2 webcams by creative using the spca5xx LE module (mxhaard.free.fr/embedded.html),  and therefore I had to modify motion, since the LE version of the driver enables the device only to be opened with VIDEO_PALETTE_JPEG only.
I partially managed to do that, i.e. motion works fine only with one webcam. As soon as I try to use 2 webcams at the same time (enabling therefore a second thread on a different video device obviously) the board hangs. It seems the problem lies in the webcams' driver (spca5xx LE). I contacted the developer of my two webcams' kernel module driver, and it seems like he's unwilling to enable the support for more than one webcam.
Therefore I decided to try and implement that by myself, and amidst reading docs about module kernel programming I issued the command
strace motion -n -c /etc/motion.conf
on the foxboard, trying to understand what was going on.
Now, I do understand that the problem most likely lies in the driver and not in motion (even if it was modified by me), but I wanted to needed to see where the driver hanged. I'm showing this to you guys since you are more experienced than me and maybe you can figure out what's wrong (I know, it's a long shot). And from there I can maybe figure out what is the problem in kernel space.
I got the following log:

execve("/bin/motion", ["motion", "-n", "-c", "/etc/motion.conf"], [/* 10 vars */]) = 0
uname({sys="Linux", node="axis", ...})  = 0
brk(0)                                  = 0xa72c0
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = -1 ENOENT (No such file or directory)
open("/lib/libm.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0L\0\1\0\0\0\0C\0\000"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=685524, ...}) = 0
mmap2(NULL, 690752, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x35568000
mprotect(0x35610000, 2624, PROT_NONE)   = 0
mmap2(0x35610000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x53) = 0x35610000
close(3)                                = 0
open("/lib/libpthread.so.0", O_RDONLY)  = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0L\0\1\0\0\0\314H\0\000"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=74612, ...}) = 0
mmap2(NULL, 81632, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x35612000
mprotect(0x3561e000, 32480, PROT_NONE)  = 0
mmap2(0x3561e000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x5) = 0x3561e000
close(3)                                = 0
open("/lib/libjpeg.so.62", O_RDONLY)    = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0L\0\1\0\0\0 /\0\000"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=104084, ...}) = 0
mmap2(NULL, 111296, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x35626000
mprotect(0x35640000, 4800, PROT_NONE)   = 0
mmap2(0x35640000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xc) = 0x35640000
close(3)                                = 0
open("/lib/libavformat.so", O_RDONLY)   = -1 ENOENT (No such file or directory)
open("/usr/lib/libavformat.so", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0L\0\1\0\0\0\0\236\0"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=302400, ...}) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x35642000
mmap2(NULL, 309504, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x35644000
mprotect(0x3568c000, 14592, PROT_NONE)  = 0
mmap2(0x3568c000, 16384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x23) = 0x3568c000
close(3)                                = 0
open("/lib/libavcodec.so", O_RDONLY)    = -1 ENOENT (No such file or directory)
open("/usr/lib/libavcodec.so", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0L\0\1\0\0\0 \311\0\000"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=1168288, ...}) = 0
mmap2(NULL, 1501280, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x35690000
mprotect(0x357a8000, 354400, PROT_NONE) = 0
mmap2(0x357a8000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x8b) = 0x357a8000
mmap2(0x357b0000, 321632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x357b0000
close(3)                                = 0
open("/lib/libz.so.1", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0L\0\1\0\0\0\0\33\0\000"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=95392, ...}) = 0
mmap2(NULL, 102592, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x35800000
mprotect(0x35818000, 4288, PROT_NONE)   = 0
mmap2(0x35818000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0xb) = 0x35818000
close(3)                                = 0
open("/lib/libmysqlclient.so.15", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0L\0\1\0\0\0\200\336"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=464440, ...}) = 0
mmap2(NULL, 473056, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x3581a000
mprotect(0x35866000, 161760, PROT_NONE) = 0
mmap2(0x35866000, 163840, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x25) = 0x35866000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0L\0\1\0\0\0\364\254"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=823732, ...}) = 0
mmap2(NULL, 842464, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x3588e000
mprotect(0x35952000, 39648, PROT_NONE)  = 0
mmap2(0x35952000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x61) = 0x35952000
mmap2(0x35958000, 15072, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x35958000
close(3)                                = 0
open("/lib/libcrypt.so.1", O_RDONLY)    = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0L\0\1\0\0\0\270\r\0"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=17552, ...}) = 0
mmap2(NULL, 184480, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x3595c000
mprotect(0x35960000, 168096, PROT_NONE) = 0
mmap2(0x35960000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x1) = 0x35960000
mmap2(0x35962000, 159904, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x35962000
close(3)                                = 0
open("/lib/libnsl.so.1", O_RDONLY)      = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0L\0\1\0\0\0DD\0\000"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=61992, ...}) = 0
mmap2(NULL, 77344, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x3598a000
mprotect(0x3599a000, 11808, PROT_NONE)  = 0
mmap2(0x3599a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x7) = 0x3599a000
mmap2(0x3599c000, 3616, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3599c000
close(3)                                = 0
getpid()                                = 146
getpid()                                = 146
rt_sigaction(SIGRTMIN, {0x35619d22, [], 0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x35619da4, [], 0}, NULL, 8) = 0
rt_sigaction(SIGRT_2, {0x35619e9a, [], 0}, NULL, 8) = 0
rt_sigprocmask(SIG_BLOCK, [RTMIN], NULL, 8) = 0
_sysctl({{CTL_KERN, KERN_VERSION}, 2, 0x9ffffaf4, 33, (nil), 0}) = 0
rt_sigaction(SIGCHLD, {0x3561a30c, [], SA_NOCLDWAIT}, NULL, 8) = 0
rt_sigaction(SIGPIPE, {0x3561a30c, [], SA_NOCLDWAIT}, NULL, 8) = 0
rt_sigaction(SIGALRM, {0x3561a30c, [], SA_RESTART}, NULL, 8) = 0
rt_sigaction(SIGHUP, {0x3561a30c, [], SA_RESTART}, NULL, 8) = 0
rt_sigaction(SIGINT, {0x3561a30c, [], SA_RESTART}, NULL, 8) = 0
rt_sigaction(SIGQUIT, {0x3561a30c, [], SA_RESTART}, NULL, 8) = 0
rt_sigaction(SIGTERM, {0x3561a30c, [], SA_RESTART}, NULL, 8) = 0
rt_sigaction(SIGUSR1, {0x3561a30c, [], SA_RESTART}, NULL, 8) = 0
brk(0)                                  = 0xa72c0
brk(0xa72f0)                            = 0xa72f0
brk(0xa8000)                            = 0xa8000
brk(0xae000)                            = 0xae000
open("/etc/motion.conf", O_RDONLY)      = 3
time([778])                             = 778
brk(0xb0000)                            = 0xb0000
open("/etc/localtime", O_RDONLY)        = -1 ENOENT (No such file or directory)
rt_sigaction(SIGPIPE, {0x3561a30c, [], 0}, {0x3561a30c, [], SA_NOCLDWAIT}, 8) = 0
socket(PF_FILE, SOCK_DGRAM, 0)          = 4
fcntl64(4, F_SETFD, FD_CLOEXEC)         = 0
connect(4, {sa_family=AF_FILE, path="/dev/log"}, 16) = 0
send(4, "<14>Jan  1 00:12:58 motion: [0] "..., 82, 0) = 82
rt_sigaction(SIGPIPE, {0x3561a30c, [], SA_NOCLDWAIT}, NULL, 8) = 0
write(2, "[0] Processing thread 0 - config"..., 55) = 55
fstat64(3, {st_mode=S_IFREG|0644, st_size=12902, ...}) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x3599e000
read(3, "# Rename this distribution examp"..., 8192) = 8192
read(3, "n center\n# %C = value defined by"..., 8192) = 4710
open("/etc/cam1.conf", O_RDONLY)        = 5
brk(0xb6000)                            = 0xb6000
time([778])                             = 778
rt_sigaction(SIGPIPE, {0x3561a30c, [], 0}, {0x3561a30c, [], SA_NOCLDWAIT}, 8) = 0
send(4, "<14>Jan  1 00:12:58 motion: [0] "..., 69, 0) = 69
rt_sigaction(SIGPIPE, {0x3561a30c, [], SA_NOCLDWAIT}, NULL, 8) = 0
write(2, "[0] Processing config file /etc/"..., 42) = 42
fstat64(5, {st_mode=S_IFREG|0644, st_size=770, ...}) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x359a0000
read(5, "videodevice /dev/video0\nwebcam_p"..., 8192) = 770
read(5, "", 8192)                       = 0
close(5)                                = 0
munmap(0x359a0000, 8192)                = 0
open("/etc/cam2.conf", O_RDONLY)        = 5
brk(0xbc000)                            = 0xbc000
time([778])                             = 778
rt_sigaction(SIGPIPE, {0x3561a30c, [], 0}, {0x3561a30c, [], SA_NOCLDWAIT}, 8) = 0
send(4, "<14>Jan  1 00:12:58 motion: [0] "..., 69, 0) = 69
rt_sigaction(SIGPIPE, {0x3561a30c, [], SA_NOCLDWAIT}, NULL, 8) = 0
write(2, "[0] Processing config file /etc/"..., 42) = 42
fstat64(5, {st_mode=S_IFREG|0644, st_size=770, ...}) = 0
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x359a0000
read(5, "videodevice /dev/video1\nwebcam_p"..., 8192) = 770
read(5, "", 8192)                       = 0
close(5)                                = 0
munmap(0x359a0000, 8192)                = 0
read(3, "", 8192)                       = 0
close(3)                                = 0
munmap(0x3599e000, 8192)                = 0
time([778])                             = 778
rt_sigaction(SIGPIPE, {0x3561a30c, [], 0}, {0x3561a30c, [], SA_NOCLDWAIT}, 8) = 0
send(4, "<14>Jan  1 00:12:58 motion: [0] "..., 61, 0) = 61
rt_sigaction(SIGPIPE, {0x3561a30c, [], SA_NOCLDWAIT}, NULL, 8) = 0
write(2, "[0] Thread is from /etc/cam1.con"..., 34) = 34
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=-1}) = 0
setrlimit(RLIMIT_STACK, {rlim_cur=2040*1024, rlim_max=-1}) = 0
pipe([3, 5])                            = 0
clone(child_stack=0xbb000, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND) = 147
write(5, "B\30\10\0\5\0\0\0008\2\0\0u\241\0\0~\335\6\0K\0\0\0~\335"..., 148) = 148
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
write(5, "`1b5\0\0\0\0000\376\377\237\24>\10\0\300\337\n\0\0\0\0"..., 148) = 148
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
rt_sigsuspend([] <unfinished ...>
--- SIGRTMIN (Real-time signal 0) @ 0 (0) ---
<... rt_sigsuspend resumed> )           = 32
sigreturn()                             = ? (mask now [RTMIN])
brk(0xc0000)                            = 0xc0000
time([778])                             = 778
rt_sigaction(SIGPIPE, {0x3561a30c, [], 0}, {0x3561a30c, [], SA_NOCLDWAIT}, 8) = 0
send(4, "<14>Jan  1 00:12:58 motion: [0] "..., 61, 0) = 61
rt_sigaction(SIGPIPE, {0x3561a30c, [], SA_NOCLDWAIT}, NULL, 8) = 0
write(2, "[0] Thread is from /etc/cam2.con"..., 34) = 34
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
write(5, "`1b5\0\0\0\0000\376\377\237\24>\10\0\360\'\v\0\0\0\0\200"..., 148) = 148
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
rt_sigsuspend([] <unfinished ...>
--- SIGRTMIN (Real-time signal 0) @ 0 (0) ---
<... rt_sigsuspend resumed> )           = 32
sigreturn()                             = ? (mask now [RTMIN])
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
write(5, "`1b5\0\0\0\0000\376\377\237`\'\t\0H\301\n\0\0\0\0\200\0"..., 148) = 148
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
rt_sigsuspend([] <unfinished ...>
--- SIGRTMIN (Real-time signal 0) @ 0 (0) ---
<... rt_sigsuspend resumed> )           = 32
sigreturn()                             = ? (mask now [RTMIN])
rt_sigprocmask(SIG_BLOCK, [CHLD], [RTMIN], 8) = 0
rt_sigaction(SIGCHLD, NULL, {0x3561a30c, [], SA_NOCLDWAIT}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [RTMIN], NULL, 8) = 0
nanosleep({1, 0}, {1, 0})               = 0
rt_sigprocmask(SIG_BLOCK, [CHLD], [RTMIN], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_IGN}, 8) = 0
nanosleep({1, 0},

and here the fox board hangs.
Thanks in advance, any kind of help is much appreciated
--
Giuseppe