Re: cwm(1): minor edit to keybinding

2020-02-17 Thread Ryan Lennox
Good point! I retract the diff, please ignore.

‐‐‐ Original Message ‐‐‐
On Tuesday, February 18, 2020 12:36 AM, Martijn van Duren 
 wrote:

> No, "?" is not always under "/", this is just for the US layout.
> One example that comes to mind is the Belgian AZERTY keyboard
> layout, where "?" on the same key as "," and there are probably more
> examples out there.
>
> martijn@
>
> On 2/18/20 1:56 AM, Ryan Lennox wrote:
>
> > Hi,
> > As a new cwm user, I spent several minutes trying to figure out why the
> > M-question prompt wasn't launching any programs.
> > I smacked my forehead when I realized I was just pressing M-slash, which
> > happens to display a very similar prompt.
> > Normally I wouldn't bother posting about something this simple, but I
> > later came across a thread on the OpenBSD subreddit where another user
> > was equally confused over the same issue. [1]
> > I think the confusion stems from this keybinding being the only one in
> > the manual with an implicit modifier.
> > [1] 
> > https://www.reddit.com/r/openbsd/comments/d3elv6/opening_programs_in_cwm_am_i_missing_something/
> >
> > Index: app/cwm/cwm.1
> >
> > =
> >
> > RCS file: /cvs/xenocara/app/cwm/cwm.1,v
> > retrieving revision 1.65
> > diff -u -p -r1.65 cwm.1
> > --- app/cwm/cwm.1 9 Jul 2019 21:38:44 - 1.65
> > +++ app/cwm/cwm.1 17 Feb 2020 22:29:08 -
> > @@ -136,7 +136,7 @@ Resize window by a small amount.
> > .It Ic CMS-[hjkl]
> > Resize window by a large amount; see
> > .Xr cwmrc 5 .
> > -.It Ic M-question
> > +.It Ic MS-slash
> > Spawn
> > .Dq exec program
> > dialog.




cwm(1): minor edit to keybinding

2020-02-17 Thread Ryan Lennox
Hi,

As a new cwm user, I spent several minutes trying to figure out why the
M-question prompt wasn't launching any programs.

I smacked my forehead when I realized I was just pressing M-slash, which
happens to display a very similar prompt.

Normally I wouldn't bother posting about something this simple, but I
later came across a thread on the OpenBSD subreddit where another user
was equally confused over the same issue. [1]

I think the confusion stems from this keybinding being the only one in
the manual with an implicit modifier.

[1] 
https://www.reddit.com/r/openbsd/comments/d3elv6/opening_programs_in_cwm_am_i_missing_something/


Index: app/cwm/cwm.1
===
RCS file: /cvs/xenocara/app/cwm/cwm.1,v
retrieving revision 1.65
diff -u -p -r1.65 cwm.1
--- app/cwm/cwm.1   9 Jul 2019 21:38:44 -   1.65
+++ app/cwm/cwm.1   17 Feb 2020 22:29:08 -
@@ -136,7 +136,7 @@ Resize window by a small amount.
 .It Ic CMS-[hjkl]
 Resize window by a large amount; see
 .Xr cwmrc 5 .
-.It Ic M-question
+.It Ic MS-slash
 Spawn
 .Dq exec program
 dialog.



splice out a knock function for alps touchpads in pms.c

2018-05-02 Thread Ryan Lennox
Hi,

Elantech has elantech_knock()
Synaptics has synaptics_knock()
Alps should have alps_knock()

I'd ask for ok, but I don't have an Alps touchpad to test it.


​Index: src/sys/dev/pckbc/pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.86
diff -u -p -r1.86 pms.c
--- src/sys/dev/pckbc/pms.c 29 Apr 2018 08:50:04 -  1.86
+++ src/sys/dev/pckbc/pms.c 2 May 2018 22:58:03 -
@@ -307,6 +307,7 @@ int synaptics_query(struct pms_softc *, 
 intsynaptics_get_hwinfo(struct pms_softc *);
 void   synaptics_sec_proc(struct pms_softc *);
 
+intalps_knock(struct pms_softc *);
 intalps_sec_proc(struct pms_softc *);
 intalps_get_hwinfo(struct pms_softc *);
 
@@ -1432,10 +1433,8 @@ alps_get_hwinfo(struct pms_softc *sc)
 }
 
 int
-pms_enable_alps(struct pms_softc *sc)
+alps_knock(struct pms_softc *sc)
 {
-   struct alps_softc *alps = sc->alps;
-   struct wsmousedev_attach_args a;
u_char resp[3];
 
if (pms_set_resolution(sc, 0) ||
@@ -1445,8 +1444,21 @@ pms_enable_alps(struct pms_softc *sc)
pms_get_status(sc, resp) ||
resp[0] != PMS_ALPS_MAGIC1 ||
resp[1] != PMS_ALPS_MAGIC2 ||
-   (resp[2] != PMS_ALPS_MAGIC3_1 && resp[2] != PMS_ALPS_MAGIC3_2 &&
-   resp[2] != PMS_ALPS_MAGIC3_3))
+   (resp[2] != PMS_ALPS_MAGIC3_1 &&
+resp[2] != PMS_ALPS_MAGIC3_2 &&
+resp[2] != PMS_ALPS_MAGIC3_3))
+   return (-1);
+
+   return (0);
+}
+
+int
+pms_enable_alps(struct pms_softc *sc)
+{
+   struct alps_softc *alps = sc->alps;
+   struct wsmousedev_attach_args a;
+
+   if (alps_knock(sc))
goto err;
 
if (sc->alps == NULL) {



typo in pms.c

2018-04-28 Thread Ryan Lennox
Hi,

caught a typo while digging around in here:

Index: src/sys/dev/pckbc/pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.85
diff -u -p -u -r1.85 pms.c
--- src/sys/dev/pckbc/pms.c 29 Jan 2018 21:54:11 -  1.85
+++ src/sys/dev/pckbc/pms.c 28 Apr 2018 22:13:40 -
@@ -2448,7 +2448,7 @@ pms_proc_elantech_v3(struct pms_softc *s
}
}
 
-   /* Prevent juming cursor if pad isn't touched or reports garbage. */
+   /* Prevent jumping cursor if pad isn't touched or reports garbage. */
if (w == 0 ||
((x == 0 || y == 0 || x == elantech->max_x || y == elantech->max_y)
&& (x != elantech->old_x || y != elantech->old_y))) {



minor readability improvement

2018-04-25 Thread Ryan Lennox
Hi,

I know this is trivial, but an extra "o" character here
might be worth the slight improvement in readability:


Index: src/sys/arch/amd64/stand/libsa/memprobe.c
===
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/memprobe.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 memprobe.c
--- src/sys/arch/amd64/stand/libsa/memprobe.c   10 Jun 2016 18:36:06 -  
1.17
+++ src/sys/arch/amd64/stand/libsa/memprobe.c   21 Apr 2018 06:10:13 -
@@ -309,7 +309,7 @@ memprobe(void)
extmem = 4 * 1024 * 1024 - 1024;
 
/* Check if gate A20 is on */
-   printf("a20=o%s] ", checkA20()? "n" : "ff!");
+   printf("a20=%s] ", checkA20() ? "on" : "off!");
 }
 #endif
 



amd64 EFI - kernel boots with obsolete memory map

2018-04-22 Thread Ryan Lennox
Hi,

efi_cleanup() invokes ExitBootServices, which changes the memory map on some 
EFI machines.

Since mem_pass() is called prior to efi_cleanup(), the kernel boots with an 
obsolete memory map.

The problem can be fixed by calling mem_pass() after efi_cleanup().

Here's the report history with more detailed information:

https://marc.info/?l=openbsd-bugs=148253785924157=2
https://marc.info/?l=openbsd-tech=148653092621349=2
https://marc.info/?l=openbsd-bugs=151887483824518=2

This patch should correct the problem. I've been using it since 6.0 on several 
machines (BIOS and EFI) without any issues.


Index: src/sys/arch/amd64/stand/libsa/exec_i386.c
===
RCS file: /cvs/src/sys/arch/amd64/stand/libsa/exec_i386.c,v
retrieving revision 1.22
diff -u -p -u -r1.22 exec_i386.c
--- src/sys/arch/amd64/stand/libsa/exec_i386.c  18 Apr 2018 16:34:42 -  
1.22
+++ src/sys/arch/amd64/stand/libsa/exec_i386.c  21 Apr 2018 05:57:48 -
@@ -78,7 +78,7 @@ run_loadfile(u_long *marks, int howto)
bios_bootsr_t bootsr;
struct sr_boot_volume *bv;
 #endif
-#if defined(EFIBOOT)
+#ifdef EFIBOOT
int i;
u_long delta;
extern u_long efi_loadaddr;
@@ -86,6 +86,7 @@ run_loadfile(u_long *marks, int howto)
if ((av = alloc(ac)) == NULL)
panic("alloc for bootarg");
efi_makebootargs();
+   delta = DEFAULT_KERNEL_ADDRESS - efi_loadaddr;
 #endif
if (sa_cleanup != NULL)
(*sa_cleanup)();
@@ -124,6 +125,17 @@ run_loadfile(u_long *marks, int howto)
sr_clear_keys();
 #endif
 
+   entry = marks[MARK_ENTRY] & 0x0fff;
+#ifdef EFIBOOT
+   entry += delta;
+#endif
+
+   printf("entry point at 0x%lx\n", entry);
+
+#ifdef EFIBOOT
+   /* Sync the memory map and call ExitBootServices() */
+   efi_cleanup();
+#endif
/* Pass memory map to the kernel */
mem_pass();
 
@@ -137,33 +149,24 @@ run_loadfile(u_long *marks, int howto)
makebootargs(av, );
 #endif
 
-   entry = marks[MARK_ENTRY] & 0x0fff;
-
-   printf("entry point at 0x%lx\n", entry);
-
-#ifndef EFIBOOT
-   /* stack and the gung is ok at this point, so, no need for asm setup */
-   (*(startfuncp)entry)(howto, bootdev, BOOTARG_APIVER, marks[MARK_END],
-   extmem, cnvmem, ac, (int)av);
-#else
+#ifdef EFIBOOT
/*
 * Move the loaded kernel image to the usual place after calling
 * ExitBootServices().
 */
-   delta = DEFAULT_KERNEL_ADDRESS - efi_loadaddr;
-   efi_cleanup();
memcpy((void *)marks[MARK_START] + delta, (void *)marks[MARK_START],
marks[MARK_END] - marks[MARK_START]);
for (i = 0; i < MARK_MAX; i++)
marks[i] += delta;
-   entry += delta;
+#endif
+
 #ifdef __amd64__
(*run_i386)((u_long)run_i386, entry, howto, bootdev, BOOTARG_APIVER,
marks[MARK_END], extmem, cnvmem, ac, (intptr_t)av);
 #else
+   /* stack and the gung is ok at this point, so, no need for asm setup */
(*(startfuncp)entry)(howto, bootdev, BOOTARG_APIVER, marks[MARK_END],
extmem, cnvmem, ac, (int)av);
-#endif
 #endif
/* not reached */
 }