Re: Coordinating concurrent users of v4l2 devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hello all,

Ronald wrote:
> apps that open using O_EXCL for longer than a second should be murdered
> ('kill' is something different here) instantly, but it's just

Even when the device is locked only for a second: when a recording
starts during that time, it will fail (unless all recorders are made
smart enough to attempt the open more than once)

Under certain circumstances nxtvepg can switch channels about every
30 seconds (e.g. when all data from all channels is loaded and it's
waiting for a new transmission on any channel), hence a collision
isn't that unlikely.


Gerd wrote:
> Software trying to be more clever than the user is IMHO a bad idea ...

That's not what I meant (I have used M$ Windows often enough to be
tired of stupid automatisms, too).  I meant that the record application
could feature a checkbutton "lock channel during recording" which the
user could optionally enable.  Even my old analog TV set does have
such a feature.  By default a recording would have the same priority
as any other app (see my original posting)


> I think with open(O_EXCL) it would work if you close the device before
> attempting to switch the tv station, i.e. like this:

1. Currently nxtvepg is polling the v4l1 video device via open()
to find out when the TV app has terminated.  But it's still
capturing data when the user happens to have tuned a provider's
channel during that time.  However if it had to close the VBI device
for every attempt to switch the channel, it would spend most of the
time just with resynchronizing to the data stream.

2. In nxtvepg, channel switches are controlled by a different
process/thread than the one which captures VBI. Closing and
re-opening the vbi device would basically mean to completely
halt and restart acquisition.  Not very elegant IMHO.


Since nobody seems to like the priorities, can't we go back to the
very first proposal, i.e. a simple query if there are any other users
on that device and just find a way around the race condition?
(i.e. some kind of global counter which is incremented whenever
the device is opened; when a user puts the device in "SOFT-EXCL"
mode a copy of the counter is made; all subsequent ioctls fail if
the copy doesn't match the counter anymore)

I'd prefer this solution 1. because it's non-intrusive (in contrast
to opening the device with O_EXCL) and 2. it's very low overhead to
implement on application level (don't know about driver level)

bye,
-tom





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux