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
nexedi
linux
Commits
e4a486e9
Commit
e4a486e9
authored
Apr 10, 2002
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
USB serial core
added /proc support through the tty layer.
parent
8e1db0c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
1 deletion
+48
-1
drivers/usb/serial/usbserial.c
drivers/usb/serial/usbserial.c
+48
-1
No files found.
drivers/usb/serial/usbserial.c
View file @
e4a486e9
...
...
@@ -15,6 +15,10 @@
*
* See Documentation/usb/usb-serial.txt for more information on using this driver
*
* (04/10/2002) gkh
* added serial_read_proc function which creates a
* /proc/tty/driver/usb-serial file.
*
* (03/27/2002) gkh
* Got USB serial console code working properly and merged into the main
* version of the tree. Thanks to Randy Dunlap for the initial version
...
...
@@ -340,7 +344,7 @@
/*
* Version Information
*/
#define DRIVER_VERSION "v1.
4
"
#define DRIVER_VERSION "v1.
5
"
#define DRIVER_AUTHOR "Greg Kroah-Hartman, greg@kroah.com, http://www.kroah.com/linux-usb/"
#define DRIVER_DESC "USB Serial Driver core"
...
...
@@ -844,6 +848,48 @@ static void serial_shutdown (struct usb_serial *serial)
generic_shutdown
(
serial
);
}
static
int
serial_read_proc
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
struct
usb_serial
*
serial
;
int
length
=
0
;
int
i
;
off_t
begin
=
0
;
char
tmp
[
40
];
dbg
(
__FUNCTION__
);
length
+=
sprintf
(
page
,
"usbserinfo:1.0 driver:%s
\n
"
,
DRIVER_VERSION
);
for
(
i
=
0
;
i
<
SERIAL_TTY_MINORS
&&
length
<
PAGE_SIZE
;
++
i
)
{
serial
=
get_serial_by_minor
(
i
);
if
(
serial
==
NULL
)
continue
;
length
+=
sprintf
(
page
+
length
,
"%d:"
,
i
);
if
(
serial
->
type
->
owner
)
length
+=
sprintf
(
page
+
length
,
" module:%s"
,
serial
->
type
->
owner
->
name
);
length
+=
sprintf
(
page
+
length
,
" name:
\"
%s
\"
"
,
serial
->
type
->
name
);
length
+=
sprintf
(
page
+
length
,
" vendor:%04x product:%04x"
,
serial
->
vendor
,
serial
->
product
);
length
+=
sprintf
(
page
+
length
,
" num_ports:%d"
,
serial
->
num_ports
);
length
+=
sprintf
(
page
+
length
,
" port:%d"
,
i
-
serial
->
minor
+
1
);
usb_make_path
(
serial
->
dev
,
tmp
,
sizeof
(
tmp
));
length
+=
sprintf
(
page
+
length
,
" path:%s"
,
tmp
);
length
+=
sprintf
(
page
+
length
,
"
\n
"
);
if
((
length
+
begin
)
>
(
off
+
count
))
goto
done
;
if
((
length
+
begin
)
<
off
)
{
begin
+=
length
;
length
=
0
;
}
}
*
eof
=
1
;
done:
if
(
off
>=
(
length
+
begin
))
return
0
;
*
start
=
page
+
(
off
-
begin
);
return
((
count
<
begin
+
length
-
off
)
?
count
:
begin
+
length
-
off
);
}
/*****************************************************************************
* generic devices specific driver functions
*****************************************************************************/
...
...
@@ -1491,6 +1537,7 @@ static struct tty_driver serial_tty_driver = {
unthrottle:
serial_unthrottle
,
break_ctl:
serial_break
,
chars_in_buffer:
serial_chars_in_buffer
,
read_proc:
serial_read_proc
,
};
...
...
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