Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Jan 2011 15:34:13 -0500
From:      Andrew Gallatin <gallatin@gmail.com>
To:        Hans Petter Selasky <hselasky@c2i.net>
Cc:        freebsd-multimedia@freebsd.org
Subject:   Re: em28xx?
Message-ID:  <AANLkTikkBcP-CmqSgJpQP4t7Dz4iUR_UkOJogtE-Q=yi@mail.gmail.com>
In-Reply-To: <201101082130.05180.hselasky@c2i.net>
References:  <AANLkTimhh9qt1mwMk0NJ0_XP2W14azixpKD=fZYYpOpi@mail.gmail.com> <AANLkTimOtABnMgkNn9jAiThWmZ9Ec3pNQ%2Bq_GR_1Ae4h@mail.gmail.com> <201101082130.05180.hselasky@c2i.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jan 8, 2011 at 3:30 PM, Hans Petter Selasky <hselasky@c2i.net> wrot=
e:
> On Saturday 08 January 2011 20:49:59 Andrew Gallatin wrote:
>> On Sat, Jan 8, 2011 at 2:11 PM, Andrew Gallatin <gallatin@gmail.com> wro=
te:
>> > (see appended output). =A0Has anybody tried =A0this before? =A0What ar=
e the
>> > general steps for porting a driver?
>>
>> So I hacked on it for a while (see attached dirty patch) and I've got
>
> Try the attached patch.

Thanks, but it didn't work.  I think that (part) of the problem is
that the dev it
is using is not the one you're initializing.  It is using sc->ui->dev.
I tried an analogous patch to initialize that dev, and it got me much, much
further along:

@@ -403,7 +403,10 @@
                return (-ENOMEM);
        }
        ui =3D p_dev->bsd_iface_start + i;
+       ui->dev.driver_static.name =3D "webcamd";
+       ui->dev.driver =3D &ui->dev.driver_static;

+       printf("sc =3D %p\n", sc);
        sc->udrv =3D udrv;
        sc->p_dev =3D p_dev;
        sc->ui =3D ui;


The device now attaches the analog part, but I don't have
digital yet (which is what I want/need).

The problem I have now is that dvb_init() is stuck trying to acquire a mute=
x.
I don't suppose we have WITNESS for the linux code ;)

Drew

(gdb) thread apply all bt

Thread 8 (Thread 801008200 (LWP 100261)):
#0  0x0000000800cebcfc in poll () from /lib/libc.so.7
#1  0x0000000800a307fe in poll () from /lib/libthr.so.3
#2  0x000000080081d63d in libusb20_dev_wait_process () from /usr/lib/libusb=
.so.2
#3  0x0000000000407a66 in usb_exec (arg=3DVariable "arg" is not available.
) at /usr/home/gallatin/tmp/webcamd-0.1.18/kernel/linux_usb.c:185
#4  0x0000000800a2e2be in pthread_getprio () from /lib/libthr.so.3
#5  0x0000000000000000 in ?? ()
Error accessing memory address 0x7fffff3fb000: Bad address.

Thread 5 (Thread 801007c00 (LWP 100260)):
#0  0x0000000800a34d1c in pthread_kill () from /lib/libthr.so.3
#1  0x0000000800a37103 in pthread_cond_signal () from /lib/libthr.so.3
#2  0x0000000000403716 in __wait_event (q=3D0x7575e0) at
/usr/home/gallatin/tmp/webcamd-0.1.18/kernel/linux_thread.c:168
#3  0x00000000004781d5 in pvr2_context_thread_func (foo=3DVariable "foo"
is not available.
) at /usr/home/gallatin/tmp/webcamd-0.1.18/v4l-dvb/linux/drivers/media/vide=
o/pvrusb2/pvrusb2-context.c:174
#4  0x000000000040387f in kthread_wrapper (arg=3D0x801010060) at
/usr/home/gallatin/tmp/webcamd-0.1.18/kernel/linux_thread.c:443
#5  0x0000000800a2e2be in pthread_getprio () from /lib/libthr.so.3
#6  0x0000000000000000 in ?? ()
Error accessing memory address 0x7fffff7fd000: Bad address.

Thread 4 (Thread 801007900 (LWP 100259)):
#0  0x0000000800d2ff6c in nanosleep () from /lib/libc.so.7
#1  0x0000000800d2fd25 in usleep () from /lib/libc.so.7
#2  0x0000000800a30268 in usleep () from /lib/libthr.so.3
#3  0x0000000000406212 in timer_exec (arg=3DVariable "arg" is not available=
.
) at /usr/home/gallatin/tmp/webcamd-0.1.18/kernel/linux_timer.c:141
#4  0x0000000800a2e2be in pthread_getprio () from /lib/libthr.so.3
#5  0x0000000000000000 in ?? ()
Error accessing memory address 0x7fffff9fe000: Bad address.

Thread 3 (Thread 801007600 (LWP 100258)):
#0  0x0000000800a34d1c in pthread_kill () from /lib/libthr.so.3
#1  0x0000000800a37103 in pthread_cond_signal () from /lib/libthr.so.3
#2  0x0000000000405e3c in work_exec (arg=3DVariable "arg" is not available.
) at /usr/home/gallatin/tmp/webcamd-0.1.18/kernel/linux_task.c:111
#3  0x0000000800a2e2be in pthread_getprio () from /lib/libthr.so.3
#4  0x0000000000000000 in ?? ()
Error accessing memory address 0x7fffffbff000: Bad address.

Thread 2 (Thread 801007300 (LWP 100255)):
#0  0x0000000800a34d1c in pthread_kill () from /lib/libthr.so.3
#1  0x0000000800a37103 in pthread_cond_signal () from /lib/libthr.so.3
#2  0x0000000000403695 in down (sem=3D0x801208b60) at
/usr/home/gallatin/tmp/webcamd-0.1.18/kernel/linux_thread.c:307
#3  0x000000000046ef27 in dvb_init (dev=3D0x801208600) at
/usr/home/gallatin/tmp/webcamd-0.1.18/v4l-dvb/linux/drivers/media/video/em2=
8xx/em28xx-dvb.c:502
#4  0x000000000046e963 in em28xx_init_extension (dev=3D0x801208600) at
/usr/home/gallatin/tmp/webcamd-0.1.18/v4l-dvb/linux/drivers/media/video/em2=
8xx/em28xx-core.c:1230
#5  0x000000000046ca77 in em28xx_usb_probe (interface=3D0x8011c54b0,
id=3D0x6d4488) at
/usr/home/gallatin/tmp/webcamd-0.1.18/v4l-dvb/linux/drivers/media/video/em2=
8xx/em28xx-cards.c:2979
#6  0x000000000040853c in usb_linux_probe_p (p_bus=3D0x758e10,
p_addr=3D0x758e14, p_index=3D0x758e18) at
/usr/home/gallatin/tmp/webcamd-0.1.18/kernel/linux_usb.c:418
#7  0x00000000004f056f in main (argc=3D-5712, argv=3D0x7fffffffead0) at
webcamd.c:482


(gdb) frame 3
#3  0x000000000046ef27 in dvb_init (dev=3D0x801208600) at
/usr/home/gallatin/tmp/webcamd-0.1.18/v4l-dvb/linux/drivers/media/video/em2=
8xx/em28xx-dvb.c:502
502             mutex_lock(&dev->lock);
(gdb) p dev
$5 =3D (struct em28xx *) 0x801208600
(gdb) p *dev
$6 =3D {name =3D "em28xx #0", '\0' <repeats 20 times>, model =3D 76, devno =
=3D
0, chip_id =3D CHIP_ID_EM2870, v4l2_dev =3D {dev =3D 0x8011c54b0, subdevs =
=3D
{next =3D 0x801208638, prev =3D 0x801208638},
    lock =3D <incomplete type>, name =3D "webcamd ", '\0' <repeats 27
times>, notify =3D 0}, board =3D {name =3D 0x5890c8 "KWorld PlusTV 340U or
UB435-Q (ATSC)", vchannels =3D 0, tuner_type =3D 4,
    tuner_addr =3D 0, tda9887_conf =3D 0, dvb_gpio =3D 0x6d49f0,
suspend_gpio =3D 0x0, tuner_gpio =3D 0x6d4580, mute_gpio =3D 0x0, is_em2800
=3D 0, has_msp34xx =3D 0, mts_firmware =3D 0,
    max_range_640_480 =3D 0, has_dvb =3D 1, has_snapshot_button =3D 0,
is_webcam =3D 0, valid =3D 0, has_ir_i2c =3D 0, xclk =3D 39 '\'', i2c_speed=
 =3D
64 '@', radio_addr =3D 0 '\0', tvaudio_addr =3D 0,
    decoder =3D EM28XX_NODECODER, adecoder =3D EM28XX_NOADECODER, input =3D
{{type =3D 0, vmux =3D 0, amux =3D EM28XX_AMUX_VIDEO, aout =3D
EM28XX_AOUT_PCM_MIC_PCM, gpio =3D 0x0}, {type =3D 0, vmux =3D 0,
        amux =3D EM28XX_AMUX_VIDEO, aout =3D EM28XX_AOUT_PCM_MIC_PCM, gpio
=3D 0x0}, {type =3D 0, vmux =3D 0, amux =3D EM28XX_AMUX_VIDEO, aout =3D
EM28XX_AOUT_PCM_MIC_PCM, gpio =3D 0x0}, {type =3D 0,
        vmux =3D 0, amux =3D EM28XX_AMUX_VIDEO, aout =3D
EM28XX_AOUT_PCM_MIC_PCM, gpio =3D 0x0}}, radio =3D {type =3D 0, vmux =3D 0,
amux =3D EM28XX_AMUX_VIDEO, aout =3D EM28XX_AOUT_PCM_MIC_PCM,
      gpio =3D 0x0}, ir_codes =3D 0x0}, em28xx_sensor =3D EM28XX_NOSENSOR,
sensor_xres =3D 0, sensor_yres =3D 0, sensor_xtal =3D 0, progressive =3D 0,
vinmode =3D 16, vinctl =3D 17,
  has_audio_class =3D 0, has_alsa_audio =3D 0, format =3D 0x6d4ca0, ir =3D
0x0, wait_after_write =3D 0, devlist =3D {next =3D 0x6d4a90, prev =3D
0x6d4a90}, i2s_speed =3D 0, audio_mode =3D {
    ac97 =3D EM28XX_NO_AC97, ac97_feat =3D 0, ac97_vendor_id =3D 0,
has_audio =3D 0, i2s_3rates =3D 0, i2s_5rates =3D 0}, tuner_type =3D 4,
tuner_addr =3D 0, tda9887_conf =3D 0, i2c_adap =3D {
    owner =3D 0x0, id =3D 65567, class =3D 0, algo =3D 0x6d4c60, algo_data =
=3D
0x801208600, level =3D 0 '\0', bus_lock =3D {sem =3D {value =3D 1}}, timeou=
t =3D
1000, retries =3D 0, dev =3D {minor =3D 0,
      busnum =3D 0, kobj =3D <incomplete type>, refcount =3D {refcount =3D
{counter =3D 1}}, release =3D 0, driver =3D 0x0, parent =3D 0x8011c4b00,
driver_data =3D 0x801208630, fops =3D 0x0, cdev =3D 0x0,
      class =3D 0x0, driver_static =3D {name =3D 0x0, owner =3D 0x0}, devt =
=3D
0, name =3D "i2c-129", '\0' <repeats 56 times>, bus_name =3D '\0' <repeats
31 times>,
      bus_id =3D '\0' <repeats 31 times>}, nr =3D 129, name =3D "em28xx #0"=
,
'\0' <repeats 38 times>, dev_released =3D {done =3D 0, wait =3D {sleep_ref =
=3D
0, sleep_count =3D 0}}}, i2c_client =3D {
    flags =3D 0, addr =3D 80, name =3D "em28xx internal\000\000\000\000",
adapter =3D 0x8012087a8, driver =3D 0x0, dev =3D {minor =3D 0, busnum =3D 0=
,
kobj =3D <incomplete type>, refcount =3D {
        refcount =3D {counter =3D 0}}, release =3D 0, driver =3D 0x0, paren=
t =3D
0x0, driver_data =3D 0x0, fops =3D 0x0, cdev =3D 0x0, class =3D 0x0,
driver_static =3D {name =3D 0x0, owner =3D 0x0},
      devt =3D 0, name =3D '\0' <repeats 63 times>, bus_name =3D '\0'
<repeats 31 times>, bus_id =3D '\0' <repeats 31 times>}, irq =3D 0,
detected =3D {next =3D 0x0, prev =3D 0x0}}, users =3D 0,
  vdev =3D 0x80124a180, norm =3D 255, ctl_freq =3D 0, ctl_input =3D 0,
ctl_ainput =3D 0, ctl_aoutput =3D 1, mute =3D 1, volume =3D 31, width =3D 7=
20,
height =3D 576, hscale =3D 0, vscale =3D 0,
  interlaced =3D 1, video_bytesread =3D 0, hash =3D 680043282, i2c_hash =3D=
 0,
adev =3D {name =3D '\0' <repeats 49 times>, transfer_buffer =3D {0x0, 0x0,
0x0, 0x0, 0x0}, urb =3D {0x0, 0x0, 0x0, 0x0,
      0x0}, udev =3D 0x0, capture_transfer_done =3D 0,
capture_pcm_substream =3D 0x0, hwptr_done_capture =3D 0, sndcard =3D 0x0,
users =3D 0, capture_stream =3D STREAM_OFF,
    slock =3D <incomplete type>}, state =3D 0, io =3D IO_NONE, capture_type
=3D 0, vbi_read =3D 0, cur_field =3D 0 '\0', vbi_width =3D 720, vbi_height =
=3D
18, request_module_wk =3D {entry =3D {
      tqe_next =3D 0x0, tqe_prev =3D 0x0}, func =3D 0}, lock =3D {sem =3D {=
value
=3D 0}}, ctrl_urb_lock =3D {sem =3D {value =3D 1}}, inqueue =3D {next =3D 0=
x0,
prev =3D 0x0}, outqueue =3D {next =3D 0x0,
    prev =3D 0x0}, open =3D {sleep_ref =3D 0, sleep_count =3D 0}, wait_fram=
e =3D
{sleep_ref =3D 0, sleep_count =3D 0}, wait_stream =3D {sleep_ref =3D 0,
sleep_count =3D 0}, vbi_dev =3D 0x0,
  radio_dev =3D 0x0, resources =3D 0,
  eedata =3D "\032=EBg\225\200\033@=A3=C0\023k\020j\"\000\000\000\000\004W\=
000\r\000\000\000\000\000\000\000\000\000\000D\000\000\000=F0\020\001\000\0=
00\000\000\000[\034=C0\000\000\000
@ \200\002 \001\001", '\0' <repeats 48 times>, "\"\003U\000S\000B\000
\0002\0008\0007\0000\000 \000D\000e\000v\000i\000c\000e", '\0'
<repeats 118 times>, vidq =3D {active =3D {next =3D 0x801208cb8,
      prev =3D 0x801208cb8}, queued =3D {next =3D 0x801208cc8, prev =3D
0x801208cc8}, wq =3D {sleep_ref =3D 0, sleep_count =3D 0}, pos =3D 0}, vbiq=
 =3D
{active =3D {next =3D 0x801208ce8,
      prev =3D 0x801208ce8}, queued =3D {next =3D 0x801208cf8, prev =3D
0x801208cf8}, wq =3D {sleep_ref =3D 0, sleep_count =3D 0}, pos =3D 0},
isoc_ctl =3D {max_pkt_size =3D 0, num_bufs =3D 0, urb =3D 0x0,
    transfer_buffer =3D 0x0, cmd =3D 0 '\0', pos =3D 0, size =3D 0, pktsize=
 =3D
0, field =3D 0, tmp_buf =3D 0, tmp_buf_len =3D 0, vid_buf =3D 0x0, vbi_buf =
=3D
0x0, nfields =3D 0, isoc_copy =3D 0},
  slock =3D <incomplete type>, udev =3D 0x8011c4b00, alt =3D 6, max_pkt_siz=
e
=3D 2892, num_alt =3D 8, alt_max_pkt_size =3D 0x801164b00, urb =3D {0x0, 0x=
0,
0x0, 0x0, 0x0}, transfer_buffer =3D {0x0,
    0x0, 0x0, 0x0, 0x0}, urb_buf =3D '\0' <repeats 79 times>,
em28xx_write_regs =3D 0x46d4c0 <em28xx_write_regs>, em28xx_read_reg =3D
0x46d960 <em28xx_read_reg>,
  em28xx_read_reg_req_len =3D 0x46d740 <em28xx_read_reg_req_len>,
em28xx_write_regs_req =3D 0x46d320 <em28xx_write_regs_req>,
em28xx_read_reg_req =3D 0x46d930 <em28xx_read_reg_req>,
  mode =3D EM28XX_SUSPEND, reg_gpo_num =3D 4, reg_gpio_num =3D 8, reg_gpo =
=3D
0 '\0', reg_gpio =3D 16 '\020', snapshot_button_path =3D '\0' <repeats 29
times>, sbutton_input_dev =3D 0x0,
  sbutton_query_work =3D {work =3D {entry =3D {tqe_next =3D 0x0, tqe_prev =
=3D
0x0}, func =3D 0}, timer =3D {entry =3D {tqe_next =3D 0x0, tqe_prev =3D 0x0=
},
function =3D 0, expires =3D 0, data =3D 0}},
  dvb =3D 0x80101f700}
(gdb) p dev->lock
$7 =3D {sem =3D {value =3D 0}}


Thanks,

Drew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikkBcP-CmqSgJpQP4t7Dz4iUR_UkOJogtE-Q=yi>