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
16d94a31
Commit
16d94a31
authored
Apr 23, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: mct_u232: add support for new tty tiocmget and tiocmset functions.
parent
7e40f256
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
39 deletions
+43
-39
drivers/usb/serial/mct_u232.c
drivers/usb/serial/mct_u232.c
+43
-39
No files found.
drivers/usb/serial/mct_u232.c
View file @
16d94a31
...
@@ -125,7 +125,11 @@ static int mct_u232_ioctl (struct usb_serial_port *port,
...
@@ -125,7 +125,11 @@ static int mct_u232_ioctl (struct usb_serial_port *port,
unsigned
long
arg
);
unsigned
long
arg
);
static
void
mct_u232_break_ctl
(
struct
usb_serial_port
*
port
,
static
void
mct_u232_break_ctl
(
struct
usb_serial_port
*
port
,
int
break_state
);
int
break_state
);
static
int
mct_u232_tiocmget
(
struct
usb_serial_port
*
port
,
struct
file
*
file
);
static
int
mct_u232_tiocmset
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
set
,
unsigned
int
clear
);
/*
/*
* All of the device info needed for the MCT USB-RS232 converter.
* All of the device info needed for the MCT USB-RS232 converter.
*/
*/
...
@@ -165,6 +169,8 @@ static struct usb_serial_device_type mct_u232_device = {
...
@@ -165,6 +169,8 @@ static struct usb_serial_device_type mct_u232_device = {
.
ioctl
=
mct_u232_ioctl
,
.
ioctl
=
mct_u232_ioctl
,
.
set_termios
=
mct_u232_set_termios
,
.
set_termios
=
mct_u232_set_termios
,
.
break_ctl
=
mct_u232_break_ctl
,
.
break_ctl
=
mct_u232_break_ctl
,
.
tiocmget
=
mct_u232_tiocmget
,
.
tiocmset
=
mct_u232_tiocmset
,
.
attach
=
mct_u232_startup
,
.
attach
=
mct_u232_startup
,
.
shutdown
=
mct_u232_shutdown
,
.
shutdown
=
mct_u232_shutdown
,
};
};
...
@@ -773,57 +779,55 @@ static void mct_u232_break_ctl( struct usb_serial_port *port, int break_state )
...
@@ -773,57 +779,55 @@ static void mct_u232_break_ctl( struct usb_serial_port *port, int break_state )
}
/* mct_u232_break_ctl */
}
/* mct_u232_break_ctl */
static
int
mct_u232_ioctl
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
static
int
mct_u232_tiocmget
(
struct
usb_serial_port
*
port
,
struct
file
*
file
)
unsigned
int
cmd
,
unsigned
long
arg
)
{
{
struct
usb_serial
*
serial
=
port
->
serial
;
struct
mct_u232_private
*
priv
=
usb_get_serial_port_data
(
port
);
struct
mct_u232_private
*
priv
=
usb_get_serial_port_data
(
port
);
int
mask
;
unsigned
long
control_state
;
unsigned
long
control_state
;
unsigned
long
flags
;
unsigned
long
flags
;
dbg
(
"%s
cmd=0x%x"
,
__FUNCTION__
,
cmd
);
dbg
(
"%s
"
,
__FUNCTION__
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
control_state
=
priv
->
control_state
;
control_state
=
priv
->
control_state
;
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
/* Based on code from acm.c and others */
return
control_state
;
switch
(
cmd
)
{
}
case
TIOCMGET
:
return
put_user
(
control_state
,
(
unsigned
long
*
)
arg
);
break
;
case
TIOCMSET
:
/* Turns on and off the lines as specified by the mask */
static
int
mct_u232_tiocmset
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
case
TIOCMBIS
:
/* turns on (Sets) the lines as specified by the mask */
unsigned
int
set
,
unsigned
int
clear
)
case
TIOCMBIC
:
/* turns off (Clears) the lines as specified by the mask */
{
if
(
get_user
(
mask
,
(
unsigned
long
*
)
arg
))
struct
usb_serial
*
serial
=
port
->
serial
;
return
-
EFAULT
;
struct
mct_u232_private
*
priv
=
usb_get_serial_port_data
(
port
);
unsigned
long
control_state
;
if
((
cmd
==
TIOCMSET
)
||
(
mask
&
TIOCM_RTS
))
{
unsigned
long
flags
;
/* RTS needs set */
if
(
((
cmd
==
TIOCMSET
)
&&
(
mask
&
TIOCM_RTS
))
||
dbg
(
"%s"
,
__FUNCTION__
);
(
cmd
==
TIOCMBIS
)
)
control_state
|=
TIOCM_RTS
;
else
control_state
&=
~
TIOCM_RTS
;
}
if
((
cmd
==
TIOCMSET
)
||
(
mask
&
TIOCM_DTR
))
{
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
/* DTR needs set */
control_state
=
priv
->
control_state
;
if
(
((
cmd
==
TIOCMSET
)
&&
(
mask
&
TIOCM_DTR
))
||
(
cmd
==
TIOCMBIS
)
)
control_state
|=
TIOCM_DTR
;
else
control_state
&=
~
TIOCM_DTR
;
}
mct_u232_set_modem_ctrl
(
serial
,
control_state
);
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
if
(
set
&
TIOCM_RTS
)
priv
->
control_state
=
control_state
;
control_state
|=
TIOCM_RTS
;
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
if
(
set
&
TIOCM_DTR
)
break
;
control_state
|=
TIOCM_DTR
;
if
(
clear
&
TIOCM_RTS
)
control_state
&=
~
TIOCM_RTS
;
if
(
clear
&
TIOCM_DTR
)
control_state
&=
~
TIOCM_DTR
;
priv
->
control_state
=
control_state
;
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
return
mct_u232_set_modem_ctrl
(
serial
,
control_state
);
}
static
int
mct_u232_ioctl
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
dbg
(
"%scmd=0x%x"
,
__FUNCTION__
,
cmd
);
/* Based on code from acm.c and others */
switch
(
cmd
)
{
case
TIOCMIWAIT
:
case
TIOCMIWAIT
:
/* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/
/* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/
/* TODO */
/* TODO */
...
...
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