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
d5fc42a8
Commit
d5fc42a8
authored
Jan 14, 2004
by
Jean Tourrilhes
Committed by
David S. Miller
Jan 14, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IRDA]: Migrate TIOCMGET and TIOCMSET ioctls in IrCOMM to the new TTY API.
Patch from Russell King.
parent
f1980d3a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
52 deletions
+30
-52
include/net/irda/ircomm_tty.h
include/net/irda/ircomm_tty.h
+3
-0
net/irda/ircomm/ircomm_tty.c
net/irda/ircomm/ircomm_tty.c
+3
-1
net/irda/ircomm/ircomm_tty_ioctl.c
net/irda/ircomm/ircomm_tty_ioctl.c
+24
-51
No files found.
include/net/irda/ircomm_tty.h
View file @
d5fc42a8
...
@@ -122,6 +122,9 @@ void ircomm_tty_stop(struct tty_struct *tty);
...
@@ -122,6 +122,9 @@ void ircomm_tty_stop(struct tty_struct *tty);
void
ircomm_tty_check_modem_status
(
struct
ircomm_tty_cb
*
self
);
void
ircomm_tty_check_modem_status
(
struct
ircomm_tty_cb
*
self
);
extern
void
ircomm_tty_change_speed
(
struct
ircomm_tty_cb
*
self
);
extern
void
ircomm_tty_change_speed
(
struct
ircomm_tty_cb
*
self
);
extern
int
ircomm_tty_tiocmget
(
struct
tty_struct
*
tty
,
struct
file
*
file
);
extern
int
ircomm_tty_tiocmset
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
int
set
,
unsigned
int
clear
);
extern
int
ircomm_tty_ioctl
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
extern
int
ircomm_tty_ioctl
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
);
unsigned
int
cmd
,
unsigned
long
arg
);
extern
void
ircomm_tty_set_termios
(
struct
tty_struct
*
tty
,
extern
void
ircomm_tty_set_termios
(
struct
tty_struct
*
tty
,
...
...
net/irda/ircomm/ircomm_tty.c
View file @
d5fc42a8
...
@@ -86,7 +86,9 @@ static struct tty_operations ops = {
...
@@ -86,7 +86,9 @@ static struct tty_operations ops = {
.
write_room
=
ircomm_tty_write_room
,
.
write_room
=
ircomm_tty_write_room
,
.
chars_in_buffer
=
ircomm_tty_chars_in_buffer
,
.
chars_in_buffer
=
ircomm_tty_chars_in_buffer
,
.
flush_buffer
=
ircomm_tty_flush_buffer
,
.
flush_buffer
=
ircomm_tty_flush_buffer
,
.
ioctl
=
ircomm_tty_ioctl
,
.
ioctl
=
ircomm_tty_ioctl
,
/* ircomm_tty_ioctl.c */
.
tiocmget
=
ircomm_tty_tiocmget
,
/* ircomm_tty_ioctl.c */
.
tiocmset
=
ircomm_tty_tiocmset
,
/* ircomm_tty_ioctl.c */
.
throttle
=
ircomm_tty_throttle
,
.
throttle
=
ircomm_tty_throttle
,
.
unthrottle
=
ircomm_tty_unthrottle
,
.
unthrottle
=
ircomm_tty_unthrottle
,
.
send_xchar
=
ircomm_tty_send_xchar
,
.
send_xchar
=
ircomm_tty_send_xchar
,
...
...
net/irda/ircomm/ircomm_tty_ioctl.c
View file @
d5fc42a8
...
@@ -190,81 +190,62 @@ void ircomm_tty_set_termios(struct tty_struct *tty,
...
@@ -190,81 +190,62 @@ void ircomm_tty_set_termios(struct tty_struct *tty,
}
}
/*
/*
* Function ircomm_tty_
get_modem_info (self, valu
e)
* Function ircomm_tty_
tiocmget (tty, fil
e)
*
*
*
*
*
*
*/
*/
static
int
ircomm_tty_get_modem_info
(
struct
ircomm_tty_cb
*
self
,
int
ircomm_tty_tiocmget
(
struct
tty_struct
*
tty
,
struct
file
*
file
)
unsigned
int
*
value
)
{
{
struct
ircomm_tty_cb
*
self
=
(
struct
ircomm_tty_cb
*
)
tty
->
driver_data
;
unsigned
int
result
;
unsigned
int
result
;
IRDA_DEBUG
(
2
,
"%s()
\n
"
,
__FUNCTION__
);
IRDA_DEBUG
(
2
,
"%s()
\n
"
,
__FUNCTION__
);
if
(
tty
->
flags
&
(
1
<<
TTY_IO_ERROR
))
return
-
EIO
;
result
=
((
self
->
settings
.
dte
&
IRCOMM_RTS
)
?
TIOCM_RTS
:
0
)
result
=
((
self
->
settings
.
dte
&
IRCOMM_RTS
)
?
TIOCM_RTS
:
0
)
|
((
self
->
settings
.
dte
&
IRCOMM_DTR
)
?
TIOCM_DTR
:
0
)
|
((
self
->
settings
.
dte
&
IRCOMM_DTR
)
?
TIOCM_DTR
:
0
)
|
((
self
->
settings
.
dce
&
IRCOMM_CD
)
?
TIOCM_CAR
:
0
)
|
((
self
->
settings
.
dce
&
IRCOMM_CD
)
?
TIOCM_CAR
:
0
)
|
((
self
->
settings
.
dce
&
IRCOMM_RI
)
?
TIOCM_RNG
:
0
)
|
((
self
->
settings
.
dce
&
IRCOMM_RI
)
?
TIOCM_RNG
:
0
)
|
((
self
->
settings
.
dce
&
IRCOMM_DSR
)
?
TIOCM_DSR
:
0
)
|
((
self
->
settings
.
dce
&
IRCOMM_DSR
)
?
TIOCM_DSR
:
0
)
|
((
self
->
settings
.
dce
&
IRCOMM_CTS
)
?
TIOCM_CTS
:
0
);
|
((
self
->
settings
.
dce
&
IRCOMM_CTS
)
?
TIOCM_CTS
:
0
);
return
result
;
return
put_user
(
result
,
value
);
}
}
/*
/*
* Function
set_modem_info (driver, cmd, value
)
* Function
ircomm_tty_tiocmset (tty, file, set, clear
)
*
*
*
*
*
*
*/
*/
static
int
ircomm_tty_set_modem_info
(
struct
ircomm_tty_cb
*
self
,
int
ircomm_tty_tiocmset
(
struct
tty_struct
*
tty
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
int
*
value
)
unsigned
int
set
,
unsigned
int
clear
)
{
{
unsigned
int
arg
;
struct
ircomm_tty_cb
*
self
=
(
struct
ircomm_tty_cb
*
)
tty
->
driver_data
;
__u8
old_rts
,
old_dtr
;
IRDA_DEBUG
(
2
,
"%s()
\n
"
,
__FUNCTION__
);
IRDA_DEBUG
(
2
,
"%s()
\n
"
,
__FUNCTION__
);
if
(
tty
->
flags
&
(
1
<<
TTY_IO_ERROR
))
return
-
EIO
;
ASSERT
(
self
!=
NULL
,
return
-
1
;);
ASSERT
(
self
!=
NULL
,
return
-
1
;);
ASSERT
(
self
->
magic
==
IRCOMM_TTY_MAGIC
,
return
-
1
;);
ASSERT
(
self
->
magic
==
IRCOMM_TTY_MAGIC
,
return
-
1
;);
if
(
get_user
(
arg
,
value
))
if
(
set
&
TIOCM_RTS
)
return
-
EFAULT
;
self
->
settings
.
dte
|=
IRCOMM_RTS
;
if
(
set
&
TIOCM_DTR
)
self
->
settings
.
dte
|=
IRCOMM_DTR
;
old_rts
=
self
->
settings
.
dte
&
IRCOMM_RTS
;
if
(
clear
&
TIOCM_RTS
)
old_dtr
=
self
->
settings
.
dte
&
IRCOMM_DTR
;
self
->
settings
.
dte
&=
~
IRCOMM_RTS
;
if
(
clear
&
TIOCM_DTR
)
self
->
settings
.
dte
&=
~
IRCOMM_DTR
;
switch
(
cmd
)
{
if
((
set
|
clear
)
&
TIOCM_RTS
)
case
TIOCMBIS
:
if
(
arg
&
TIOCM_RTS
)
self
->
settings
.
dte
|=
IRCOMM_RTS
;
if
(
arg
&
TIOCM_DTR
)
self
->
settings
.
dte
|=
IRCOMM_DTR
;
break
;
case
TIOCMBIC
:
if
(
arg
&
TIOCM_RTS
)
self
->
settings
.
dte
&=
~
IRCOMM_RTS
;
if
(
arg
&
TIOCM_DTR
)
self
->
settings
.
dte
&=
~
IRCOMM_DTR
;
break
;
case
TIOCMSET
:
self
->
settings
.
dte
=
((
self
->
settings
.
dte
&
~
(
IRCOMM_RTS
|
IRCOMM_DTR
))
|
((
arg
&
TIOCM_RTS
)
?
IRCOMM_RTS
:
0
)
|
((
arg
&
TIOCM_DTR
)
?
IRCOMM_DTR
:
0
));
break
;
default:
return
-
EINVAL
;
}
if
((
self
->
settings
.
dte
&
IRCOMM_RTS
)
!=
old_rts
)
self
->
settings
.
dte
|=
IRCOMM_DELTA_RTS
;
self
->
settings
.
dte
|=
IRCOMM_DELTA_RTS
;
if
((
set
|
clear
)
&
TIOCM_DTR
)
if
((
self
->
settings
.
dte
&
IRCOMM_DTR
)
!=
old_dtr
)
self
->
settings
.
dte
|=
IRCOMM_DELTA_DTR
;
self
->
settings
.
dte
|=
IRCOMM_DELTA_DTR
;
ircomm_param_request
(
self
,
IRCOMM_DTE
,
TRUE
);
ircomm_param_request
(
self
,
IRCOMM_DTE
,
TRUE
);
...
@@ -406,14 +387,6 @@ int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file,
...
@@ -406,14 +387,6 @@ int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file,
}
}
switch
(
cmd
)
{
switch
(
cmd
)
{
case
TIOCMGET
:
ret
=
ircomm_tty_get_modem_info
(
self
,
(
unsigned
int
*
)
arg
);
break
;
case
TIOCMBIS
:
case
TIOCMBIC
:
case
TIOCMSET
:
ret
=
ircomm_tty_set_modem_info
(
self
,
cmd
,
(
unsigned
int
*
)
arg
);
break
;
case
TIOCGSERIAL
:
case
TIOCGSERIAL
:
ret
=
ircomm_tty_get_serial_info
(
self
,
(
struct
serial_struct
*
)
arg
);
ret
=
ircomm_tty_get_serial_info
(
self
,
(
struct
serial_struct
*
)
arg
);
break
;
break
;
...
...
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