Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
drivers
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Liam Naddell
drivers
Commits
1e519c75
Commit
1e519c75
authored
Sep 28, 2016
by
Jeremy Soller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement control and navigation in ps2 driver
parent
13b64da0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
4 deletions
+43
-4
ps2d/src/keyboard.rs
ps2d/src/keyboard.rs
+43
-4
No files found.
ps2d/src/keyboard.rs
View file @
1e519c75
...
...
@@ -9,6 +9,7 @@ pub fn keyboard() {
let
mut
file
=
File
::
open
(
"irq:1"
)
.expect
(
"ps2d: failed to open irq:1"
);
let
mut
input
=
File
::
open
(
"display:input"
)
.expect
(
"ps2d: failed to open display:input"
);
let
mut
ctrl
=
false
;
let
mut
lshift
=
false
;
let
mut
rshift
=
false
;
loop
{
...
...
@@ -27,14 +28,52 @@ pub fn keyboard() {
(
data
,
true
)
};
if
scancode
==
0x2A
{
if
scancode
==
0x1D
{
ctrl
=
pressed
;
}
else
if
scancode
==
0x2A
{
lshift
=
pressed
;
}
else
if
scancode
==
0x36
{
rshift
=
pressed
;
}
else
if
pressed
{
let
c
=
keymap
::
get_char
(
scancode
,
lshift
||
rshift
);
if
c
!=
'\0'
{
input
.write
(
&
[
c
as
u8
])
.expect
(
"ps2d: failed to write input"
);
match
scancode
{
0x47
=>
{
// Home
input
.write
(
b
"
\x1B
[H"
)
.unwrap
();
},
0x48
=>
{
// Up
input
.write
(
b
"
\x1B
[A"
)
.unwrap
();
},
0x49
=>
{
// Page up
input
.write
(
b
"
\x1B
[5~"
)
.unwrap
();
},
0x4B
=>
{
// Left
input
.write
(
b
"
\x1B
[D"
)
.unwrap
();
},
0x4D
=>
{
// Right
input
.write
(
b
"
\x1B
[C"
)
.unwrap
();
},
0x4F
=>
{
// End
input
.write
(
b
"
\x1B
[F"
)
.unwrap
();
},
0x50
=>
{
// Down
input
.write
(
b
"
\x1B
[B"
)
.unwrap
();
},
0x51
=>
{
// Page down
input
.write
(
b
"
\x1B
[6~"
)
.unwrap
();
},
_
=>
{
let
c
=
if
ctrl
{
match
keymap
::
get_char
(
scancode
,
false
)
{
c
@
'a'
...
'z'
=>
(
c
as
u8
-
b
'a'
+
b
'\x01'
)
as
char
,
c
=>
c
}
}
else
{
keymap
::
get_char
(
scancode
,
lshift
||
rshift
)
};
if
c
!=
'\0'
{
input
.write
(
&
[
c
as
u8
])
.unwrap
();
}
}
}
}
}
else
{
...
...
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