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
2daeb268
Commit
2daeb268
authored
Aug 22, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: add sysfs files for stv680 driver, replacing the lost proc functionality.
parent
f8830f36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
drivers/usb/media/stv680.c
drivers/usb/media/stv680.c
+53
-0
No files found.
drivers/usb/media/stv680.c
View file @
2daeb268
...
@@ -510,6 +510,57 @@ static int stv_init (struct usb_stv *stv680)
...
@@ -510,6 +510,57 @@ static int stv_init (struct usb_stv *stv680)
/***************** last of pencam routines *******************/
/***************** last of pencam routines *******************/
/****************************************************************************
* sysfs
***************************************************************************/
static
inline
struct
usb_stv
*
cd_to_stv
(
struct
class_device
*
cd
)
{
struct
video_device
*
vdev
=
to_video_device
(
cd
);
return
video_get_drvdata
(
vdev
);
}
#define stv680_file(name, variable, field) \
static ssize_t show_##name(struct class_device *class_dev, char *buf) \
{ \
struct video_device *vdev = to_video_device(class_dev); \
struct usb_stv *stv = video_get_drvdata(vdev); \
return sprintf(buf, field, stv->variable); \
} \
static CLASS_DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
stv680_file
(
model
,
camera_name
,
"%s
\n
"
);
stv680_file
(
in_use
,
user
,
"%d
\n
"
);
stv680_file
(
streaming
,
streaming
,
"%d
\n
"
);
stv680_file
(
palette
,
palette
,
"%i
\n
"
);
stv680_file
(
frames_total
,
readcount
,
"%d
\n
"
);
stv680_file
(
frames_read
,
framecount
,
"%d
\n
"
);
stv680_file
(
packets_dropped
,
dropped
,
"%d
\n
"
);
stv680_file
(
decoding_errors
,
error
,
"%d
\n
"
);
static
void
stv680_create_sysfs_files
(
struct
video_device
*
vdev
)
{
video_device_create_file
(
vdev
,
&
class_device_attr_model
);
video_device_create_file
(
vdev
,
&
class_device_attr_in_use
);
video_device_create_file
(
vdev
,
&
class_device_attr_streaming
);
video_device_create_file
(
vdev
,
&
class_device_attr_palette
);
video_device_create_file
(
vdev
,
&
class_device_attr_frames_total
);
video_device_create_file
(
vdev
,
&
class_device_attr_frames_read
);
video_device_create_file
(
vdev
,
&
class_device_attr_packets_dropped
);
video_device_create_file
(
vdev
,
&
class_device_attr_decoding_errors
);
}
static
void
stv680_remove_sysfs_files
(
struct
video_device
*
vdev
)
{
video_device_remove_file
(
vdev
,
&
class_device_attr_model
);
video_device_remove_file
(
vdev
,
&
class_device_attr_in_use
);
video_device_remove_file
(
vdev
,
&
class_device_attr_streaming
);
video_device_remove_file
(
vdev
,
&
class_device_attr_palette
);
video_device_remove_file
(
vdev
,
&
class_device_attr_frames_total
);
video_device_remove_file
(
vdev
,
&
class_device_attr_frames_read
);
video_device_remove_file
(
vdev
,
&
class_device_attr_packets_dropped
);
video_device_remove_file
(
vdev
,
&
class_device_attr_decoding_errors
);
}
/********************************************************************
/********************************************************************
* Camera control
* Camera control
*******************************************************************/
*******************************************************************/
...
@@ -1388,6 +1439,7 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id
...
@@ -1388,6 +1439,7 @@ static int stv680_probe (struct usb_interface *intf, const struct usb_device_id
PDEBUG
(
0
,
"STV(i): registered new video device: video%d"
,
stv680
->
vdev
->
minor
);
PDEBUG
(
0
,
"STV(i): registered new video device: video%d"
,
stv680
->
vdev
->
minor
);
usb_set_intfdata
(
intf
,
stv680
);
usb_set_intfdata
(
intf
,
stv680
);
stv680_create_sysfs_files
(
stv680
->
vdev
);
return
0
;
return
0
;
error:
error:
...
@@ -1432,6 +1484,7 @@ static void stv680_disconnect (struct usb_interface *intf)
...
@@ -1432,6 +1484,7 @@ static void stv680_disconnect (struct usb_interface *intf)
if
(
stv680
)
{
if
(
stv680
)
{
/* We don't want people trying to open up the device */
/* We don't want people trying to open up the device */
if
(
stv680
->
vdev
)
{
if
(
stv680
->
vdev
)
{
stv680_remove_sysfs_files
(
stv680
->
vdev
);
video_unregister_device
(
stv680
->
vdev
);
video_unregister_device
(
stv680
->
vdev
);
stv680
->
vdev
=
NULL
;
stv680
->
vdev
=
NULL
;
}
}
...
...
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