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
1ff590db
Commit
1ff590db
authored
Apr 23, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: kl5kusb105: add support for new tty tiocmget and tiocmset functions.
parent
7b369697
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
53 deletions
+59
-53
drivers/usb/serial/kl5kusb105.c
drivers/usb/serial/kl5kusb105.c
+59
-53
No files found.
drivers/usb/serial/kl5kusb105.c
View file @
1ff590db
...
@@ -105,6 +105,11 @@ static void klsi_105_unthrottle (struct usb_serial_port *port);
...
@@ -105,6 +105,11 @@ static void klsi_105_unthrottle (struct usb_serial_port *port);
static void klsi_105_break_ctl (struct usb_serial_port *port,
static void klsi_105_break_ctl (struct usb_serial_port *port,
int break_state );
int break_state );
*/
*/
static
int
klsi_105_tiocmget
(
struct
usb_serial_port
*
port
,
struct
file
*
file
);
static
int
klsi_105_tiocmset
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
set
,
unsigned
int
clear
);
/*
/*
* All of the device info needed for the KLSI converters.
* All of the device info needed for the KLSI converters.
...
@@ -143,6 +148,8 @@ static struct usb_serial_device_type kl5kusb105d_device = {
...
@@ -143,6 +148,8 @@ static struct usb_serial_device_type kl5kusb105d_device = {
.
ioctl
=
klsi_105_ioctl
,
.
ioctl
=
klsi_105_ioctl
,
.
set_termios
=
klsi_105_set_termios
,
.
set_termios
=
klsi_105_set_termios
,
/*.break_ctl = klsi_105_break_ctl,*/
/*.break_ctl = klsi_105_break_ctl,*/
.
tiocmget
=
klsi_105_tiocmget
,
.
tiocmset
=
klsi_105_tiocmset
,
.
attach
=
klsi_105_startup
,
.
attach
=
klsi_105_startup
,
.
shutdown
=
klsi_105_shutdown
,
.
shutdown
=
klsi_105_shutdown
,
.
throttle
=
klsi_105_throttle
,
.
throttle
=
klsi_105_throttle
,
...
@@ -879,68 +886,67 @@ static void mct_u232_break_ctl( struct usb_serial_port *port, int break_state )
...
@@ -879,68 +886,67 @@ static void mct_u232_break_ctl( struct usb_serial_port *port, int break_state )
} /* mct_u232_break_ctl */
} /* mct_u232_break_ctl */
#endif
#endif
static
int
klsi_105_ioctl
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
static
int
klsi_105_tiocmget
(
struct
usb_serial_port
*
port
,
struct
file
*
file
)
unsigned
int
cmd
,
unsigned
long
arg
)
{
{
struct
usb_serial
*
serial
=
port
->
serial
;
struct
usb_serial
*
serial
=
port
->
serial
;
struct
klsi_105_private
*
priv
=
usb_get_serial_port_data
(
port
);
struct
klsi_105_private
*
priv
=
usb_get_serial_port_data
(
port
);
int
mask
;
unsigned
long
flags
;
unsigned
long
flags
;
int
rc
;
dbg
(
"%scmd=0x%x"
,
__FUNCTION__
,
cmd
);
unsigned
long
line_state
;
dbg
(
"%s - request, just guessing"
,
__FUNCTION__
);
/* Based on code from acm.c and others */
rc
=
klsi_105_get_line_state
(
serial
,
&
line_state
);
switch
(
cmd
)
{
if
(
rc
<
0
)
{
case
TIOCMGET
:
{
err
(
"Reading line control failed (error = %d)"
,
rc
);
int
rc
;
/* better return value? EAGAIN? */
unsigned
long
line_state
;
return
rc
;
dbg
(
"%s - TIOCMGET request, just guessing"
,
__FUNCTION__
);
}
rc
=
klsi_105_get_line_state
(
serial
,
&
line_state
);
if
(
rc
<
0
)
{
err
(
"Reading line control failed (error = %d)"
,
rc
);
/* better return value? EAGAIN? */
return
-
ENOIOCTLCMD
;
}
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
priv
->
line_state
=
line_state
;
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
dbg
(
"%s - read line state 0x%lx"
,
__FUNCTION__
,
line_state
);
return
put_user
(
line_state
,
(
unsigned
long
*
)
arg
);
};
case
TIOCMSET
:
/* Turns on and off the lines as specified by the mask */
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
case
TIOCMBIS
:
/* turns on (Sets) the lines as specified by the mask */
priv
->
line_state
=
line_state
;
case
TIOCMBIC
:
/* turns off (Clears) the lines as specified by the mask */
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
if
(
get_user
(
mask
,
(
unsigned
long
*
)
arg
))
dbg
(
"%s - read line state 0x%lx"
,
__FUNCTION__
,
line_state
);
return
-
EFAULT
;
return
(
int
)
line_state
;
}
if
((
cmd
==
TIOCMSET
)
||
(
mask
&
TIOCM_RTS
))
{
static
int
klsi_105_tiocmset
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
/* RTS needs set */
unsigned
int
set
,
unsigned
int
clear
)
if
(
((
cmd
==
TIOCMSET
)
&&
(
mask
&
TIOCM_RTS
))
||
{
(
cmd
==
TIOCMBIS
)
)
int
retval
=
-
EINVAL
;
dbg
(
"%s - set RTS not handled"
,
__FUNCTION__
);
/* priv->control_state |= TIOCM_RTS; */
dbg
(
"%s"
,
__FUNCTION__
);
else
dbg
(
"%s - clear RTS not handled"
,
__FUNCTION__
);
/* priv->control_state &= ~TIOCM_RTS; */
}
if
((
cmd
==
TIOCMSET
)
||
(
mask
&
TIOCM_DTR
))
{
/* if this ever gets implemented, it should be done something like this:
/* DTR needs set */
struct usb_serial *serial = port->serial;
if
(
((
cmd
==
TIOCMSET
)
&&
(
mask
&
TIOCM_DTR
))
||
struct klsi_105_private *priv = usb_get_serial_port_data(port);
(
cmd
==
TIOCMBIS
)
)
unsigned long flags;
dbg
(
"%s - set DTR not handled"
,
__FUNCTION__
);
int control;
/* priv->control_state |= TIOCM_DTR; */
else
spin_lock_irqsave (&priv->lock, flags);
dbg
(
"%s - clear DTR not handled"
,
__FUNCTION__
);
if (set & TIOCM_RTS)
/* priv->control_state &= ~TIOCM_DTR; */
priv->control_state |= TIOCM_RTS;
}
if (set & TIOCM_DTR)
/*
priv->control_state |= TIOCM_DTR;
mct_u232_set_modem_ctrl(serial, priv->control_state);
if (clear & TIOCM_RTS)
*/
priv->control_state &= ~TIOCM_RTS;
break
;
if (clear & TIOCM_DTR)
priv->control_state &= ~TIOCM_DTR;
control = priv->control_state;
spin_unlock_irqrestore (&priv->lock, flags);
retval = mct_u232_set_modem_ctrl(serial, control);
*/
return
retval
;
}
static
int
klsi_105_ioctl
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
struct
klsi_105_private
*
priv
=
usb_get_serial_port_data
(
port
);
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