Fix error reporting in Input::writeKeyboard()

write(2) only sets errno on failure; a successful call leaves it
unchanged.  We had been being using errno to determine whether or not
the write succeeded, but weren't zeroing it before the call and hence
could end up spuriously reporting failure from writeKeyboard() even when
the write actually succeeded.

That false report can in turn cause sendWakeupPacket() to not send the
key release after its XK_Shift_L key press, leading to the host thinking
the shift key is being held down, which among other minor bits of
confusion can cause a boot hang (Ubuntu's GRUB, for example, is patched
to interpret a held shift key as a signal from the user to interrupt its
default boot sequence and switch to an interactive menu).

We now instead just return success immediately after a complete write
and false otherwise (if we exhaust our retry attempts or hit a
non-EAGAIN failure).

Tested: verified with strace that obmc-ikvm sends both the press and the
release of the shift key in sendWakeupPacket(); Ubuntu host booted
cleanly instead of stopping at the GRUB menu.

Signed-off-by: Zev Weiss <zweiss@equinix.com>
Change-Id: Ic1229b3979690040879c7e4471ebc987878289e6
1 file changed
tree: 68c8750a102d477a060e46bf53d36732c7ac336b
  1. create_usbhid.sh
  2. ikvm_args.cpp
  3. ikvm_args.hpp
  4. ikvm_input.cpp
  5. ikvm_input.hpp
  6. ikvm_manager.cpp
  7. ikvm_manager.hpp
  8. ikvm_server.cpp
  9. ikvm_server.hpp
  10. ikvm_video.cpp
  11. ikvm_video.hpp
  12. LICENSE
  13. MAINTAINERS
  14. meson.build
  15. obmc-ikvm.cpp
  16. README.md
  17. scancodes.hpp
  18. start-ipkvm.service
README.md

OpenBMC IpKVM Server

The obmc-ikvm application is a VNC server that provides access to the host graphics output. The application interfaces with the video device on the BMC that captures the host graphics, and then serves that video data on the RFB (remote framebuffer, also known as VNC) protocol. The application also interfaces with the BMC USB gadget device to pass HID events from the BMC to the host, allowing the user to interact with the host system.

Usage

Once the host is running and an appropriate HID gadget device is instantiated on the BMC, the application can be started with the following command: obmc-ikvm -v <video device path> -i <HID gadget device path>

For example:

obmc-ikvm -v /dev/video0 -i /dev/hidg0