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
a899637c
Commit
a899637c
authored
Apr 23, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: cdc-acm: add support for new tty tiocmget and tiocmset functions.
parent
9beb9dc0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
28 deletions
+34
-28
drivers/usb/class/cdc-acm.c
drivers/usb/class/cdc-acm.c
+34
-28
No files found.
drivers/usb/class/cdc-acm.c
View file @
a899637c
...
@@ -432,43 +432,47 @@ static void acm_tty_break_ctl(struct tty_struct *tty, int state)
...
@@ -432,43 +432,47 @@ static void acm_tty_break_ctl(struct tty_struct *tty, int state)
dbg
(
"send break failed"
);
dbg
(
"send break failed"
);
}
}
static
int
acm_tty_
ioctl
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
static
int
acm_tty_
tiocmget
(
struct
tty_struct
*
tty
,
struct
file
*
file
)
{
{
struct
acm
*
acm
=
tty
->
driver_data
;
struct
acm
*
acm
=
tty
->
driver_data
;
unsigned
int
mask
,
newctrl
;
if
(
!
ACM_READY
(
acm
))
return
-
EINVAL
;
switch
(
cmd
)
{
if
(
!
ACM_READY
(
acm
))
return
-
EINVAL
;
return
(
acm
->
ctrlout
&
ACM_CTRL_DTR
?
TIOCM_DTR
:
0
)
|
(
acm
->
ctrlout
&
ACM_CTRL_RTS
?
TIOCM_RTS
:
0
)
|
(
acm
->
ctrlin
&
ACM_CTRL_DSR
?
TIOCM_DSR
:
0
)
|
(
acm
->
ctrlin
&
ACM_CTRL_RI
?
TIOCM_RI
:
0
)
|
(
acm
->
ctrlin
&
ACM_CTRL_DCD
?
TIOCM_CD
:
0
)
|
TIOCM_CTS
;
}
case
TIOCMGET
:
static
int
acm_tty_tiocmset
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
int
set
,
unsigned
int
clear
)
{
struct
acm
*
acm
=
tty
->
driver_data
;
unsigned
int
newctrl
;
return
put_user
((
acm
->
ctrlout
&
ACM_CTRL_DTR
?
TIOCM_DTR
:
0
)
|
if
(
!
ACM_READY
(
acm
))
(
acm
->
ctrlout
&
ACM_CTRL_RTS
?
TIOCM_RTS
:
0
)
|
return
-
EINVAL
;
(
acm
->
ctrlin
&
ACM_CTRL_DSR
?
TIOCM_DSR
:
0
)
|
(
acm
->
ctrlin
&
ACM_CTRL_RI
?
TIOCM_RI
:
0
)
|
(
acm
->
ctrlin
&
ACM_CTRL_DCD
?
TIOCM_CD
:
0
)
|
TIOCM_CTS
,
(
unsigned
long
*
)
arg
);
case
TIOCMSET
:
newctrl
=
acm
->
ctrlout
;
case
TIOCMBIS
:
set
=
(
set
&
TIOCM_DTR
?
ACM_CTRL_DTR
:
0
)
|
(
set
&
TIOCM_RTS
?
ACM_CTRL_RTS
:
0
);
case
TIOCMBIC
:
clear
=
(
clear
&
TIOCM_DTR
?
ACM_CTRL_DTR
:
0
)
|
(
clear
&
TIOCM_RTS
?
ACM_CTRL_RTS
:
0
);
if
(
get_user
(
mask
,
(
unsigned
long
*
)
arg
))
newctrl
=
(
newctrl
&
~
clear
)
|
set
;
return
-
EFAULT
;
newctrl
=
acm
->
ctrlout
;
if
(
acm
->
ctrlout
==
newctrl
)
mask
=
(
mask
&
TIOCM_DTR
?
ACM_CTRL_DTR
:
0
)
|
(
mask
&
TIOCM_RTS
?
ACM_CTRL_RTS
:
0
);
return
0
;
return
acm_set_control
(
acm
,
acm
->
ctrlout
=
newctrl
);
}
switch
(
cmd
)
{
static
int
acm_tty_ioctl
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
case
TIOCMSET
:
newctrl
=
mask
;
break
;
{
case
TIOCMBIS
:
newctrl
|=
mask
;
break
;
struct
acm
*
acm
=
tty
->
driver_data
;
case
TIOCMBIC
:
newctrl
&=
~
mask
;
break
;
}
if
(
acm
->
ctrlout
==
newctrl
)
return
0
;
if
(
!
ACM_READY
(
acm
))
return
acm_set_control
(
acm
,
acm
->
ctrlout
=
newctrl
);
return
-
EINVAL
;
}
return
-
ENOIOCTLCMD
;
return
-
ENOIOCTLCMD
;
}
}
...
@@ -750,7 +754,9 @@ static struct tty_driver acm_tty_driver = {
...
@@ -750,7 +754,9 @@ static struct tty_driver acm_tty_driver = {
.
unthrottle
=
acm_tty_unthrottle
,
.
unthrottle
=
acm_tty_unthrottle
,
.
chars_in_buffer
=
acm_tty_chars_in_buffer
,
.
chars_in_buffer
=
acm_tty_chars_in_buffer
,
.
break_ctl
=
acm_tty_break_ctl
,
.
break_ctl
=
acm_tty_break_ctl
,
.
set_termios
=
acm_tty_set_termios
.
set_termios
=
acm_tty_set_termios
,
.
tiocmget
=
acm_tty_tiocmget
,
.
tiocmset
=
acm_tty_tiocmset
,
};
};
/*
/*
...
...
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