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
5fac329f
Commit
5fac329f
authored
Apr 23, 2003
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: pl2303: add support for new tty tiocmget and tiocmset functions.
parent
16d94a31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
44 deletions
+19
-44
drivers/usb/serial/pl2303.c
drivers/usb/serial/pl2303.c
+19
-44
No files found.
drivers/usb/serial/pl2303.c
View file @
5fac329f
...
@@ -124,6 +124,9 @@ static void pl2303_write_bulk_callback (struct urb *urb, struct pt_regs *regs);
...
@@ -124,6 +124,9 @@ static void pl2303_write_bulk_callback (struct urb *urb, struct pt_regs *regs);
static
int
pl2303_write
(
struct
usb_serial_port
*
port
,
int
from_user
,
static
int
pl2303_write
(
struct
usb_serial_port
*
port
,
int
from_user
,
const
unsigned
char
*
buf
,
int
count
);
const
unsigned
char
*
buf
,
int
count
);
static
void
pl2303_break_ctl
(
struct
usb_serial_port
*
port
,
int
break_state
);
static
void
pl2303_break_ctl
(
struct
usb_serial_port
*
port
,
int
break_state
);
static
int
pl2303_tiocmget
(
struct
usb_serial_port
*
port
,
struct
file
*
file
);
static
int
pl2303_tiocmset
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
set
,
unsigned
int
clear
);
static
int
pl2303_startup
(
struct
usb_serial
*
serial
);
static
int
pl2303_startup
(
struct
usb_serial
*
serial
);
static
void
pl2303_shutdown
(
struct
usb_serial
*
serial
);
static
void
pl2303_shutdown
(
struct
usb_serial
*
serial
);
...
@@ -143,6 +146,8 @@ static struct usb_serial_device_type pl2303_device = {
...
@@ -143,6 +146,8 @@ static struct usb_serial_device_type pl2303_device = {
.
ioctl
=
pl2303_ioctl
,
.
ioctl
=
pl2303_ioctl
,
.
break_ctl
=
pl2303_break_ctl
,
.
break_ctl
=
pl2303_break_ctl
,
.
set_termios
=
pl2303_set_termios
,
.
set_termios
=
pl2303_set_termios
,
.
tiocmget
=
pl2303_tiocmget
,
.
tiocmset
=
pl2303_tiocmset
,
.
read_bulk_callback
=
pl2303_read_bulk_callback
,
.
read_bulk_callback
=
pl2303_read_bulk_callback
,
.
read_int_callback
=
pl2303_read_int_callback
,
.
read_int_callback
=
pl2303_read_int_callback
,
.
write_bulk_callback
=
pl2303_write_bulk_callback
,
.
write_bulk_callback
=
pl2303_write_bulk_callback
,
...
@@ -490,51 +495,35 @@ static void pl2303_close (struct usb_serial_port *port, struct file *filp)
...
@@ -490,51 +495,35 @@ static void pl2303_close (struct usb_serial_port *port, struct file *filp)
}
}
static
int
set_modem_info
(
struct
usb_serial_port
*
port
,
unsigned
int
cmd
,
unsigned
int
*
value
)
static
int
pl2303_tiocmset
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
set
,
unsigned
int
clear
)
{
{
struct
pl2303_private
*
priv
=
usb_get_serial_port_data
(
port
);
struct
pl2303_private
*
priv
=
usb_get_serial_port_data
(
port
);
unsigned
int
arg
;
u8
control
;
u8
control
;
if
(
copy_from_user
(
&
arg
,
value
,
sizeof
(
int
)))
return
-
EFAULT
;
spin_lock
(
&
priv
->
lock
);
spin_lock
(
&
priv
->
lock
);
switch
(
cmd
)
{
if
(
set
&
TIOCM_RTS
)
case
TIOCMBIS
:
priv
->
line_control
|=
CONTROL_RTS
;
if
(
arg
&
TIOCM_RTS
)
if
(
set
&
TIOCM_DTR
)
priv
->
line_control
|=
CONTROL_RTS
;
priv
->
line_control
|=
CONTROL_DTR
;
if
(
arg
&
TIOCM_DTR
)
if
(
clear
&
TIOCM_RTS
)
priv
->
line_control
|=
CONTROL_DTR
;
priv
->
line_control
&=
~
CONTROL_RTS
;
break
;
if
(
clear
&
TIOCM_DTR
)
priv
->
line_control
&=
~
CONTROL_DTR
;
case
TIOCMBIC
:
if
(
arg
&
TIOCM_RTS
)
priv
->
line_control
&=
~
CONTROL_RTS
;
if
(
arg
&
TIOCM_DTR
)
priv
->
line_control
&=
~
CONTROL_DTR
;
break
;
case
TIOCMSET
:
/* turn off RTS and DTR and then only turn
on what was asked to */
priv
->
line_control
&=
~
(
CONTROL_RTS
|
CONTROL_DTR
);
priv
->
line_control
|=
((
arg
&
TIOCM_RTS
)
?
CONTROL_RTS
:
0
);
priv
->
line_control
|=
((
arg
&
TIOCM_DTR
)
?
CONTROL_DTR
:
0
);
break
;
}
control
=
priv
->
line_control
;
control
=
priv
->
line_control
;
spin_unlock
(
&
priv
->
lock
);
spin_unlock
(
&
priv
->
lock
);
return
set_control_lines
(
port
->
serial
->
dev
,
control
);
return
set_control_lines
(
port
->
serial
->
dev
,
control
);
}
}
static
int
get_modem_info
(
struct
usb_serial_port
*
port
,
unsigned
int
*
valu
e
)
static
int
pl2303_tiocmget
(
struct
usb_serial_port
*
port
,
struct
file
*
fil
e
)
{
{
struct
pl2303_private
*
priv
=
usb_get_serial_port_data
(
port
);
struct
pl2303_private
*
priv
=
usb_get_serial_port_data
(
port
);
unsigned
int
mcr
;
unsigned
int
mcr
;
unsigned
int
result
;
unsigned
int
result
;
dbg
(
"%s (%d)"
,
__FUNCTION__
,
port
->
number
);
spin_lock
(
&
priv
->
lock
);
spin_lock
(
&
priv
->
lock
);
mcr
=
priv
->
line_control
;
mcr
=
priv
->
line_control
;
spin_unlock
(
&
priv
->
lock
);
spin_unlock
(
&
priv
->
lock
);
...
@@ -544,9 +533,7 @@ static int get_modem_info (struct usb_serial_port *port, unsigned int *value)
...
@@ -544,9 +533,7 @@ static int get_modem_info (struct usb_serial_port *port, unsigned int *value)
dbg
(
"%s - result = %x"
,
__FUNCTION__
,
result
);
dbg
(
"%s - result = %x"
,
__FUNCTION__
,
result
);
if
(
copy_to_user
(
value
,
&
result
,
sizeof
(
int
)))
return
result
;
return
-
EFAULT
;
return
0
;
}
}
static
int
pl2303_ioctl
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
static
int
pl2303_ioctl
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
...
@@ -554,17 +541,6 @@ static int pl2303_ioctl (struct usb_serial_port *port, struct file *file, unsign
...
@@ -554,17 +541,6 @@ static int pl2303_ioctl (struct usb_serial_port *port, struct file *file, unsign
dbg
(
"%s (%d) cmd = 0x%04x"
,
__FUNCTION__
,
port
->
number
,
cmd
);
dbg
(
"%s (%d) cmd = 0x%04x"
,
__FUNCTION__
,
port
->
number
,
cmd
);
switch
(
cmd
)
{
switch
(
cmd
)
{
case
TIOCMGET
:
dbg
(
"%s (%d) TIOCMGET"
,
__FUNCTION__
,
port
->
number
);
return
get_modem_info
(
port
,
(
unsigned
int
*
)
arg
);
case
TIOCMBIS
:
case
TIOCMBIC
:
case
TIOCMSET
:
dbg
(
"%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET"
,
__FUNCTION__
,
port
->
number
);
return
set_modem_info
(
port
,
cmd
,
(
unsigned
int
*
)
arg
);
default:
default:
dbg
(
"%s not supported = 0x%04x"
,
__FUNCTION__
,
cmd
);
dbg
(
"%s not supported = 0x%04x"
,
__FUNCTION__
,
cmd
);
break
;
break
;
...
@@ -573,7 +549,6 @@ static int pl2303_ioctl (struct usb_serial_port *port, struct file *file, unsign
...
@@ -573,7 +549,6 @@ static int pl2303_ioctl (struct usb_serial_port *port, struct file *file, unsign
return
-
ENOIOCTLCMD
;
return
-
ENOIOCTLCMD
;
}
}
static
void
pl2303_break_ctl
(
struct
usb_serial_port
*
port
,
int
break_state
)
static
void
pl2303_break_ctl
(
struct
usb_serial_port
*
port
,
int
break_state
)
{
{
struct
usb_serial
*
serial
=
port
->
serial
;
struct
usb_serial
*
serial
=
port
->
serial
;
...
...
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