V4l api - need some help getting dvb devices to work

Da Rock freebsd-multimedia at herveybayaustralia.com.au
Fri Oct 9 10:22:25 UTC 2015


On 08/10/2015 21:00, Hans Petter Selasky wrote:
> On 10/07/15 04:41, Da Rock wrote:
>> Could anyone provide some guidance on what is wrong here? Have I not got
>> the concept correctly? Where could I find some good tutorials on v4l?
>
> Maybe you can "ktrace" your application, to see if any IOCTLs fail.
>
I've done that, but I can't see anything myself. I will admit I'm not 
familiar with working with devices as yet, and definitely only just 
learning v4l - so I'm not 100% sure of what I should be seeing. However, 
all things being equal I'd say the IOCTLs are not failing (RET 0?).

% kdump
  72345 ktrace   RET   ktrace 0
  72345 ktrace   CALL execve(0x7fffffffed67,0x7fffffffeb08,0x7fffffffeb18)
  72345 ktrace   NAMI  "./a.out"
  72345 ktrace   NAMI  "/libexec/ld-elf.so.1"
  72345 a.out    RET   execve 0
  72345 a.out    CALL 
mmap(0,0x8000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
  72345 a.out    RET   mmap 34366144512/0x80061c000
  72345 a.out    CALL  issetugid
  72345 a.out    RET   issetugid 0
  72345 a.out    CALL  lstat(0x800620000,0x7fffffffd328)
  72345 a.out    NAMI  "/etc"
  72345 a.out    STRU  struct stat {dev=138, ino=131074, mode=040755, 
nlink=23, uid=0, gid=0, rdev=266218, atime=1433718706, stime=1440643717, 
ctime=1440643717, birthtime=1415739822, size=2560, blksize=32768, 
blocks=8, flags=0x0 }
  72345 a.out    RET   lstat 0
  72345 a.out    CALL  lstat(0x800620000,0x7fffffffd328)
  72345 a.out    NAMI  "/etc/libmap.conf"
  72345 a.out    STRU  struct stat {dev=138, ino=131201, mode=0100644, 
nlink=1, uid=0, gid=0, rdev=275903, atime=1444377767, stime=1415739822, 
ctime=1433718724, birthtime=1415739822, size=109, blksize=32768, 
blocks=8, flags=0x0 }
  72345 a.out    RET   lstat 0
  72345 a.out    CALL open(0x800620000,0x100000<O_CLOEXEC>,<unused>0x3f0)
  72345 a.out    NAMI  "/etc/libmap.conf"
  72345 a.out    RET   open 3
  72345 a.out    CALL  fstat(0x3,0x7fffffffdfe0)
  72345 a.out    STRU  struct stat {dev=138, ino=131201, mode=0100644, 
nlink=1, uid=0, gid=0, rdev=275903, atime=1444377767, stime=1415739822, 
ctime=1433718724, birthtime=1415739822, size=109, blksize=32768, 
blocks=8, flags=0x0 }
  72345 a.out    RET   fstat 0
  72345 a.out    CALL mmap(0,0x6d,0x1<PROT_READ>,0x2<MAP_PRIVATE>,0x3,0)
  72345 a.out    RET   mmap 34366177280/0x800624000
  72345 a.out    CALL  close(0x3)
  72345 a.out    RET   close 0
  72345 a.out    CALL  lstat(0x800620800,0x7fffffffc6b8)
  72345 a.out    NAMI  "/usr"
  72345 a.out    STRU  struct stat {dev=144, ino=2, mode=040755, 
nlink=18, uid=0, gid=0, rdev=13280, atime=1433718748, stime=1444106817, 
ctime=1444106817, birthtime=1415739783, size=1024, blksize=32768, 
blocks=8, flags=0x0 }
  72345 a.out    RET   lstat 0
  72345 a.out    CALL  lstat(0x800620800,0x7fffffffc6b8)
  72345 a.out    NAMI  "/usr/local"
  72345 a.out    STRU  struct stat {dev=144, ino=1284096, mode=040755, 
nlink=18, uid=0, gid=0, rdev=2569536, atime=1433718706, 
stime=1440563559, ctime=1440563616, birthtime=1415739783, size=512, 
blksize=32768, blocks=8, flags=0x0 }
  72345 a.out    RET   lstat 0
  72345 a.out    CALL  lstat(0x800620800,0x7fffffffc6b8)
  72345 a.out    NAMI  "/usr/local/etc"
  72345 a.out    STRU  struct stat {dev=144, ino=1305510, mode=040755, 
nlink=29, uid=0, gid=0, rdev=2619197, atime=1433836045, 
stime=1440643717, ctime=1440643717, birthtime=1433684338, size=1536, 
blksize=32768, blocks=8, flags=0x0 }
  72345 a.out    RET   lstat 0
  72345 a.out    CALL  lstat(0x800620800,0x7fffffffc6b8)
  72345 a.out    NAMI  "/usr/local/etc/libmap.d"
  72345 a.out    RET   lstat -1 errno 2 No such file or directory
  72345 a.out    CALL  munmap(0x800624000,0x6d)
  72345 a.out    RET   munmap 0
  72345 a.out    CALL open(0x8006168b3,0x100000<O_CLOEXEC>,<unused>0x61f000)
  72345 a.out    NAMI  "/var/run/ld-elf.so.hints"
  72345 a.out    RET   open 3
  72345 a.out    CALL  read(0x3,0x7fffffffd818,0x80)
  72345 a.out    GIO   fd 3 read 128 bytes
        0x0000 4568 6e74 0100 0000 8000 0000 0101 0000 |Ehnt............|
        0x0010 0000 0000 0001 0000 0000 0000 0000 0000 |................|
        0x0020 0000 0000 0000 0000 0000 0000 0000 0000 |................|
        0x0030 0000 0000 0000 0000 0000 0000 0000 0000 |................|
        0x0040 0000 0000 0000 0000 0000 0000 0000 0000 |................|
        0x0050 0000 0000 0000 0000 0000 0000 0000 0000 |................|
        0x0060 0000 0000 0000 0000 0000 0000 0000 0000 |................|
        0x0070 0000 0000 0000 0000 0000 0000 0000 0000 |................|
  72345 a.out    RET   read 128/0x80
  72345 a.out    CALL  lseek(0x3,0x80,SEEK_SET)
  72345 a.out    RET   lseek 128/0x80
  72345 a.out    CALL  read(0x3,0x800621000,0x101)
  72345 a.out    GIO   fd 3 read 257 bytes
"/lib:/usr/lib:/usr/lib/compat:/usr/local/lib:/usr/local/lib/compat/pkg\
:/usr/local/lib/gcc48:/usr/local/lib/libav:/usr/local/lib/mysql:/usr/l\
ocal/lib/mythtv/filters:/usr/local/lib/mythtv/plugins:/usr/local/lib/q\
     t4:/usr/local/llvm33/lib:/usr/local/llvm35/lib\0"
  72345 a.out    RET   read 257/0x101
  72345 a.out    CALL  close(0x3)
  72345 a.out    RET   close 0
  72345 a.out    CALL  access(0x800620800,0<F_OK>)
  72345 a.out    NAMI  "/lib/libc.so.7"
  72345 a.out    RET   access 0
  72345 a.out    CALL open(0x80061d060,0x100000<O_CLOEXEC>,<unused>0x6207f8)
  72345 a.out    NAMI  "/lib/libc.so.7"
  72345 a.out    RET   open 3
  72345 a.out    CALL  fstat(0x3,0x7fffffffd8f0)
  72345 a.out    STRU  struct stat {dev=138, ino=131107, mode=0100444, 
nlink=1, uid=0, gid=0, rdev=274288, atime=1444377767, 
stime=1415739783.572505000, ctime=1433718724, 
birthtime=1415739783.572505000, size=1631216, blksize=32768, 
blocks=3264, flags=0x20000 }
  72345 a.out    RET   fstat 0
  72345 a.out    CALL 
mmap(0,0x1000,0x1<PROT_READ>,0x40002<MAP_PRIVATE|MAP_PREFAULT_READ>,0x3,0)
  72345 a.out    RET   mmap 34366177280/0x800624000
  72345 a.out    CALL 
mmap(0,0x3a9000,0<PROT_NONE>,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)
  72345 a.out    RET   mmap 34368249856/0x80081e000
  72345 a.out    CALL 
mmap(0x80081e000,0x174000,0x5<PROT_READ|PROT_EXEC>,0x60012<MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ>,0x3,0)
  72345 a.out    RET   mmap 34368249856/0x80081e000
  72345 a.out    CALL 
mmap(0x800b91000,0xd000,0x3<PROT_READ|PROT_WRITE>,0x40012<MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ>,0x3,0x173000)
  72345 a.out    RET   mmap 34371866624/0x800b91000
  72345 a.out    CALL 
mmap(0x800b9e000,0x29000,0x3<PROT_READ|PROT_WRITE>,0x1012<MAP_PRIVATE|MAP_FIXED|MAP_ANON>,0xffffffff,0)
  72345 a.out    RET   mmap 34371919872/0x800b9e000
  72345 a.out    CALL  munmap(0x800624000,0x1000)
  72345 a.out    RET   munmap 0
  72345 a.out    CALL  close(0x3)
  72345 a.out    RET   close 0
  72345 a.out    CALL 
mmap(0,0x19000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
  72345 a.out    RET   mmap 34366177280/0x800624000
  72345 a.out    CALL  sysarch(0x81,0x7fffffffe098)
  72345 a.out    RET   sysarch 0
  72345 a.out    CALL sigprocmask(SIG_BLOCK,0x80081d4d8,0x7fffffffe050)
  72345 a.out    RET   sigprocmask 0
  72345 a.out    CALL  sigprocmask(SIG_SETMASK,0x80081d4ec,0)
  72345 a.out    RET   sigprocmask 0
  72345 a.out    CALL  readlink(0x80096953e,0x7fffffffd7c0,0x400)
  72345 a.out    NAMI  "/etc/malloc.conf"
  72345 a.out    RET   readlink -1 errno 2 No such file or directory
  72345 a.out    CALL  issetugid
  72345 a.out    RET   issetugid 0
  72345 a.out    CALL 
mmap(0,0x400000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
  72345 a.out    RET   mmap 34372087808/0x800bc7000
  72345 a.out    CALL  munmap(0x800bc7000,0x400000)
  72345 a.out    RET   munmap 0
  72345 a.out    CALL 
mmap(0,0x7ff000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
  72345 a.out    RET   mmap 34372087808/0x800bc7000
  72345 a.out    CALL  munmap(0x800bc7000,0x39000)
  72345 a.out    RET   munmap 0
  72345 a.out    CALL  munmap(0x801000000,0x3c6000)
  72345 a.out    RET   munmap 0
  72345 a.out    CALL sigprocmask(SIG_BLOCK,0x80081d4d8,0x7fffffffdbe0)
  72345 a.out    RET   sigprocmask 0
  72345 a.out    CALL  sigprocmask(SIG_SETMASK,0x80081d4ec,0)
  72345 a.out    RET   sigprocmask 0
  72345 a.out    CALL sigprocmask(SIG_BLOCK,0x80081d4d8,0x7fffffffdbe0)
  72345 a.out    RET   sigprocmask 0
  72345 a.out    CALL  sigprocmask(SIG_SETMASK,0x80081d4ec,0)
  72345 a.out    RET   sigprocmask 0
  72345 a.out    CALL open(0x400c86,0x2<O_RDWR>,<unused>0xffffeb10)
  72345 a.out    NAMI  "/dev/dvb/adapter0/frontend0"
  72345 a.out    RET   open 3
  72345 a.out    CALL open(0x400ca2,0x2<O_RDWR>,<unused>0xffffeb10)
  72345 a.out    NAMI  "/dev/dvb/adapter0/demux0"
  72345 a.out    RET   open 4
  72345 a.out    CALL  ioctl(0x3,0x80106f52,0x601250)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  fstat(0x1,0x7fffffffe500)
  72345 a.out    STRU  struct stat {dev=1895890688, ino=155, 
mode=020622, nlink=1, uid=1001, gid=4, rdev=155, atime=1444377767, 
stime=1444377767, ctime=1444377767, birthtime=-1, size=0, blksize=4096, 
blocks=0, flags=0x0 }
  72345 a.out    RET   fstat 0
  72345 a.out    CALL 
mmap(0,0x400000,0x3<PROT_READ|PROT_WRITE>,0x1002<MAP_PRIVATE|MAP_ANON>,0xffffffff,0)
  72345 a.out    RET   mmap 34376515584/0x801000000
  72345 a.out    CALL  ioctl(0x1,TIOCGETA,0x7fffffffe4b0)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  write(0x1,0x801006000,0xd)
  72345 a.out    GIO   fd 1 wrote 13 bytes
        "Frontend set
        "
  72345 a.out    RET   write 13/0xd
  72345 a.out    CALL  ioctl(0x4,0x20006f2d,0x640000)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  ioctl(0x4,0x80146f2c,0x7fffffffea78)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  ioctl(0x4,0x20006f29,0x7fffffffea78)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  ioctl(0x3,0x40046f45,0x7fffffffea54)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  ioctl(0x3,0x40026f47,0x7fffffffea50)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  ioctl(0x3,0x40026f48,0x7fffffffea52)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  ioctl(0x3,0x40046f46,0x7fffffffea4c)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  ioctl(0x3,0x40046f49,0x7fffffffea48)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  write(0x1,0x801006000,0x48)
  72345 a.out    GIO   fd 1 wrote 72 bytes
        "status 1b | signal  69% | snr   0% | ber 2097151 | unc 17 | 
FE_HAS_LOC\
     K
        "
  72345 a.out    RET   write 72/0x48
  72345 a.out    CALL  nanosleep(0x7fffffffea28,0x7fffffffea18)
  72345 a.out    RET   nanosleep 0
  72345 a.out    CALL  ioctl(0x3,0x40046f45,0x7fffffffea54)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  ioctl(0x3,0x40026f47,0x7fffffffea50)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  ioctl(0x3,0x40026f48,0x7fffffffea52)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  ioctl(0x3,0x40046f46,0x7fffffffea4c)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  ioctl(0x3,0x40046f49,0x7fffffffea48)
  72345 a.out    RET   ioctl 0
  72345 a.out    CALL  write(0x1,0x801006000,0x41)
  72345 a.out    GIO   fd 1 wrote 65 bytes
        "status 1f | signal  69% | snr   0% | ber 0 | unc 0 | FE_HAS_LOCK
        "
         "
  72345 a.out    RET   write 65/0x41
  72345 a.out    CALL  nanosleep(0x7fffffffea28,0x7fffffffea18)
  72345 a.out    RET   nanosleep -1 errno 4 Interrupted system call
  72345 a.out    PSIG  SIGINT SIG_DFL code=SI_KERNEL


And running cat on the dvr:

% kdump -f read.log
  71012 cat      GIO   fd 3 read 128 bytes
        0x0000 4568 6e74 0100 0000 8000 0000 0101 0000 |Ehnt............|
        0x0010 0000 0000 0001 0000 0000 0000 0000 0000 |................|
        0x0020 0000 0000 0000 0000 0000 0000 0000 0000 |................|
        0x0030 0000 0000 0000 0000 0000 0000 0000 0000 |................|
        0x0040 0000 0000 0000 0000 0000 0000 0000 0000 |................|
        0x0050 0000 0000 0000 0000 0000 0000 0000 0000 |................|
        0x0060 0000 0000 0000 0000 0000 0000 0000 0000 |................|
        0x0070 0000 0000 0000 0000 0000 0000 0000 0000 |................|
  71012 cat      GIO   fd 3 read 257 bytes
"/lib:/usr/lib:/usr/lib/compat:/usr/local/lib:/usr/local/lib/compat/pkg\
:/usr/local/lib/gcc48:/usr/local/lib/libav:/usr/local/lib/mysql:/usr/l\
ocal/lib/mythtv/filters:/usr/local/lib/mythtv/plugins:/usr/local/lib/q\
     t4:/usr/local/llvm33/lib:/usr/local/llvm35/lib\0"

Anything I'm missing?


More information about the freebsd-multimedia mailing list