Mouse Cursor & Simple Pointer Protocol | UEFI Dev (in C)

Channel:
Subscribers:
3,970
Published on ● Video Link: https://www.youtube.com/watch?v=YImMImjGbhw



Duration: 2:03:14
1,150 views
43


Getting Simple Pointer Protocol instances and trying out basic (albeit inaccurate/stuttery) mouse support.

Notes:
- Still had an off by 1 error for the gop menu on the laptop, menu_bottom should be (menu_top + max-1), without that -1 moving down still shows an invalid mode 5. D'oh! That's fixed now in the repo.

- After this video, I tried cloning edk2 and building OVMF, but on alpine linux it failed on somewhat random files like build maintenance ui lib, seems it can't make some .c files in some of the modules.
Did not feel like debugging for days, so ended up using an ubuntu live install usb which worked.
Followed this: https://fabianlee.org/2018/09/12/kvm-building-the-latest-ovmf-firmware-for-virtual-machines/

Added line 'MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf' to OvmfPkg/OvmfPkgX64.dsc under the "Usb Support" section,
and 'MdeModulePkg/Bus/Isa/Ps2MouseDxe/Ps2MouseDxe.inf' under "ISA Support".

Also added 'INF MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf' to OvmfPkg/OvmfPkgX64.fdf under "Usb Support" and
'INF MdeModulePkg/Bus/Isa/Ps2MouseDxe/Ps2MouseDxe.inf' under "DXE Phase modules" after the Ps2KeyboardDxe line.

After building with 'build -a X64 -t GCC5 -b RELEASE -p OvmfPkg/OvmfPkgX64.dsc' and using qemu with flags '-usb' and '-device usb-mouse' a 2nd SPP showed up and is usable within qemu & ovmf.
The updated ovmf.fd file (renamed to bios64.bin) and qemu flags have been committed to the uefi gpt image creator repo (and thus this project), if you don't want to build OVMF yourself.

Links:
https://uefi.org/specifications (uefi & other specifications)

UEFI Programming playlist:
https://www.youtube.com/playlist?list=PLT7NbkyNWaqZYHNLtOZ1MNxOt8myP5K0p

Git Repo:
https://github.com/queso-fuego/uefi-dev

Repo state at the start of this video:
git clone --recurse-submodules https://github.com/queso-fuego/uefi-dev
cd uefi-dev
git checkout 7fa72572a9385ae4dc6d6fe17ec965dc72dfc000

Repo state at the end of this video (after a couple fixes):
git checkout 04a3d221f3d83989613da4d2d8b841166391014b

Next video:
- Reading files, getting date/time and a timer event, getting the memory map, or other things.

Join the Community Discord: https://discord.gg/yKm4T89QFn

Contact:
https://queso_fuego.srht.site/contact.html

- Let me know if there's anything specific you'd like to see!

Questions about setup/software/etc.?
Check the FAQ: https://queso_fuego.srht.site/about.html

Outline:
0:00:00 Intro, fix gop menu on laptop
0:05:51 Add mouse test function, get info from UEFI spec
0:18:18 Print invalid SPP mode info
0:27:03 Get multiple SPPs w/ LocateHandleBuffer() and OpenProtocol()
0:46:23 Get mouse event and state
1:00:15 Testing on laptop, draw a square cursor
1:30:49 Add a buffer for cursor pixels, & a couple of bug fixes
1:39:36 Test on laptop again, fix printing and draw arrow cursor non-destructively
2:00:44 Potential next topics & Outro

Music credits:
"Acid Trumpet" Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0 License
http://creativecommons.org/licenses/by/4.0/

Winter Night by Sakura Girl | https://soundcloud.com/sakuragirl_official
Music promoted by https://www.chosic.com/free-music/all/
Creative Commons CC BY 3.0
https://creativecommons.org/licenses/by/3.0/

#uefidev #cprogramming #mouse







Tags:
queso fuego
uefi dev
uefi programming
c programming
bootloader
mouse input
mouse cursor
uefi mouse
simple pointer protocol
spp
locate handle buffer