Re: [linux-dvb] USBVision device defaults

2009-07-02 Thread Tim Williams

On Wed, 1 Jul 2009, Andy Walls wrote:


It's unclear to me if the PowerOnAtOpen module parameter works properly
when set to 0.  It might actually prevent the automatic shutoff in 3
seconds if set to zero.


I hadn't spotted that option, it does seem to work and enables the device 
to stay active after the programme using it has exited, preserving the 
settings. With PowerOnAtOpen=0, using the normal unmodified driver, I can't 
get a picture using either flash or kdetv. However, using my bodged driver 
which forces use of the SVideo input, I can now get a colour picture in 
flash by starting and exiting kdetv first. Odd, but it does at least 
provide a workable solution to my problem.



Also, by inspection I think the driver has a bug you may be able to
exploit.  If you already have the driver open with an application,
trying to open it with another application will fail, but not before
reseting the poweroff timer back to three seconds.  So if you have an
app that attempts to open() and close() the usbvision device node every
1 second, I think you can keep it from powering down and losing it's
settings.

Here's a useless little program to do just that.  Compile it and invoke
it as 'program-name /dev/video0'


I gave the code a try, it works up to a point, I get a colour picture in 
flash, but the picture is frozen. I suspect your programme is grabbing 
the video device back from flash before I can kill it.


Thankyou for your help ! If anybody on this list decides to try and neaten 
up the code for the usbvision driver, I'm happy to do a bit of testing 
work (contant me on t...@autotrain.org, I may not stay subscribed to this 
email list permanantly).


Tim W

--
Tim Williams BSc MSc MBCS
Euromotor Autotrain LLP
58 Jacoby Place
Priory Road
Edgbaston
Birmingham
B5 7UW
United Kingdom

Web : http://www.autotrain.org
Tel : +44 (0)121 414 2214

EuroMotor-AutoTrain is a company registered in the UK, Registration
number: OC317070.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-dvb] USBVision device defaults

2009-07-01 Thread Andy Walls
On Mon, 2009-06-29 at 14:04 +0100, Tim Williams wrote:
> On Mon, 29 Jun 2009, Andy Walls wrote:
> 
> > According to the V4L2 specification for the close() call, all devices
> > should remember their settings.
> >
> > There have been recent discussions on devices that do power management
> > not saving the RF tuner freq after the final close() (and what to do
> > about it), but the last input and standard should be preserved.  (Note,
> > I have not looked at the usbvision driver to look for problems.)
> 
> It would appear that the usbvision driver isn't following the spec. As I 
> mentioned in my earlier message, there is an LED which indicates that the 
> box is active. Under windows this comes on and stays on after the first 
> use, until reboot. Under linux it always goes off when the programme using 
> the device exits.

I just looked at the usbvision driver - ugh.  It uses the big kernel
lock - not good.  Only a single open at a time - inconvenient.  Powers
off in <= 3 seconds (hardcoded) after close if the "PowerOnAtOpen"
module parameter is set to 1 (the default) - not useful.  I think the 3
seconds isn't guaranteed; it might be anywhere from 0 to 3 seconds.

It's unclear to me if the PowerOnAtOpen module parameter works properly
when set to 0.  It might actually prevent the automatic shutoff in 3
seconds if set to zero.

Also, by inspection I think the driver has a bug you may be able to
exploit.  If you already have the driver open with an application,
trying to open it with another application will fail, but not before
reseting the poweroff timer back to three seconds.  So if you have an
app that attempts to open() and close() the usbvision device node every
1 second, I think you can keep it from powering down and losing it's
settings.

Here's a useless little program to do just that.  Compile it and invoke
it as 'program-name /dev/video0'


#include 
#include 
#include 
#include 
#include 

int main(int argc, char *argv[])
{
int fd;

if (argc < 2)
exit(1);

for (;;) {
fd = open (argv[1], O_RDONLY);
if (fd >= 0)
close(fd);
sleep(1);
}
exit(0);
}


Using it, you hopefully can use v4l2-ctl to set the input and have it
preserved.

The usbvision driver really needs some work to allow preserving settings
and/or multiple opens.

Regards,
Andy



> > What precise WinTV USB device/verision are you using?
> 
> >From lsusb :
> 
> Bus 002 Device 002: ID 0573:4d22 Zoran Co. Personal Media Division 
> (Nogatech) Hauppauge WinTV-USB II (PAL) Model 566
> 
> > Try something like:
> >
> > $ v4l2-ctl --help
> > $ v4l2-ctl -d /dev/video0 --log-status
> > $ v4l2-ctl -d /dev/video0 --list-inputs
> > $ v4l2-ctl -d /dev/video0 --set-input=2
> > $ v4l2-ctl -d /dev/video0 --log-status
> 
> [r...@saucy ~]# v4l2-ctl -d /dev/video0 --log-status
> [r...@saucy ~]# v4l2-ctl -d /dev/video0 --list-inputs
> ioctl: VIDIOC_ENUMINPUT
>  Input   : 0
>  Name: Television
>  Type: 0x0001
>  Audioset: 0x0001
>  Tuner   : 0x
>  Standard: 0x00FFB1FF ( PAL NTSC SECAM )
>  Status  : 0
> 
>  Input   : 1
>  Name: Composite Video Input
>  Type: 0x0002
>  Audioset: 0x
>  Tuner   : 0x
>  Standard: 0x00FF ( PAL )
>  Status  : 0
> 
>  Input   : 2
>  Name: S-Video Input
>  Type: 0x0002
>  Audioset: 0x
>  Tuner   : 0x
>  Standard: 0x00FF ( PAL )
>  Status  : 0
> [r...@saucy ~]# v4l2-ctl -d /dev/video0 --set-input=2
> Video input set to 2 (S-Video Input)
> [r...@saucy ~]# v4l2-ctl -d /dev/video0 --log-status
> [r...@saucy ~]#
> 
> Each of these commands causes the following messages to be repeated in 
> /var/log/messages
> 
> Jun 29 13:43:06 saucy kernel: saa7115' 1-0025: saa7113 found 
> (1f7113d0e10) @ 0x4a (usbvision #0)
> Jun 29 13:43:08 saucy kernel: tuner' 1-0061: chip found @ 0xc2 (usbvision 
> #0)
> Jun 29 13:43:08 saucy kernel: tuner-simple 1-0061: creating new instance
> Jun 29 13:43:08 saucy kernel: tuner-simple 1-0061: type set to 5 (Philips 
> PAL_BG (FI1216 and compatibles))
> Jun 29 13:43:12 saucy kernel: tuner-simple 1-0061: destroying instance
> 
> I'm currently using kernel 2.6.27.21-desktop-1mnb on Mandriva 2009.0.
> 
> Tim W
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-dvb] USBVision device defaults

2009-06-30 Thread Tim Williams

On Mon, 29 Jun 2009, Thierry MERLE wrote:


I remember a guy that did the trick with the vloopback device.
Searching a bit on the Internet, it seems that flashcam
http://www.swift-tools.net/Flashcam/ can be convenient for your needs.


Looks like a useful tool, it certainly keeps the video device active.

Unfortunatly it doesn't really solve my problem, since it still starts the 
usbvision device up with default settings and the vloopback device dosn't 
seem to support pushing through config parameters set using v4ctl to the 
original underlying video device.


It does however fix another problem I had which was that flash caused 
firefox to freeze when you exit the page containing the flash webcam 
applet.


Tim W

--
Tim Williams BSc MSc MBCS
Euromotor Autotrain LLP
58 Jacoby Place
Priory Road
Edgbaston
Birmingham
B5 7UW
United Kingdom

Web : http://www.autotrain.org
Tel : +44 (0)121 414 2214

EuroMotor-AutoTrain is a company registered in the UK, Registration
number: OC317070.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-dvb] USBVision device defaults

2009-06-29 Thread Thierry MERLE
Hi Tim,

On Mon, 29 Jun 2009 11:34:50 +0100 (BST)
Tim Williams  wrote:

> 
> Hello,
> 
> I'm trying use a WinTV USB adaptor which uses the usbvision driver to 
> capture the output of a video camera for streaming across the web, the 
> idea being that there is a reliable local recording, even in the event of 
> a computer crash, while allowing the remote viewers to see the proceedings 
> live without needing to have two separate cameras.
> 
> Unfortunately there is a catch, i'm using flash to do the broadcast 
> and flash (in common with a lot of other software of this type) doesn't 
> have the ability to set the input type and picture format, so you are 
> stuck with the default, which is the rf-tuner. I have managed to make my 
> own bodged driver which disables the rf-input so that I can get a picture 
> via s-video, but it is stubbornly stuck in black and white, which i'm 
> assuming is some kind of colour format problem.
> 
> If I use KDETV to look at the picture then everything comes through in 
> colour, so this would seem to be a problem with the defaults built into 
> the module being incorrect for my circumstances. Rather than carrying on 
> with my bodged driver (this is the first time I have ever attempted to 
> modify a C programme), what would be really great is away to achieve one 
> of the following :
> 
> 1) Set the default input, tv standard and pixel format using module 
> parameters in modprobe.conf
> 2) Get the driver to 'remember' it's current settings when switching 
> between applications. The windows driver for these devices does this, so 
> all I have to do under windows is start up WinTV, make sure I have a good 
> picture, close it down again and then start up the video broadcast in 
> flash.
> 3) A way to change the device settings using a 3rd party app even when the 
> main video device is in use and can't be accessed. I've tried using v4lctl 
> to set the parameters before starting a capture, but if the flash capture 
> is active, then I (unsurprisingly) get device in use errors. If I use v4lctl 
> before starting flash, then the settings don't stick. The capture box becomes 
> active briefly (there is a red light on the box which indicates this), 
> presumably accepts the setting and is then powered down again, causing 
> the new setting to be immediately forgotten.
> 
> Any thoughts or help would be much appreciated.
> 
I remember a guy that did the trick with the vloopback device.
Searching a bit on the Internet, it seems that flashcam 
http://www.swift-tools.net/Flashcam/ can be convenient for your needs.
HTH
Regards,
Thierry
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-dvb] USBVision device defaults

2009-06-29 Thread Tim Williams

On Mon, 29 Jun 2009, Andy Walls wrote:


According to the V4L2 specification for the close() call, all devices
should remember their settings.

There have been recent discussions on devices that do power management
not saving the RF tuner freq after the final close() (and what to do
about it), but the last input and standard should be preserved.  (Note,
I have not looked at the usbvision driver to look for problems.)


It would appear that the usbvision driver isn't following the spec. As I 
mentioned in my earlier message, there is an LED which indicates that the 
box is active. Under windows this comes on and stays on after the first 
use, until reboot. Under linux it always goes off when the programme using 
the device exits.



What precise WinTV USB device/verision are you using?



From lsusb :


Bus 002 Device 002: ID 0573:4d22 Zoran Co. Personal Media Division 
(Nogatech) Hauppauge WinTV-USB II (PAL) Model 566



Try something like:

$ v4l2-ctl --help
$ v4l2-ctl -d /dev/video0 --log-status
$ v4l2-ctl -d /dev/video0 --list-inputs
$ v4l2-ctl -d /dev/video0 --set-input=2
$ v4l2-ctl -d /dev/video0 --log-status


[r...@saucy ~]# v4l2-ctl -d /dev/video0 --log-status
[r...@saucy ~]# v4l2-ctl -d /dev/video0 --list-inputs
ioctl: VIDIOC_ENUMINPUT
Input   : 0
Name: Television
Type: 0x0001
Audioset: 0x0001
Tuner   : 0x
Standard: 0x00FFB1FF ( PAL NTSC SECAM )
Status  : 0

Input   : 1
Name: Composite Video Input
Type: 0x0002
Audioset: 0x
Tuner   : 0x
Standard: 0x00FF ( PAL )
Status  : 0

Input   : 2
Name: S-Video Input
Type: 0x0002
Audioset: 0x
Tuner   : 0x
Standard: 0x00FF ( PAL )
Status  : 0
[r...@saucy ~]# v4l2-ctl -d /dev/video0 --set-input=2
Video input set to 2 (S-Video Input)
[r...@saucy ~]# v4l2-ctl -d /dev/video0 --log-status
[r...@saucy ~]#

Each of these commands causes the following messages to be repeated in 
/var/log/messages


Jun 29 13:43:06 saucy kernel: saa7115' 1-0025: saa7113 found 
(1f7113d0e10) @ 0x4a (usbvision #0)
Jun 29 13:43:08 saucy kernel: tuner' 1-0061: chip found @ 0xc2 (usbvision 
#0)

Jun 29 13:43:08 saucy kernel: tuner-simple 1-0061: creating new instance
Jun 29 13:43:08 saucy kernel: tuner-simple 1-0061: type set to 5 (Philips 
PAL_BG (FI1216 and compatibles))

Jun 29 13:43:12 saucy kernel: tuner-simple 1-0061: destroying instance

I'm currently using kernel 2.6.27.21-desktop-1mnb on Mandriva 2009.0.

Tim W

--
Tim Williams BSc MSc MBCS
Euromotor Autotrain LLP
58 Jacoby Place
Priory Road
Edgbaston
Birmingham
B5 7UW
United Kingdom

Web : http://www.autotrain.org
Tel : +44 (0)121 414 2214

EuroMotor-AutoTrain is a company registered in the UK, Registration
number: OC317070.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-dvb] USBVision device defaults

2009-06-29 Thread Andy Walls
On Mon, 2009-06-29 at 11:34 +0100, Tim Williams wrote:
> Hello,
> 
> I'm trying use a WinTV USB adaptor which uses the usbvision driver to 
> capture the output of a video camera for streaming across the web, the 
> idea being that there is a reliable local recording, even in the event of 
> a computer crash, while allowing the remote viewers to see the proceedings 
> live without needing to have two separate cameras.
> 
> Unfortunately there is a catch, i'm using flash to do the broadcast 
> and flash (in common with a lot of other software of this type) doesn't 
> have the ability to set the input type and picture format, so you are 
> stuck with the default, which is the rf-tuner. I have managed to make my 
> own bodged driver which disables the rf-input so that I can get a picture 
> via s-video, but it is stubbornly stuck in black and white, which i'm 
> assuming is some kind of colour format problem.
> 
> If I use KDETV to look at the picture then everything comes through in 
> colour, so this would seem to be a problem with the defaults built into 
> the module being incorrect for my circumstances. Rather than carrying on 
> with my bodged driver (this is the first time I have ever attempted to 
> modify a C programme), what would be really great is away to achieve one 
> of the following :
> 
> 1) Set the default input, tv standard and pixel format using module 
> parameters in modprobe.conf

Some modules may do a subset of these things, but generally it is never
necessary.



> 2) Get the driver to 'remember' it's current settings when switching 
> between applications. The windows driver for these devices does this, so 
> all I have to do under windows is start up WinTV, make sure I have a good 
> picture, close it down again and then start up the video broadcast in 
> flash.

According to the V4L2 specification for the close() call, all devices
should remember their settings.

There have been recent discussions on devices that do power management
not saving the RF tuner freq after the final close() (and what to do
about it), but the last input and standard should be preserved.  (Note,
I have not looked at the usbvision driver to look for problems.)

What precise WinTV USB device/verision are you using?


> 3) A way to change the device settings using a 3rd party app even when the 
> main video device is in use and can't be accessed.

All v4l2 devices are multiple-open(); they can always be accessed by
multiple apps.  Changing hardware parameters while a device is streaming
is usually bad and not allowed by the device driver and/or hardware.


> I've tried using v4lctl 
> to set the parameters before starting a capture, but if the flash capture 
> is active, then I (unsurprisingly) get device in use errors.

Most devices will return an -EBUSY for various operations that can't be
performed when a capture is in progress - no surprise.


>  If I use v4lctl 
> before starting flash, then the settings don't stick. The capture box becomes 
> active briefly (there is a red light on the box which indicates this), 
> presumably accepts the setting and is then powered down again, causing 
> the new setting to be immediately forgotten.

The device driver should not forget them.

Try something like:

$ v4l2-ctl --help
$ v4l2-ctl -d /dev/video0 --log-status
$ v4l2-ctl -d /dev/video0 --list-inputs
$ v4l2-ctl -d /dev/video0 --set-input=2
$ v4l2-ctl -d /dev/video0 --log-status

The second "log-status" should show you that your change took effect and
stayed.  If not, the usbvision driver has a problem.

Regards,
Andy

> Any thoughts or help would be much appreciated.
> 
> Tim W
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html