Re: [edk2-devel] [PATCH v2 1/1] OvmfPkg: OVMF supports USB mouses

2024-04-10 Thread Gerd Hoffmann
On Tue, Apr 09, 2024 at 04:51:20PM +0100, Pedro Falcato wrote:
> On Tue, Apr 9, 2024 at 12:56 PM Gerd Hoffmann  wrote:
> >
> > On Mon, Apr 08, 2024 at 08:53:10AM +0100, Phillip Tennen wrote:
> > > Hi, thank you for taking a look at the patch!
> > >
> > > This patch can be verified to be working with this app (which was the
> > > motivation for submitting this):
> > > https://github.com/codyd51/uefirc/releases/tag/1.0.1.
> >
> > Quoting https://github.com/codyd51/uefirc:
> >
> > Q: Should I use this?
> > A: This should not exist.
> >
> > Well.  This certainly one of the more interesting ways to have some fun
> > and improve your rust coding skills.  But a justification to include a
> > mouse driver by default which is not used by anything else?  IMHO it
> > isn't.
> 
> Maybe some better reasons:
> 
> 1) It has been conspicuously missing from OVMF. I've heard N questions
> over the years (on the #osdev IRC, etc) regarding their mouse code not
> working on OVMF, whereas you'd see that protocol in other normal
> platforms

Those other platforms often have a funky setup application which (unlike
UiApp) actually support using the mouse.

So, I'm still wondering what applications people want use the mouse for?

> For sure, UsbMouseDxe isn't #1 on my most desired EFI modules list
> (e.g I'd love to eventually be able to consume Ext4Dxe from OVMF,
> where it'd actually be useful, if I can ever ditch edk2-platforms),
> but I don't really see the harm in doing it.

UsbMouseDxe is IMHO the least useful driver.

We have:
  - Ps2MouseDxe, exposing EFI_SIMPLE_POINTER_PROTOCOL, and
  - UsbMouseDxe, exposing EFI_SIMPLE_POINTER_PROTOCOL too, and
  - UsbMouseAbsolutePointerDxe, exposing EFI_ABSOLUTE_POINTER_PROTOCOL.

On the qemu side a ps/2 mouse is always present.  Working with a
relative pointer device in a virtual machine isn't very smooth though,
which why qemu offers absolute pointer devices as alternative
(usb-tablet, virtio-tablet).

So a typical configuration (on x64, aa64 is a different story) is to
have a ps/2 mouse and an usb tablet.  qemu will start in relative
pointer mode and send events to the mouse.  As soon as the guest
activates the tablet (typically when the linux kernel loads the usb hid
drivers) qemu switches into absolute pointer mode and sends events to
the tablet.

Linux applications don't have to worry about relative vs. absolute
pointer mode.  The display server (x11/wayland) will deal with that for
them, they get the pointer position already translated to screen
coordinates.

That is not the case for efi applications though.  If they want work
with both relative and absolute pointing devices they have to implement
both protocols.

Now the tricky part here is that efi applications implementing only
EFI_SIMPLE_POINTER_PROTOCOL will *not* work in case
UsbMouseAbsolutePointerDxe included in the firmware image.  Loading the
driver will activate absolute pointer mode and qemu will route events
to the tablet not the mouse ...

> There's an argument in giving people a full-fledged UEFI
> implementation of most protocols. OVMF is *the* platform in mainline
> edk2 after all :)

If we do that we IMHO should
 (a) add a config option for that (similar to the rarely used scsi
 drivers),
 (b) update all ovmf variants consistently, and
 (c) include both ps/2 and usb mouse drivers.

Not sure whenever it is a good idea to include
UsbMouseAbsolutePointerDxe.

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117584): https://edk2.groups.io/g/devel/message/117584
Mute This Topic: https://groups.io/mt/105365480/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 1/1] OvmfPkg: OVMF supports USB mouses

2024-04-09 Thread Pedro Falcato
On Tue, Apr 9, 2024 at 12:56 PM Gerd Hoffmann  wrote:
>
> On Mon, Apr 08, 2024 at 08:53:10AM +0100, Phillip Tennen wrote:
> > Hi, thank you for taking a look at the patch!
> >
> > This patch can be verified to be working with this app (which was the
> > motivation for submitting this):
> > https://github.com/codyd51/uefirc/releases/tag/1.0.1.
>
> Quoting https://github.com/codyd51/uefirc:
>
> Q: Should I use this?
> A: This should not exist.
>
> Well.  This certainly one of the more interesting ways to have some fun
> and improve your rust coding skills.  But a justification to include a
> mouse driver by default which is not used by anything else?  IMHO it
> isn't.

Maybe some better reasons:

1) It has been conspicuously missing from OVMF. I've heard N questions
over the years (on the #osdev IRC, etc) regarding their mouse code not
working on OVMF, whereas you'd see that protocol in other normal
platforms
2) UsbMouseDxe is part of upstream MdeModulePkg and has no testable
upstream consumers. One needs to patch their OVMF to test this easily
(or flash it onto some other hardware, which is hard to get for most
people, except for maybe the rpi platforms).
3) I don't believe (or would hope) OVMF maintainers will have
maintenance overhead from the inclusion. One would hope UsbMouseDxe
as-is is correct, and that the QEMU USB mouse is correct (or you'd see
the problem from the guest OS's side as well).
4) Mouse support is part of the spec (if you want to argue it
shouldn't be in the spec in the first place, I'd agree)

For sure, UsbMouseDxe isn't #1 on my most desired EFI modules list
(e.g I'd love to eventually be able to consume Ext4Dxe from OVMF,
where it'd actually be useful, if I can ever ditch edk2-platforms),
but I don't really see the harm in doing it.

There's an argument in giving people a full-fledged UEFI
implementation of most protocols. OVMF is *the* platform in mainline
edk2 after all :)

-- 
Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117549): https://edk2.groups.io/g/devel/message/117549
Mute This Topic: https://groups.io/mt/105365480/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 1/1] OvmfPkg: OVMF supports USB mouses

2024-04-09 Thread Ard Biesheuvel
On Tue, 9 Apr 2024 at 13:56, Gerd Hoffmann  wrote:
>
> On Mon, Apr 08, 2024 at 08:53:10AM +0100, Phillip Tennen wrote:
> > Hi, thank you for taking a look at the patch!
> >
> > This patch can be verified to be working with this app (which was the
> > motivation for submitting this):
> > https://github.com/codyd51/uefirc/releases/tag/1.0.1.
>
> Quoting https://github.com/codyd51/uefirc:
>
> Q: Should I use this?
> A: This should not exist.
>
> Well.  This certainly one of the more interesting ways to have some fun
> and improve your rust coding skills.  But a justification to include a
> mouse driver by default which is not used by anything else?  IMHO it
> isn't.
>

Agreed.

> Note that you can load drivers from efi shell with the 'load' command,
> so there is no need to have a ovmf firmware image with the mouse drivers
> included.  You can boot into efi shell and use a startup.nsh script to
> automatically load drivers needed and start the irc app.
>

startup.nsh is ignored unless you boot into the EFI shell.

UEFI supports 'driver' entries in addition to Boot entries, which
can be programmed (using efibootmgr under Linux, for instance) to
point to a UEFI driver on the ESP that needs to be loaded at boot,
before any boot options are evaluated.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117545): https://edk2.groups.io/g/devel/message/117545
Mute This Topic: https://groups.io/mt/105365480/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 1/1] OvmfPkg: OVMF supports USB mouses

2024-04-09 Thread Gerd Hoffmann
On Mon, Apr 08, 2024 at 08:53:10AM +0100, Phillip Tennen wrote:
> Hi, thank you for taking a look at the patch!
> 
> This patch can be verified to be working with this app (which was the
> motivation for submitting this):
> https://github.com/codyd51/uefirc/releases/tag/1.0.1.

Quoting https://github.com/codyd51/uefirc:

Q: Should I use this?
A: This should not exist.

Well.  This certainly one of the more interesting ways to have some fun
and improve your rust coding skills.  But a justification to include a
mouse driver by default which is not used by anything else?  IMHO it
isn't.

Note that you can load drivers from efi shell with the 'load' command,
so there is no need to have a ovmf firmware image with the mouse drivers
included.  You can boot into efi shell and use a startup.nsh script to
automatically load drivers needed and start the irc app.

HTH & take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117544): https://edk2.groups.io/g/devel/message/117544
Mute This Topic: https://groups.io/mt/105365480/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 1/1] OvmfPkg: OVMF supports USB mouses

2024-04-09 Thread Phillip Tennen
Hi, thank you for taking a look at the patch!

This patch can be verified to be working with this app (which was the
motivation for submitting this):
https://github.com/codyd51/uefirc/releases/tag/1.0.1.

I am happy to switch to a tablet device if that's a clearer choice (pending
environment setup/line ending issues on my end while generating the patch).

I am also happy to add this to other Omvf variants, but am less confident in
my ability to test those.

All the best,
Phillip

On Mon, Apr 8, 2024 at 8:35 AM Gerd Hoffmann  wrote:

> On Sat, Apr 06, 2024 at 02:41:54PM +0200, Heinrich Schuchardt wrote:
> > From: Phillip Tennen 
> >
> > From: Phillip Tennen 
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4747
> >
> > UsbMouseDxe was missing from the OVMF build description, so=20
> > the Simple Pointer Protocol wasn't usable from within QEMU.
>
> What is the use case?
>
> How can this be tested?  As far I know neither the edk2 setup utility
> (aka UiApp) nor typical OS boot loaders have mouse support ...
>
> Also note that virtual machines typically do *not* have a mouse but a
> tablet device, so UsbMouseAbsolutePointerDxe looks like the more
> sensible choice to me.
>
> >  OvmfPkg/OvmfPkgX64.dsc | 1 +
> >  OvmfPkg/OvmfPkgX64.fdf | 1 +
>
> What about the other ovmf variants?
>
> take care,
>   Gerd
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117539): https://edk2.groups.io/g/devel/message/117539
Mute This Topic: https://groups.io/mt/105365480/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH v2 1/1] OvmfPkg: OVMF supports USB mouses

2024-04-08 Thread Gerd Hoffmann
On Sat, Apr 06, 2024 at 02:41:54PM +0200, Heinrich Schuchardt wrote:
> From: Phillip Tennen 
> 
> From: Phillip Tennen 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4747
> 
> UsbMouseDxe was missing from the OVMF build description, so=20
> the Simple Pointer Protocol wasn't usable from within QEMU.

What is the use case?

How can this be tested?  As far I know neither the edk2 setup utility
(aka UiApp) nor typical OS boot loaders have mouse support ...

Also note that virtual machines typically do *not* have a mouse but a
tablet device, so UsbMouseAbsolutePointerDxe looks like the more
sensible choice to me.

>  OvmfPkg/OvmfPkgX64.dsc | 1 +
>  OvmfPkg/OvmfPkgX64.fdf | 1 +

What about the other ovmf variants?

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117492): https://edk2.groups.io/g/devel/message/117492
Mute This Topic: https://groups.io/mt/105365480/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




[edk2-devel] [PATCH v2 1/1] OvmfPkg: OVMF supports USB mouses

2024-04-06 Thread Heinrich Schuchardt
From: Phillip Tennen 

From: Phillip Tennen 

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4747

UsbMouseDxe was missing from the OVMF build description, so=20
the Simple Pointer Protocol wasn't usable from within QEMU.

Here's an example of someone getting tripped up by this:
https://forum.osdev.org/viewtopic.php?f=1=31572.

Signed-off-by: Phillip Tennen 
Reviewed-by: Heinrich Schuchardt 
---
v2:
fix formatting problems leading to the patch not being applicable
move both insertions below UsbKbDxe
update commit message
---
 OvmfPkg/OvmfPkgX64.dsc | 1 +
 OvmfPkg/OvmfPkgX64.fdf | 1 +
 2 files changed, 2 insertions(+)

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index 56c920168d25..b775db6e0919 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -952,6 +952,7 @@ [Components]
   MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
   MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
   MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
   MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 !include OvmfPkg/Include/Dsc/ShellComponents.dsc.inc
diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf
index eb3fb90cb8b6..bfe201a352d0 100644
--- a/OvmfPkg/OvmfPkgX64.fdf
+++ b/OvmfPkg/OvmfPkgX64.fdf
@@ -342,6 +342,7 @@ [FV.DXEFV]
 INF  MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
+INF  MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouseDxe.inf
 INF  MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf
 
 INF  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf
-- 
2.43.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117467): https://edk2.groups.io/g/devel/message/117467
Mute This Topic: https://groups.io/mt/105365480/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-