Skip to content

Commit

Permalink
Increase PS/2 timeouts for reset (#1079)
Browse files Browse the repository at this point in the history
The previous arbitrary timeout value works in QEMU,
but does not work on a Dell Optiplex 9020.

With the new higher timeout values, Theseus successfully boots
with a Cherry and a HP keyboard and two Logitech mice,
though the devices still do not seem to function correctly. f2fe78a
  • Loading branch information
kevinaboos committed Dec 5, 2023
1 parent 27b5630 commit 9fe8ca1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions doc/src/ps2/lib.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@
<span class="doccomment">/// Reset the mouse.
</span><span class="kw">pub fn </span>reset(<span class="kw-2">&amp;</span><span class="self">self</span>) -&gt; <span class="prelude-ty">Result</span>&lt;(), <span class="kw-2">&amp;</span><span class="lifetime">&#39;static </span>str&gt; {
<span class="self">self</span>.command_to_mouse(HostToMouseCommandOrData::MouseCommand(Reset))<span class="question-mark">?</span>;
<span class="kw">const </span>VERY_ARBITRARY_TIMEOUT_VALUE: u16 = u16::MAX;
<span class="kw">const </span>VERY_ARBITRARY_TIMEOUT_VALUE: u32 = u16::MAX <span class="kw">as </span>u32 * <span class="number">3</span>;
<span class="kw">for _ in </span><span class="number">0</span>..VERY_ARBITRARY_TIMEOUT_VALUE {
<span class="kw">if let </span><span class="prelude-val">Ok</span>(SelfTestPassed) = <span class="self">self</span>.controller.read_data().try_into() { <span class="comment">//not sure if we need to do this here, as command_to_mouse handles it on real hardware at least (same goes for keyboard reset)
//returns mouse id 0
Expand Down Expand Up @@ -1611,7 +1611,7 @@
<span class="self">self</span>.command_to_keyboard(HostToKeyboardCommandOrData::KeyboardCommand(ResetAndStartSelfTest))<span class="question-mark">?</span>;
<span class="comment">// VirtualBox and presumably real hardware wants this. Qemu worked without this.
// Sadly self.controller.polling_receive doesn&#39;t work here, either.
</span><span class="kw">const </span>VERY_ARBITRARY_TIMEOUT_VALUE: u16 = u16::MAX;
</span><span class="kw">const </span>VERY_ARBITRARY_TIMEOUT_VALUE: u32 = u16::MAX <span class="kw">as </span>u32 * <span class="number">4</span>;
<span class="kw">for _ in </span><span class="number">0</span>..VERY_ARBITRARY_TIMEOUT_VALUE {
<span class="kw">if let </span><span class="prelude-val">Ok</span>(SelfTestPassed) = <span class="self">self</span>.controller.read_data().try_into() {
<span class="kw">return </span><span class="prelude-val">Ok</span>(())
Expand Down
2 changes: 1 addition & 1 deletion doc/stdio/struct.KeyEventQueueReader.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A reader to keyevent ring buffer."><title>KeyEventQueueReader in stdio - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-9ee3a5e31a2afa3e.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="stdio" data-themes="" data-resource-suffix="" data-rustdoc-version="1.75.0-nightly (aa1a71e9e 2023-10-26)" data-channel="nightly" data-search-js="search-8fbf244ebcf71464.js" data-settings-js="settings-74424d7eec62a23e.js" ><script src="../static.files/storage-fec3eaa3851e447d.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f34af1a0ee6bacd.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-5d8b3c7633ad77ba.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../stdio/index.html">stdio</a><span class="version">0.1.0</span></h2></div><h2 class="location"><a href="#">KeyEventQueueReader</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.read_one">read_one</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Clone-for-KeyEventQueueReader">Clone</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-KeyEventQueueReader">!RefUnwindSafe</a></li><li><a href="#impl-UnwindSafe-for-KeyEventQueueReader">!UnwindSafe</a></li><li><a href="#impl-Send-for-KeyEventQueueReader">Send</a></li><li><a href="#impl-Sync-for-KeyEventQueueReader">Sync</a></li><li><a href="#impl-Unpin-for-KeyEventQueueReader">Unpin</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-T">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-T">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-T">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-From%3CT%3E-for-T">From&lt;T&gt;</a></li><li><a href="#impl-Into%3CU%3E-for-T">Into&lt;U&gt;</a></li><li><a href="#impl-ToOwned-for-T">ToOwned</a></li><li><a href="#impl-TryFrom%3CU%3E-for-T">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-T">TryInto&lt;U&gt;</a></li></ul></section><h2><a href="index.html">In crate stdio</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Struct <a href="index.html">stdio</a>::<wbr><a class="struct" href="#">KeyEventQueueReader</a><button id="copy-path" title="Copy item path to clipboard"><img src="../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="src" href="../src/stdio/lib.rs.html#321-324">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub struct KeyEventQueueReader { /* private fields */ }</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A reader to keyevent ring buffer.</p>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-KeyEventQueueReader" class="impl"><a class="src rightside" href="../src/stdio/lib.rs.html#356-363">source</a><a href="#impl-KeyEventQueueReader" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.KeyEventQueueReader.html" title="struct stdio::KeyEventQueueReader">KeyEventQueueReader</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.read_one" class="method"><a class="src rightside" href="../src/stdio/lib.rs.html#359-362">source</a><h4 class="code-header">pub fn <a href="#method.read_one" class="fn">read_one</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;KeyEvent&gt;</h4></section></summary><div class="docblock"><p>Try to read a keyevent from the ring buffer. It returns <code>None</code> if currently
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-KeyEventQueueReader" class="impl"><a class="src rightside" href="../src/stdio/lib.rs.html#356-363">source</a><a href="#impl-KeyEventQueueReader" class="anchor">§</a><h3 class="code-header">impl <a class="struct" href="struct.KeyEventQueueReader.html" title="struct stdio::KeyEventQueueReader">KeyEventQueueReader</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.read_one" class="method"><a class="src rightside" href="../src/stdio/lib.rs.html#359-362">source</a><h4 class="code-header">pub fn <a href="#method.read_one" class="fn">read_one</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../keycodes_ascii/struct.KeyEvent.html" title="struct keycodes_ascii::KeyEvent">KeyEvent</a>&gt;</h4></section></summary><div class="docblock"><p>Try to read a keyevent from the ring buffer. It returns <code>None</code> if currently
the ring buffer is empty.</p>
</div></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor">§</a></h2><div id="trait-implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-Clone-for-KeyEventQueueReader" class="impl"><a class="src rightside" href="../src/stdio/lib.rs.html#320">source</a><a href="#impl-Clone-for-KeyEventQueueReader" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.KeyEventQueueReader.html" title="struct stdio::KeyEventQueueReader">KeyEventQueueReader</a></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl"><a class="src rightside" href="../src/stdio/lib.rs.html#320">source</a><a href="#method.clone" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fn">clone</a>(&amp;self) -&gt; <a class="struct" href="struct.KeyEventQueueReader.html" title="struct stdio::KeyEventQueueReader">KeyEventQueueReader</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="src" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#169">source</a></span><a href="#method.clone_from" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fn">clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&amp;Self</a>)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor">§</a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-KeyEventQueueReader" class="impl"><a href="#impl-RefUnwindSafe-for-KeyEventQueueReader" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.KeyEventQueueReader.html" title="struct stdio::KeyEventQueueReader">KeyEventQueueReader</a></h3></section><section id="impl-Send-for-KeyEventQueueReader" class="impl"><a href="#impl-Send-for-KeyEventQueueReader" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.KeyEventQueueReader.html" title="struct stdio::KeyEventQueueReader">KeyEventQueueReader</a></h3></section><section id="impl-Sync-for-KeyEventQueueReader" class="impl"><a href="#impl-Sync-for-KeyEventQueueReader" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.KeyEventQueueReader.html" title="struct stdio::KeyEventQueueReader">KeyEventQueueReader</a></h3></section><section id="impl-Unpin-for-KeyEventQueueReader" class="impl"><a href="#impl-Unpin-for-KeyEventQueueReader" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.KeyEventQueueReader.html" title="struct stdio::KeyEventQueueReader">KeyEventQueueReader</a></h3></section><section id="impl-UnwindSafe-for-KeyEventQueueReader" class="impl"><a href="#impl-UnwindSafe-for-KeyEventQueueReader" class="anchor">§</a><h3 class="code-header">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.KeyEventQueueReader.html" title="struct stdio::KeyEventQueueReader">KeyEventQueueReader</a></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor">§</a></h2><div id="blanket-implementations-list"><details class="toggle implementors-toggle"><summary><section id="impl-Any-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#135">source</a><a href="#impl-Any-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<span class="where fmt-newline">where
T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#136">source</a><a href="#method.type_id" class="anchor">§</a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fn">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-T" class="impl"><a class="src rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208">source</a><a href="#impl-Borrow%3CT%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<span class="where fmt-newline">where
Expand Down
Loading

0 comments on commit 9fe8ca1

Please sign in to comment.