Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
8fb8496a
Commit
8fb8496a
authored
Mar 12, 2002
by
Gerd Knorr
Committed by
Linus Torvalds
Mar 12, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] v4l: quickcam update
This patch updates the parallel port quickcam drivers (bw+color).
parent
0bd5a41d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
140 additions
and
205 deletions
+140
-205
drivers/media/video/bw-qcam.c
drivers/media/video/bw-qcam.c
+71
-102
drivers/media/video/c-qcam.c
drivers/media/video/c-qcam.c
+69
-103
No files found.
drivers/media/video/bw-qcam.c
View file @
8fb8496a
...
@@ -694,125 +694,97 @@ long qc_capture(struct qcam_device * q, char *buf, unsigned long len)
...
@@ -694,125 +694,97 @@ long qc_capture(struct qcam_device * q, char *buf, unsigned long len)
* Video4linux interfacing
* Video4linux interfacing
*/
*/
static
int
qcam_open
(
struct
video_device
*
dev
,
int
flags
)
static
int
qcam_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
{
unsigned
int
cmd
,
void
*
arg
)
return
0
;
}
static
void
qcam_close
(
struct
video_device
*
dev
)
{
}
static
long
qcam_write
(
struct
video_device
*
v
,
const
char
*
buf
,
unsigned
long
count
,
int
noblock
)
{
return
-
EINVAL
;
}
static
int
qcam_ioctl
(
struct
video_device
*
dev
,
unsigned
int
cmd
,
void
*
arg
)
{
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
qcam_device
*
qcam
=
(
struct
qcam_device
*
)
dev
;
struct
qcam_device
*
qcam
=
(
struct
qcam_device
*
)
dev
;
switch
(
cmd
)
switch
(
cmd
)
{
{
case
VIDIOCGCAP
:
case
VIDIOCGCAP
:
{
{
struct
video_capability
b
;
struct
video_capability
*
b
=
arg
;
strcpy
(
b
.
name
,
"Quickcam"
);
strcpy
(
b
->
name
,
"Quickcam"
);
b
.
type
=
VID_TYPE_CAPTURE
|
VID_TYPE_SCALES
|
VID_TYPE_MONOCHROME
;
b
->
type
=
VID_TYPE_CAPTURE
|
VID_TYPE_SCALES
|
VID_TYPE_MONOCHROME
;
b
.
channels
=
1
;
b
->
channels
=
1
;
b
.
audios
=
0
;
b
->
audios
=
0
;
b
.
maxwidth
=
320
;
b
->
maxwidth
=
320
;
b
.
maxheight
=
240
;
b
->
maxheight
=
240
;
b
.
minwidth
=
80
;
b
->
minwidth
=
80
;
b
.
minheight
=
60
;
b
->
minheight
=
60
;
if
(
copy_to_user
(
arg
,
&
b
,
sizeof
(
b
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCGCHAN
:
case
VIDIOCGCHAN
:
{
{
struct
video_channel
v
;
struct
video_channel
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
if
(
v
->
channel
!=
0
)
return
-
EFAULT
;
if
(
v
.
channel
!=
0
)
return
-
EINVAL
;
return
-
EINVAL
;
v
.
flags
=
0
;
v
->
flags
=
0
;
v
.
tuners
=
0
;
v
->
tuners
=
0
;
/* Good question.. its composite or SVHS so.. */
/* Good question.. its composite or SVHS so.. */
v
.
type
=
VIDEO_TYPE_CAMERA
;
v
->
type
=
VIDEO_TYPE_CAMERA
;
strcpy
(
v
.
name
,
"Camera"
);
strcpy
(
v
->
name
,
"Camera"
);
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCSCHAN
:
case
VIDIOCSCHAN
:
{
{
int
v
;
struct
video_channel
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
if
(
v
->
channel
!=
0
)
return
-
EFAULT
;
if
(
v
!=
0
)
return
-
EINVAL
;
return
-
EINVAL
;
return
0
;
return
0
;
}
}
case
VIDIOCGTUNER
:
case
VIDIOCGTUNER
:
{
{
struct
video_tuner
v
;
struct
video_tuner
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
))
!=
0
)
if
(
v
->
tuner
)
return
-
EFAULT
;
if
(
v
.
tuner
)
return
-
EINVAL
;
return
-
EINVAL
;
strcpy
(
v
.
name
,
"Format"
);
strcpy
(
v
->
name
,
"Format"
);
v
.
rangelow
=
0
;
v
->
rangelow
=
0
;
v
.
rangehigh
=
0
;
v
->
rangehigh
=
0
;
v
.
flags
=
0
;
v
->
flags
=
0
;
v
.
mode
=
VIDEO_MODE_AUTO
;
v
->
mode
=
VIDEO_MODE_AUTO
;
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
))
!=
0
)
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCSTUNER
:
case
VIDIOCSTUNER
:
{
{
struct
video_tuner
v
;
struct
video_tuner
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
))
!=
0
)
if
(
v
->
tuner
)
return
-
EFAULT
;
if
(
v
.
tuner
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
v
.
mode
!=
VIDEO_MODE_AUTO
)
if
(
v
->
mode
!=
VIDEO_MODE_AUTO
)
return
-
EINVAL
;
return
-
EINVAL
;
return
0
;
return
0
;
}
}
case
VIDIOCGPICT
:
case
VIDIOCGPICT
:
{
{
struct
video_picture
p
;
struct
video_picture
*
p
=
arg
;
p
.
colour
=
0x8000
;
p
->
colour
=
0x8000
;
p
.
hue
=
0x8000
;
p
->
hue
=
0x8000
;
p
.
brightness
=
qcam
->
brightness
<<
8
;
p
->
brightness
=
qcam
->
brightness
<<
8
;
p
.
contrast
=
qcam
->
contrast
<<
8
;
p
->
contrast
=
qcam
->
contrast
<<
8
;
p
.
whiteness
=
qcam
->
whitebal
<<
8
;
p
->
whiteness
=
qcam
->
whitebal
<<
8
;
p
.
depth
=
qcam
->
bpp
;
p
->
depth
=
qcam
->
bpp
;
p
.
palette
=
VIDEO_PALETTE_GREY
;
p
->
palette
=
VIDEO_PALETTE_GREY
;
if
(
copy_to_user
(
arg
,
&
p
,
sizeof
(
p
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCSPICT
:
case
VIDIOCSPICT
:
{
{
struct
video_picture
p
;
struct
video_picture
*
p
=
arg
;
if
(
copy_from_user
(
&
p
,
arg
,
sizeof
(
p
)))
if
(
p
->
palette
!=
VIDEO_PALETTE_GREY
)
return
-
EFAULT
;
if
(
p
.
palette
!=
VIDEO_PALETTE_GREY
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
p
.
depth
!=
4
&&
p
.
depth
!=
6
)
if
(
p
->
depth
!=
4
&&
p
->
depth
!=
6
)
return
-
EINVAL
;
return
-
EINVAL
;
/*
/*
* Now load the camera.
* Now load the camera.
*/
*/
qcam
->
brightness
=
p
.
brightness
>>
8
;
qcam
->
brightness
=
p
->
brightness
>>
8
;
qcam
->
contrast
=
p
.
contrast
>>
8
;
qcam
->
contrast
=
p
->
contrast
>>
8
;
qcam
->
whitebal
=
p
.
whiteness
>>
8
;
qcam
->
whitebal
=
p
->
whiteness
>>
8
;
qcam
->
bpp
=
p
.
depth
;
qcam
->
bpp
=
p
->
depth
;
down
(
&
qcam
->
lock
);
down
(
&
qcam
->
lock
);
qc_setscanmode
(
qcam
);
qc_setscanmode
(
qcam
);
...
@@ -823,27 +795,25 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -823,27 +795,25 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
}
}
case
VIDIOCSWIN
:
case
VIDIOCSWIN
:
{
{
struct
video_window
vw
;
struct
video_window
*
vw
=
arg
;
if
(
copy_from_user
(
&
vw
,
arg
,
sizeof
(
vw
)))
if
(
vw
->
flags
)
return
-
EFAULT
;
if
(
vw
.
flags
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
vw
.
clipcount
)
if
(
vw
->
clipcount
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
vw
.
height
<
60
||
vw
.
height
>
240
)
if
(
vw
->
height
<
60
||
vw
->
height
>
240
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
vw
.
width
<
80
||
vw
.
width
>
320
)
if
(
vw
->
width
<
80
||
vw
->
width
>
320
)
return
-
EINVAL
;
return
-
EINVAL
;
qcam
->
width
=
320
;
qcam
->
width
=
320
;
qcam
->
height
=
240
;
qcam
->
height
=
240
;
qcam
->
transfer_scale
=
4
;
qcam
->
transfer_scale
=
4
;
if
(
vw
.
width
>=
160
&&
vw
.
height
>=
120
)
if
(
vw
->
width
>=
160
&&
vw
->
height
>=
120
)
{
{
qcam
->
transfer_scale
=
2
;
qcam
->
transfer_scale
=
2
;
}
}
if
(
vw
.
width
>=
320
&&
vw
.
height
>=
240
)
if
(
vw
->
width
>=
320
&&
vw
->
height
>=
240
)
{
{
qcam
->
width
=
320
;
qcam
->
width
=
320
;
qcam
->
height
=
240
;
qcam
->
height
=
240
;
...
@@ -862,28 +832,20 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -862,28 +832,20 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
}
}
case
VIDIOCGWIN
:
case
VIDIOCGWIN
:
{
{
struct
video_window
vw
;
struct
video_window
*
vw
=
arg
;
memset
(
&
vw
,
0
,
sizeof
(
vw
));
memset
(
vw
,
0
,
sizeof
(
*
vw
));
vw
.
width
=
qcam
->
width
/
qcam
->
transfer_scale
;
vw
->
width
=
qcam
->
width
/
qcam
->
transfer_scale
;
vw
.
height
=
qcam
->
height
/
qcam
->
transfer_scale
;
vw
->
height
=
qcam
->
height
/
qcam
->
transfer_scale
;
if
(
copy_to_user
(
arg
,
&
vw
,
sizeof
(
vw
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCKEY
:
return
0
;
case
VIDIOCCAPTURE
:
case
VIDIOCCAPTURE
:
return
-
EINVAL
;
case
VIDIOCGFBUF
:
case
VIDIOCGFBUF
:
return
-
EINVAL
;
case
VIDIOCSFBUF
:
case
VIDIOCSFBUF
:
return
-
EINVAL
;
case
VIDIOCKEY
:
return
0
;
case
VIDIOCGFREQ
:
case
VIDIOCGFREQ
:
return
-
EINVAL
;
case
VIDIOCSFREQ
:
case
VIDIOCSFREQ
:
return
-
EINVAL
;
case
VIDIOCGAUDIO
:
case
VIDIOCGAUDIO
:
return
-
EINVAL
;
case
VIDIOCSAUDIO
:
case
VIDIOCSAUDIO
:
return
-
EINVAL
;
return
-
EINVAL
;
default:
default:
...
@@ -892,8 +854,10 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -892,8 +854,10 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
return
0
;
return
0
;
}
}
static
long
qcam_read
(
struct
video_device
*
v
,
char
*
buf
,
unsigned
long
count
,
int
noblock
)
static
int
qcam_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
{
struct
video_device
*
v
=
video_devdata
(
file
);
struct
qcam_device
*
qcam
=
(
struct
qcam_device
*
)
v
;
struct
qcam_device
*
qcam
=
(
struct
qcam_device
*
)
v
;
int
len
;
int
len
;
parport_claim_or_block
(
qcam
->
pdev
);
parport_claim_or_block
(
qcam
->
pdev
);
...
@@ -914,17 +878,22 @@ static long qcam_read(struct video_device *v, char *buf, unsigned long count, i
...
@@ -914,17 +878,22 @@ static long qcam_read(struct video_device *v, char *buf, unsigned long count, i
return
len
;
return
len
;
}
}
static
struct
file_operations
qcam_fops
=
{
owner:
THIS_MODULE
,
open:
video_exclusive_open
,
release:
video_exclusive_release
,
ioctl:
video_generic_ioctl
,
read:
qcam_read
,
llseek:
no_llseek
,
};
static
struct
video_device
qcam_template
=
static
struct
video_device
qcam_template
=
{
{
owner:
THIS_MODULE
,
owner:
THIS_MODULE
,
name:
"Connectix Quickcam"
,
name:
"Connectix Quickcam"
,
type:
VID_TYPE_CAPTURE
,
type:
VID_TYPE_CAPTURE
,
hardware:
VID_HARDWARE_QCAM_BW
,
hardware:
VID_HARDWARE_QCAM_BW
,
open:
qcam_open
,
fops:
&
qcam_fops
,
close:
qcam_close
,
kernel_ioctl:
qcam_ioctl
,
read:
qcam_read
,
write:
qcam_write
,
ioctl:
qcam_ioctl
,
};
};
#define MAX_CAMS 4
#define MAX_CAMS 4
...
...
drivers/media/video/c-qcam.c
View file @
8fb8496a
...
@@ -496,125 +496,93 @@ static long qc_capture(struct qcam_device *q, char *buf, unsigned long len)
...
@@ -496,125 +496,93 @@ static long qc_capture(struct qcam_device *q, char *buf, unsigned long len)
* Video4linux interfacing
* Video4linux interfacing
*/
*/
static
int
qcam_open
(
struct
video_device
*
dev
,
int
flags
)
static
int
qcam_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
{
unsigned
int
cmd
,
void
*
arg
)
return
0
;
}
static
void
qcam_close
(
struct
video_device
*
dev
)
{
}
static
long
qcam_write
(
struct
video_device
*
v
,
const
char
*
buf
,
unsigned
long
count
,
int
noblock
)
{
return
-
EINVAL
;
}
static
int
qcam_ioctl
(
struct
video_device
*
dev
,
unsigned
int
cmd
,
void
*
arg
)
{
{
struct
video_device
*
dev
=
video_devdata
(
file
);
struct
qcam_device
*
qcam
=
(
struct
qcam_device
*
)
dev
;
struct
qcam_device
*
qcam
=
(
struct
qcam_device
*
)
dev
;
switch
(
cmd
)
switch
(
cmd
)
{
{
case
VIDIOCGCAP
:
case
VIDIOCGCAP
:
{
{
struct
video_capability
b
;
struct
video_capability
*
b
=
arg
;
strcpy
(
b
.
name
,
"Quickcam"
);
strcpy
(
b
->
name
,
"Quickcam"
);
b
.
type
=
VID_TYPE_CAPTURE
|
VID_TYPE_SCALES
;
b
->
type
=
VID_TYPE_CAPTURE
|
VID_TYPE_SCALES
;
b
.
channels
=
1
;
b
->
channels
=
1
;
b
.
audios
=
0
;
b
->
audios
=
0
;
b
.
maxwidth
=
320
;
b
->
maxwidth
=
320
;
b
.
maxheight
=
240
;
b
->
maxheight
=
240
;
b
.
minwidth
=
80
;
b
->
minwidth
=
80
;
b
.
minheight
=
60
;
b
->
minheight
=
60
;
if
(
copy_to_user
(
arg
,
&
b
,
sizeof
(
b
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCGCHAN
:
case
VIDIOCGCHAN
:
{
{
struct
video_channel
v
;
struct
video_channel
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
if
(
v
->
channel
!=
0
)
return
-
EFAULT
;
if
(
v
.
channel
!=
0
)
return
-
EINVAL
;
return
-
EINVAL
;
v
.
flags
=
0
;
v
->
flags
=
0
;
v
.
tuners
=
0
;
v
->
tuners
=
0
;
/* Good question.. its composite or SVHS so.. */
/* Good question.. its composite or SVHS so.. */
v
.
type
=
VIDEO_TYPE_CAMERA
;
v
->
type
=
VIDEO_TYPE_CAMERA
;
strcpy
(
v
.
name
,
"Camera"
);
strcpy
(
v
->
name
,
"Camera"
);
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCSCHAN
:
case
VIDIOCSCHAN
:
{
{
int
v
;
struct
video_channel
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
)))
if
(
v
->
channel
!=
0
)
return
-
EFAULT
;
if
(
v
!=
0
)
return
-
EINVAL
;
return
-
EINVAL
;
return
0
;
return
0
;
}
}
case
VIDIOCGTUNER
:
case
VIDIOCGTUNER
:
{
{
struct
video_tuner
v
;
struct
video_tuner
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
))
!=
0
)
if
(
v
->
tuner
)
return
-
EFAULT
;
if
(
v
.
tuner
)
return
-
EINVAL
;
return
-
EINVAL
;
strcpy
(
v
.
name
,
"Format"
);
memset
(
v
,
0
,
sizeof
(
*
v
));
v
.
rangelow
=
0
;
strcpy
(
v
->
name
,
"Format"
);
v
.
rangehigh
=
0
;
v
->
mode
=
VIDEO_MODE_AUTO
;
v
.
flags
=
0
;
v
.
mode
=
VIDEO_MODE_AUTO
;
if
(
copy_to_user
(
arg
,
&
v
,
sizeof
(
v
))
!=
0
)
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCSTUNER
:
case
VIDIOCSTUNER
:
{
{
struct
video_tuner
v
;
struct
video_tuner
*
v
=
arg
;
if
(
copy_from_user
(
&
v
,
arg
,
sizeof
(
v
))
!=
0
)
if
(
v
->
tuner
)
return
-
EFAULT
;
if
(
v
.
tuner
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
v
.
mode
!=
VIDEO_MODE_AUTO
)
if
(
v
->
mode
!=
VIDEO_MODE_AUTO
)
return
-
EINVAL
;
return
-
EINVAL
;
return
0
;
return
0
;
}
}
case
VIDIOCGPICT
:
case
VIDIOCGPICT
:
{
{
struct
video_picture
p
;
struct
video_picture
*
p
=
arg
;
p
.
colour
=
0x8000
;
p
->
colour
=
0x8000
;
p
.
hue
=
0x8000
;
p
->
hue
=
0x8000
;
p
.
brightness
=
qcam
->
brightness
<<
8
;
p
->
brightness
=
qcam
->
brightness
<<
8
;
p
.
contrast
=
qcam
->
contrast
<<
8
;
p
->
contrast
=
qcam
->
contrast
<<
8
;
p
.
whiteness
=
qcam
->
whitebal
<<
8
;
p
->
whiteness
=
qcam
->
whitebal
<<
8
;
p
.
depth
=
24
;
p
->
depth
=
24
;
p
.
palette
=
VIDEO_PALETTE_RGB24
;
p
->
palette
=
VIDEO_PALETTE_RGB24
;
if
(
copy_to_user
(
arg
,
&
p
,
sizeof
(
p
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCSPICT
:
case
VIDIOCSPICT
:
{
{
struct
video_picture
p
;
struct
video_picture
*
p
=
arg
;
if
(
copy_from_user
(
&
p
,
arg
,
sizeof
(
p
)))
return
-
EFAULT
;
/*
/*
* Sanity check args
* Sanity check args
*/
*/
if
(
p
.
depth
!=
24
||
p
.
palette
!=
VIDEO_PALETTE_RGB24
)
if
(
p
->
depth
!=
24
||
p
->
palette
!=
VIDEO_PALETTE_RGB24
)
return
-
EINVAL
;
return
-
EINVAL
;
/*
/*
* Now load the camera.
* Now load the camera.
*/
*/
qcam
->
brightness
=
p
.
brightness
>>
8
;
qcam
->
brightness
=
p
->
brightness
>>
8
;
qcam
->
contrast
=
p
.
contrast
>>
8
;
qcam
->
contrast
=
p
->
contrast
>>
8
;
qcam
->
whitebal
=
p
.
whiteness
>>
8
;
qcam
->
whitebal
=
p
->
whiteness
>>
8
;
down
(
&
qcam
->
lock
);
down
(
&
qcam
->
lock
);
parport_claim_or_block
(
qcam
->
pdev
);
parport_claim_or_block
(
qcam
->
pdev
);
...
@@ -625,30 +593,28 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -625,30 +593,28 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
}
}
case
VIDIOCSWIN
:
case
VIDIOCSWIN
:
{
{
struct
video_window
vw
;
struct
video_window
*
vw
=
arg
;
if
(
copy_from_user
(
&
vw
,
arg
,
sizeof
(
vw
)))
if
(
vw
->
flags
)
return
-
EFAULT
;
if
(
vw
.
flags
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
vw
.
clipcount
)
if
(
vw
->
clipcount
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
vw
.
height
<
60
||
vw
.
height
>
240
)
if
(
vw
->
height
<
60
||
vw
->
height
>
240
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
vw
.
width
<
80
||
vw
.
width
>
320
)
if
(
vw
->
width
<
80
||
vw
->
width
>
320
)
return
-
EINVAL
;
return
-
EINVAL
;
qcam
->
width
=
80
;
qcam
->
width
=
80
;
qcam
->
height
=
60
;
qcam
->
height
=
60
;
qcam
->
mode
=
QC_DECIMATION_4
;
qcam
->
mode
=
QC_DECIMATION_4
;
if
(
vw
.
width
>=
160
&&
vw
.
height
>=
120
)
if
(
vw
->
width
>=
160
&&
vw
->
height
>=
120
)
{
{
qcam
->
width
=
160
;
qcam
->
width
=
160
;
qcam
->
height
=
120
;
qcam
->
height
=
120
;
qcam
->
mode
=
QC_DECIMATION_2
;
qcam
->
mode
=
QC_DECIMATION_2
;
}
}
if
(
vw
.
width
>=
320
&&
vw
.
height
>=
240
)
if
(
vw
->
width
>=
320
&&
vw
->
height
>=
240
)
{
{
qcam
->
width
=
320
;
qcam
->
width
=
320
;
qcam
->
height
=
240
;
qcam
->
height
=
240
;
...
@@ -656,7 +622,7 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -656,7 +622,7 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
}
}
qcam
->
mode
|=
QC_MILLIONS
;
qcam
->
mode
|=
QC_MILLIONS
;
#if 0
#if 0
if(vw
.width>=640 && vw.
height>=480)
if(vw
->width>=640 && vw->
height>=480)
{
{
qcam->width = 640;
qcam->width = 640;
qcam->height = 480;
qcam->height = 480;
...
@@ -674,28 +640,20 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -674,28 +640,20 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
}
}
case
VIDIOCGWIN
:
case
VIDIOCGWIN
:
{
{
struct
video_window
vw
;
struct
video_window
*
vw
=
arg
;
memset
(
&
vw
,
0
,
sizeof
(
vw
));
memset
(
vw
,
0
,
sizeof
(
*
vw
));
vw
.
width
=
qcam
->
width
;
vw
->
width
=
qcam
->
width
;
vw
.
height
=
qcam
->
height
;
vw
->
height
=
qcam
->
height
;
if
(
copy_to_user
(
arg
,
&
vw
,
sizeof
(
vw
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
case
VIDIOCKEY
:
return
0
;
case
VIDIOCCAPTURE
:
case
VIDIOCCAPTURE
:
return
-
EINVAL
;
case
VIDIOCGFBUF
:
case
VIDIOCGFBUF
:
return
-
EINVAL
;
case
VIDIOCSFBUF
:
case
VIDIOCSFBUF
:
return
-
EINVAL
;
case
VIDIOCKEY
:
return
0
;
case
VIDIOCGFREQ
:
case
VIDIOCGFREQ
:
return
-
EINVAL
;
case
VIDIOCSFREQ
:
case
VIDIOCSFREQ
:
return
-
EINVAL
;
case
VIDIOCGAUDIO
:
case
VIDIOCGAUDIO
:
return
-
EINVAL
;
case
VIDIOCSAUDIO
:
case
VIDIOCSAUDIO
:
return
-
EINVAL
;
return
-
EINVAL
;
default:
default:
...
@@ -704,8 +662,10 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
...
@@ -704,8 +662,10 @@ static int qcam_ioctl(struct video_device *dev, unsigned int cmd, void *arg)
return
0
;
return
0
;
}
}
static
long
qcam_read
(
struct
video_device
*
v
,
char
*
buf
,
unsigned
long
count
,
int
noblock
)
static
int
qcam_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
{
struct
video_device
*
v
=
video_devdata
(
file
);
struct
qcam_device
*
qcam
=
(
struct
qcam_device
*
)
v
;
struct
qcam_device
*
qcam
=
(
struct
qcam_device
*
)
v
;
int
len
;
int
len
;
...
@@ -719,17 +679,23 @@ static long qcam_read(struct video_device *v, char *buf, unsigned long count, i
...
@@ -719,17 +679,23 @@ static long qcam_read(struct video_device *v, char *buf, unsigned long count, i
}
}
/* video device template */
/* video device template */
static
struct
file_operations
qcam_fops
=
{
owner:
THIS_MODULE
,
open:
video_exclusive_open
,
release:
video_exclusive_release
,
ioctl:
video_generic_ioctl
,
read:
qcam_read
,
llseek:
no_llseek
,
};
static
struct
video_device
qcam_template
=
static
struct
video_device
qcam_template
=
{
{
owner:
THIS_MODULE
,
owner:
THIS_MODULE
,
name:
"Colour QuickCam"
,
name:
"Colour QuickCam"
,
type:
VID_TYPE_CAPTURE
,
type:
VID_TYPE_CAPTURE
,
hardware:
VID_HARDWARE_QCAM_C
,
hardware:
VID_HARDWARE_QCAM_C
,
open:
qcam_open
,
fops:
&
qcam_fops
,
close:
qcam_close
,
kernel_ioctl:
qcam_ioctl
,
read:
qcam_read
,
write:
qcam_write
,
ioctl:
qcam_ioctl
,
};
};
/* Initialize the QuickCam driver control structure. */
/* Initialize the QuickCam driver control structure. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment