Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mattias Fält
moberg
Commits
88f97efd
Commit
88f97efd
authored
Mar 31, 2021
by
Anders Blomdell
Browse files
Ignore `get bit 31`, used as event_char for FTDI USB/serial adaptors
parent
fab36bc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/serial2002/serial2002_lib.c
View file @
88f97efd
...
...
@@ -91,7 +91,7 @@ struct moberg_status serial2002_read(int f, long timeout,
value
->
index
=
0
;
value
->
value
=
0
;
length
=
0
;
while
(
1
)
{
while
(
value
->
kind
==
is_invalid
)
{
unsigned
char
data
;
struct
moberg_status
result
=
tty_read
(
f
,
timeout
,
&
data
);
if
(
!
OK
(
result
))
{
...
...
@@ -106,6 +106,7 @@ struct moberg_status serial2002_read(int f, long timeout,
return
MOBERG_ERRNO
(
EFBIG
);
break
;
}
else
{
value
->
index
=
data
&
0x1f
;
if
(
length
==
1
)
{
switch
((
data
>>
5
)
&
0x03
)
{
case
0
:{
...
...
@@ -116,13 +117,25 @@ struct moberg_status serial2002_read(int f, long timeout,
value
->
value
=
1
;
value
->
kind
=
is_digital
;
}
break
;
case
2
:{
if
(
data
==
0x5f
)
{
/* Ignore FTDI USB/serial event character (get bit 31) */
value
->
kind
=
is_invalid
;
value
->
index
=
0
;
value
->
value
=
0
;
length
=
0
;
}
else
{
return
MOBERG_ERRNO
(
EINVAL
);
}
}
break
;
case
3
:{
return
MOBERG_ERRNO
(
EINVAL
);
}
break
;
}
}
else
{
value
->
value
=
(
value
->
value
<<
2
)
|
((
data
&
0x60
)
>>
5
);
value
->
kind
=
is_channel
;
}
value
->
index
=
data
&
0x1f
;
break
;
}
}
return
MOBERG_OK
;
...
...
Write
Preview
Supports
Markdown
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