[mythtv-commits] Ticket #9191: Channel switching doesn't work with cx18 driver

MythTV mythtv at cvs.mythtv.org
Sun Nov 7 01:13:23 UTC 2010

#9191: Channel switching doesn't work with cx18 driver
 Reporter:  Artem Astafyev          |            Type:  defect          
   Status:  new                     |        Priority:  minor           
Milestone:  unknown                 |       Component:  MythTV - General
  Version:  0.23.1                  |        Severity:  medium          
 Keywords:  cx18 SetInputAndFormat  |   Ticket locked:  0               
 I can successfully tune any analog channel but when I try to switch to any
 other channel I get such error:

 2010-11-06 20:51:27.840 TVRec(1): Recorder paused, calling TuningFrequency
 2010-11-06 20:51:27.858 Channel(/dev/video0)::SwitchToInput(in 1, '')
 2010-11-06 20:51:27.876 Channel(/dev/video0): SetInputAndFormat(1,
 SECAM-D) (v4l v2)
 2010-11-06 20:51:27.885 Channel(/dev/video0) Error: SetInputAndFormat(1,
                         while setting format (v4l v2)
                         eno: Device or resource busy (16)
 2010-11-06 20:51:27.893 Channel(/dev/video0): SetInputAndFormat() failed
 2010-11-06 20:51:27.901 TVRec(1) Error: Failed to set channel to 32.
 Reverting to kState_None

 I get this error only with cx18 driver. After investigating libmythtv code
 and cx18 driver I found the cause. Here is cut from cx18 driver's function
 that is called from S_STD ioctl:

         if (test_bit(CX18_F_I_RADIO_USER, &cx->i_flags) ||
             atomic_read(&cx->ana_capturing) > 0) {
                 /* Switching standard would turn off the radio or mess
                    with already running streams, prevent that by
                    returning EBUSY. */
                 return -EBUSY;

 cx->ana_capturing is atomic_t which increased every time
 V4L2_ENC_CMD_START ioctl is called and decreased on V4L2_ENC_CMD_STOP
 ioctl. In addition it seems that cx18 driver has no STREAMOFF ioctl so
 workaround which is used for ConvertX doesn't work: I get EINVAL.
 I'm not so familiar with mythtv coding or v4l2 but I feel that fix should
 be simple.
 I can provide any additional info or test fix if you need.

Ticket URL: <http://svn.mythtv.org/trac/ticket/9191>
MythTV <http://www.mythtv.org/>
MythTV Media Center

More information about the mythtv-commits mailing list