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
5fa6d320
Commit
5fa6d320
authored
Apr 23, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: whiteheat: add support for new tty tiocmget and tiocmset functions.
parent
5fac329f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
53 deletions
+37
-53
drivers/usb/serial/whiteheat.c
drivers/usb/serial/whiteheat.c
+37
-53
No files found.
drivers/usb/serial/whiteheat.c
View file @
5fa6d320
...
@@ -146,6 +146,8 @@ static int whiteheat_write (struct usb_serial_port *port, int from_user, const
...
@@ -146,6 +146,8 @@ static int whiteheat_write (struct usb_serial_port *port, int from_user, const
static
int
whiteheat_write_room
(
struct
usb_serial_port
*
port
);
static
int
whiteheat_write_room
(
struct
usb_serial_port
*
port
);
static
int
whiteheat_ioctl
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
);
static
int
whiteheat_ioctl
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
);
static
void
whiteheat_set_termios
(
struct
usb_serial_port
*
port
,
struct
termios
*
old
);
static
void
whiteheat_set_termios
(
struct
usb_serial_port
*
port
,
struct
termios
*
old
);
static
int
whiteheat_tiocmget
(
struct
usb_serial_port
*
port
,
struct
file
*
file
);
static
int
whiteheat_tiocmset
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
set
,
unsigned
int
clear
);
static
void
whiteheat_break_ctl
(
struct
usb_serial_port
*
port
,
int
break_state
);
static
void
whiteheat_break_ctl
(
struct
usb_serial_port
*
port
,
int
break_state
);
static
int
whiteheat_chars_in_buffer
(
struct
usb_serial_port
*
port
);
static
int
whiteheat_chars_in_buffer
(
struct
usb_serial_port
*
port
);
static
void
whiteheat_throttle
(
struct
usb_serial_port
*
port
);
static
void
whiteheat_throttle
(
struct
usb_serial_port
*
port
);
...
@@ -184,6 +186,8 @@ static struct usb_serial_device_type whiteheat_device = {
...
@@ -184,6 +186,8 @@ static struct usb_serial_device_type whiteheat_device = {
.
ioctl
=
whiteheat_ioctl
,
.
ioctl
=
whiteheat_ioctl
,
.
set_termios
=
whiteheat_set_termios
,
.
set_termios
=
whiteheat_set_termios
,
.
break_ctl
=
whiteheat_break_ctl
,
.
break_ctl
=
whiteheat_break_ctl
,
.
tiocmget
=
whiteheat_tiocmget
,
.
tiocmset
=
whiteheat_tiocmset
,
.
chars_in_buffer
=
whiteheat_chars_in_buffer
,
.
chars_in_buffer
=
whiteheat_chars_in_buffer
,
.
throttle
=
whiteheat_throttle
,
.
throttle
=
whiteheat_throttle
,
.
unthrottle
=
whiteheat_unthrottle
,
.
unthrottle
=
whiteheat_unthrottle
,
...
@@ -767,73 +771,53 @@ static int whiteheat_write_room(struct usb_serial_port *port)
...
@@ -767,73 +771,53 @@ static int whiteheat_write_room(struct usb_serial_port *port)
}
}
static
int
whiteheat_
ioctl
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
static
int
whiteheat_
tiocmget
(
struct
usb_serial_port
*
port
,
struct
file
*
file
)
{
{
struct
whiteheat_private
*
info
=
usb_get_serial_port_data
(
port
);
struct
whiteheat_private
*
info
=
usb_get_serial_port_data
(
port
);
unsigned
int
modem_signals
=
0
;
unsigned
int
modem_signals
=
0
;
struct
serial_struct
serstruct
;
dbg
(
"%s - port %d, cmd 0x%.4x"
,
__FUNCTION__
,
port
->
number
,
cmd
);
switch
(
cmd
)
{
case
TIOCMGET
:
firm_get_dtr_rts
(
port
);
if
(
info
->
mcr
&
UART_MCR_DTR
)
modem_signals
|=
TIOCM_DTR
;
if
(
info
->
mcr
&
UART_MCR_RTS
)
modem_signals
|=
TIOCM_RTS
;
if
(
copy_to_user
((
unsigned
int
*
)
arg
,
&
modem_signals
,
sizeof
(
unsigned
int
)))
return
-
EFAULT
;
break
;
case
TIOCMSET
:
dbg
(
"%s - port %d"
,
__FUNCTION__
,
port
->
number
);
if
(
copy_from_user
(
&
modem_signals
,
(
unsigned
int
*
)
arg
,
sizeof
(
unsigned
int
)))
return
-
EFAULT
;
if
(
modem_signals
&
TIOCM_DTR
)
firm_get_dtr_rts
(
port
);
info
->
mcr
|=
UART_MCR_DTR
;
if
(
info
->
mcr
&
UART_MCR_DTR
)
else
modem_signals
|=
TIOCM_DTR
;
info
->
mcr
&=
~
UART_MCR_DTR
;
if
(
info
->
mcr
&
UART_MCR_RTS
)
if
(
modem_signals
&
TIOCM_RTS
)
modem_signals
|=
TIOCM_RTS
;
info
->
mcr
|=
UART_MCR_RTS
;
else
info
->
mcr
&=
~
UART_MCR_RTS
;
firm_set_dtr
(
port
,
info
->
mcr
&
UART_MCR_DTR
)
;
return
modem_signals
;
firm_set_rts
(
port
,
info
->
mcr
&
UART_MCR_RTS
);
}
break
;
case
TIOCMBIS
:
static
int
whiteheat_tiocmset
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
if
(
copy_from_user
(
&
modem_signals
,
(
unsigned
int
*
)
arg
,
sizeof
(
unsigned
int
)))
unsigned
int
set
,
unsigned
int
clear
)
return
-
EFAULT
;
{
struct
whiteheat_private
*
info
=
usb_get_serial_port_data
(
port
);
if
(
modem_signals
&
TIOCM_DTR
)
dbg
(
"%s - port %d"
,
__FUNCTION__
,
port
->
number
);
info
->
mcr
|=
UART_MCR_DTR
;
if
(
modem_signals
&
TIOCM_RTS
)
info
->
mcr
|=
UART_MCR_RTS
;
firm_set_dtr
(
port
,
info
->
mcr
&
UART_MCR_DTR
);
if
(
set
&
TIOCM_RTS
)
firm_set_rts
(
port
,
info
->
mcr
&
UART_MCR_RTS
);
info
->
mcr
|=
UART_MCR_RTS
;
if
(
set
&
TIOCM_DTR
)
info
->
mcr
|=
UART_MCR_DTR
;
break
;
if
(
clear
&
TIOCM_RTS
)
info
->
mcr
&=
~
UART_MCR_RTS
;
if
(
clear
&
TIOCM_DTR
)
info
->
mcr
&=
~
UART_MCR_DTR
;
case
TIOCMBIC
:
firm_set_dtr
(
port
,
info
->
mcr
&
UART_MCR_DTR
);
if
(
copy_from_user
(
&
modem_signals
,
(
unsigned
int
*
)
arg
,
sizeof
(
unsigned
int
)))
firm_set_rts
(
port
,
info
->
mcr
&
UART_MCR_RTS
);
return
-
EFAULT
;
return
0
;
}
if
(
modem_signals
&
TIOCM_DTR
)
info
->
mcr
&=
~
UART_MCR_DTR
;
if
(
modem_signals
&
TIOCM_RTS
)
info
->
mcr
&=
~
UART_MCR_RTS
;
firm_set_dtr
(
port
,
info
->
mcr
&
UART_MCR_DTR
);
static
int
whiteheat_ioctl
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
firm_set_rts
(
port
,
info
->
mcr
&
UART_MCR_RTS
);
{
struct
serial_struct
serstruct
;
break
;
dbg
(
"%s - port %d, cmd 0x%.4x"
,
__FUNCTION__
,
port
->
number
,
cmd
)
;
switch
(
cmd
)
{
case
TIOCGSERIAL
:
case
TIOCGSERIAL
:
memset
(
&
serstruct
,
0
,
sizeof
(
serstruct
));
memset
(
&
serstruct
,
0
,
sizeof
(
serstruct
));
serstruct
.
type
=
PORT_16654
;
serstruct
.
type
=
PORT_16654
;
...
@@ -864,10 +848,10 @@ static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file, un
...
@@ -864,10 +848,10 @@ static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file, un
break
;
break
;
default:
default:
return
-
ENOIOCTLCMD
;
break
;
}
}
return
0
;
return
-
ENOIOCTLCMD
;
}
}
...
...
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