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
16c7cc30
Commit
16c7cc30
authored
Dec 04, 2003
by
Ahmon Dancy
Committed by
Greg Kroah-Hartman
Dec 04, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] USB: add TIOCMIWAIT support to pl2303 driver
parent
d0d2d872
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
drivers/usb/serial/pl2303.c
drivers/usb/serial/pl2303.c
+43
-0
No files found.
drivers/usb/serial/pl2303.c
View file @
16c7cc30
...
...
@@ -169,6 +169,7 @@ static struct usb_serial_device_type pl2303_device = {
struct
pl2303_private
{
spinlock_t
lock
;
wait_queue_head_t
delta_msr_wait
;
u8
line_control
;
u8
line_status
;
u8
termios_initialized
;
...
...
@@ -186,6 +187,7 @@ static int pl2303_startup (struct usb_serial *serial)
return
-
ENOMEM
;
memset
(
priv
,
0x00
,
sizeof
(
struct
pl2303_private
));
spin_lock_init
(
&
priv
->
lock
);
init_waitqueue_head
(
&
priv
->
delta_msr_wait
);
usb_set_serial_port_data
(
serial
->
port
[
i
],
priv
);
}
return
0
;
...
...
@@ -556,11 +558,51 @@ static int pl2303_tiocmget (struct usb_serial_port *port, struct file *file)
return
result
;
}
static
int
wait_modem_info
(
struct
usb_serial_port
*
port
,
unsigned
int
arg
)
{
struct
pl2303_private
*
priv
=
usb_get_serial_port_data
(
port
);
unsigned
long
flags
;
unsigned
int
prevstatus
;
unsigned
int
status
;
unsigned
int
changed
;
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
prevstatus
=
priv
->
line_status
;
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
while
(
1
)
{
interruptible_sleep_on
(
&
priv
->
delta_msr_wait
);
/* see if a signal did it */
if
(
signal_pending
(
current
))
return
-
ERESTARTSYS
;
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
status
=
priv
->
line_status
;
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
changed
=
prevstatus
^
status
;
if
(((
arg
&
TIOCM_RNG
)
&&
(
changed
&
UART_RING
))
||
((
arg
&
TIOCM_DSR
)
&&
(
changed
&
UART_DSR
))
||
((
arg
&
TIOCM_CD
)
&&
(
changed
&
UART_DCD
))
||
((
arg
&
TIOCM_CTS
)
&&
(
changed
&
UART_CTS
))
)
{
return
0
;
}
prevstatus
=
status
;
}
/* NOTREACHED */
return
0
;
}
static
int
pl2303_ioctl
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
dbg
(
"%s (%d) cmd = 0x%04x"
,
__FUNCTION__
,
port
->
number
,
cmd
);
switch
(
cmd
)
{
case
TIOCMIWAIT
:
dbg
(
"%s (%d) TIOCMIWAIT"
,
__FUNCTION__
,
port
->
number
);
return
wait_modem_info
(
port
,
arg
);
default:
dbg
(
"%s not supported = 0x%04x"
,
__FUNCTION__
,
cmd
);
break
;
...
...
@@ -703,6 +745,7 @@ static void pl2303_read_bulk_callback (struct urb *urb, struct pt_regs *regs)
spin_lock_irqsave
(
&
priv
->
lock
,
flags
);
status
=
priv
->
line_status
;
spin_unlock_irqrestore
(
&
priv
->
lock
,
flags
);
wake_up_interruptible
(
&
priv
->
delta_msr_wait
);
/* break takes precedence over parity, */
/* which takes precedence over framing errors */
...
...
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