svn commit: r304567 - head/sys/dev/usb/input

2016-08-21 Thread Bruce Evans
Author: bde
Date: Sun Aug 21 16:06:00 2016
New Revision: 304567
URL: https://svnweb.freebsd.org/changeset/base/304567

Log:
  Fix translation of the PrintScreen/SysRq and Pause/Break keys.  Almost
  everything was broken.  The cases that I noticed were Ctrl-PrintScreen
  not being mapped to the virtual scancode 0x5c (debug) and Pause not being
  mapped to the physical/virtual scancode 0x46 (slock).
  
  These keys are the most complicated ones due to kludges to give some
  compatibility back to before AT keyboards.
  
  Alt-PrintScreen must pretend to be a separate key from PrintScreen
  even at the "raw" level.  The (unique) usb code for it is 0x8a and we
  just have to map this to our unique virtual scancode 0x54, but we
  mapped it first to the internal code 0x7e and then to 0x79 which is a
  key on the Japanese 106/109 keyboard.  This fix is under the
  UKBD_EMULATE_ATASCANCODE option which shouldn't be used for non-AT
  keyboards.  If it is, then the syscons Japanese keymaps have nothing
  of importance for code 0x79 and can easily be changed.  0x54 is also
  unimportant in Japanese and US keymaps.
  
  NonAlt-PrintScreen and NonCtl-Pause/Break had many much larger bugs with
  smaller compatibility problems from fixing them.  The details are too
  ugly to give here.  Summary of the changed (hex) codes:
  
  K_RAW  PrintScreen (Ctl, Shift, Ctl-Shift): E0-2A-E0-37 -> E0-37
  K_RAW  Alt-PrintScreen (all shift states):  79 -> 54
  K_RAW  Pause/Break (unshifted, Shift, Alt, Alt-Shift)): E0-46 -> E1-1D-45
  K_CODE ALT-PrintScreen (all shift states):  79 -> 54
  
  That is 15 of 32 shift combinations for 2 keys fixed, with 8 easy cases
  from the 79 -> 54 remapping.
  
  The difference is only large and with no workaround using a keymap for
  for K_RAW, but this affects other modes when ukbd is layered under kbmux
  because kbmux keeps all subdevices in K_RAW mode and translates.  Oops.
  I used kbdmux to generate the above table of changes.

Modified:
  head/sys/dev/usb/input/ukbd.c

Modified: head/sys/dev/usb/input/ukbd.c
==
--- head/sys/dev/usb/input/ukbd.c   Sun Aug 21 16:03:44 2016
(r304566)
+++ head/sys/dev/usb/input/ukbd.c   Sun Aug 21 16:06:00 2016
(r304567)
@@ -323,7 +323,7 @@ static const uint8_t ukbd_trtab[256] = {
NN, NN, NN, NN, 115, 108, 111, 113, /* 70 - 77 */
109, 110, 112, 118, 114, 116, 117, 119, /* 78 - 7F */
121, 120, NN, NN, NN, NN, NN, 123,  /* 80 - 87 */
-   124, 125, 126, 127, 128, NN, NN, NN,/* 88 - 8F */
+   124, 125, 84, 127, 128, NN, NN, NN, /* 88 - 8F */
129, 130, NN, NN, NN, NN, NN, NN,   /* 90 - 97 */
NN, NN, NN, NN, NN, NN, NN, NN, /* 98 - 9F */
NN, NN, NN, NN, NN, NN, NN, NN, /* A0 - A7 */
@@ -1659,17 +1659,6 @@ next_code:
}
}
break;
-   /* XXX: I don't like these... */
-   case 0x5c:  /* print screen */
-   if (sc->sc_flags & ALTS) {
-   keycode = 0x54; /* sysrq */
-   }
-   break;
-   case 0x68:  /* pause/break */
-   if (sc->sc_flags & CTLS) {
-   keycode = 0x6c; /* break */
-   }
-   break;
}
 
/* return the key code in the K_CODE mode */
@@ -2049,7 +2038,7 @@ ukbd_key2scan(struct ukbd_softc *sc, int
/* 90-99 */
0x11d,  /* Ctrl-R */
0x135,  /* Divide */
-   0x137 | SCAN_PREFIX_SHIFT,  /* PrintScreen */
+   0x137,  /* PrintScreen */
0x138,  /* Alt-R */
0x147,  /* Home */
0x148,  /* Up */
@@ -2100,13 +2089,15 @@ ukbd_key2scan(struct ukbd_softc *sc, int
if ((code >= 89) && (code < (int)(89 + nitems(scan {
code = scan[code - 89];
}
+   /* PrintScreen */
+   if (code == 0x137 && (!(shift & (MOD_CONTROL_L | MOD_CONTROL_R |
+   MOD_ALT_L | MOD_ALT_R | MOD_SHIFT_L | MOD_SHIFT_R {
+   code |= SCAN_PREFIX_SHIFT;
+   }
/* Pause/Break */
-   if ((code == 104) && (!(shift & (MOD_CONTROL_L | MOD_CONTROL_R {
+   if ((code == 0x146) && (!(shift & (MOD_CONTROL_L | MOD_CONTROL_R {
code = (0x45 | SCAN_PREFIX_E1 | SCAN_PREFIX_CTL);
}
-   if (shift & (MOD_SHIFT_L | MOD_SHIFT_R)) {
-   code &= ~SCAN_PREFIX_SHIFT;
-   }
code |= (up ? SCAN_RELEASE : SCAN_PRESS);
 
if (code & SCAN_PREFIX) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304567 - head/sys/dev/usb/input

2016-08-23 Thread Bryan Drewery
On 8/22/2016 1:59 AM, Bruce Evans wrote:
> On Sun, 21 Aug 2016, Hans Petter Selasky wrote:
> 
>> On 08/21/16 18:06, Bruce Evans wrote:
>>> Author: bde
>>> Date: Sun Aug 21 16:06:00 2016
>>> New Revision: 304567
>>> URL: https://svnweb.freebsd.org/changeset/base/304567
>>
>> Don't forget to MFC.
> 
> I had forgotten if for this commit.  I might do it for combined
> commits, but don't have enough svn fu for as many MFCs as I would
> like.  I want a few things back to FreeBSD-7.
> 
> Bruce
> 

I've written a script to do MFCing with the proper svn merge style for
each branch.  It's not perfect but it seems good enough.

https://people.freebsd.org/~bdrewery/mfc.sh

It can take multiple revisions.
cd svn/stable/7
mfc.sh r123 r124 r125

It will merge each one at a time, invoke EDITOR for conflicts (SVN does
this), then opens EDITOR to edit the commit log and saves that to
'commit'. You can then review and modify the commit as you like and 'svn
commit -F commit' when done to use the saved commit log.

If you pass -r to it then it will also prepare an email in mutt to send
to r...@freebsd.org for approval to commit.

It defaults to merging from head, but in the case of wanting to commit
to releng/ you need to pass -b to specify which branch to merge from,
such as -b stable/11 for releng/11.0 commits.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r304567 - head/sys/dev/usb/input

2016-08-23 Thread Ngie Cooper (yaneurabeya)

> On Aug 23, 2016, at 13:38, Bryan Drewery  wrote:

…

> I've written a script to do MFCing with the proper svn merge style for
> each branch.  It's not perfect but it seems good enough.
> 
> https://people.freebsd.org/~bdrewery/mfc.sh
> 
> It can take multiple revisions.
> cd svn/stable/7
> mfc.sh r123 r124 r125
> 
> It will merge each one at a time, invoke EDITOR for conflicts (SVN does
> this), then opens EDITOR to edit the commit log and saves that to
> 'commit'. You can then review and modify the commit as you like and 'svn
> commit -F commit' when done to use the saved commit log.
> 
> If you pass -r to it then it will also prepare an email in mutt to send
> to r...@freebsd.org for approval to commit.
> 
> It defaults to merging from head, but in the case of wanting to commit
> to releng/ you need to pass -b to specify which branch to merge from,
> such as -b stable/11 for releng/11.0 commits.

I have one that I noted a while back — it’s a bit less featureful, but it works 
pretty well IMHO:

https://github.com/yaneurabeya/scratch/blob/master/common/home/ngie/bin/mfc
https://github.com/yaneurabeya/scratch/blob/master/common/home/ngie/bin/mfc_log

Example usage:

~/mfc ^/head 
# Do whatever you need to make sure that the commit is ok.
svn ci -F commit

The only thing it fubars is some of the spacing with some of the commit 
messages (I don’t remember if it was with my commits being MFCed or other’s 
commits being MFCed). I’m a bit pedantic about formatting -- that’s the only 
reason why I haven’t posted it up earlier as an official solution for others to 
use.

Cheers,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r304567 - head/sys/dev/usb/input

2016-08-23 Thread Bryan Drewery
On 8/23/2016 1:49 PM, Ngie Cooper (yaneurabeya) wrote:
> 
>> On Aug 23, 2016, at 13:38, Bryan Drewery  wrote:
> 
> …
> 
>> I've written a script to do MFCing with the proper svn merge style for
>> each branch.  It's not perfect but it seems good enough.
>>
>> https://people.freebsd.org/~bdrewery/mfc.sh
>>
>> It can take multiple revisions.
>> cd svn/stable/7
>> mfc.sh r123 r124 r125
>>
>> It will merge each one at a time, invoke EDITOR for conflicts (SVN does
>> this), then opens EDITOR to edit the commit log and saves that to
>> 'commit'. You can then review and modify the commit as you like and 'svn
>> commit -F commit' when done to use the saved commit log.
>>
>> If you pass -r to it then it will also prepare an email in mutt to send
>> to r...@freebsd.org for approval to commit.
>>
>> It defaults to merging from head, but in the case of wanting to commit
>> to releng/ you need to pass -b to specify which branch to merge from,
>> such as -b stable/11 for releng/11.0 commits.
> 
> I have one that I noted a while back — it’s a bit less featureful, but it 
> works pretty well IMHO:
> 
> https://github.com/yaneurabeya/scratch/blob/master/common/home/ngie/bin/mfc
> https://github.com/yaneurabeya/scratch/blob/master/common/home/ngie/bin/mfc_log
> 
> Example usage:
> 
> ~/mfc ^/head 
> # Do whatever you need to make sure that the commit is ok.
> svn ci -F commit
> 
> The only thing it fubars is some of the spacing with some of the commit 
> messages (I don’t remember if it was with my commits being MFCed or other’s 
> commits being MFCed). I’m a bit pedantic about formatting -- that’s the only 
> reason why I haven’t posted it up earlier as an official solution for others 
> to use.
> 

Well yours only supports stable/10+ and not 9- with the older merge style.


-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r304567 - head/sys/dev/usb/input

2016-08-23 Thread Ngie Cooper (yaneurabeya)

> On Aug 23, 2016, at 13:57, Bryan Drewery  wrote:

...

> Well yours only supports stable/10+ and not 9- with the older merge style.

*shrugs* The older method promoted broken mergeinfo… The method I wrote 
up works fine with ^/stable/9- — just with non-sparse checkouts (I don’t 
recommend sparse checkouts, again because it can screw up mergeinfo) :).
Thanks,
-Ngie


signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r304567 - head/sys/dev/usb/input

2016-08-23 Thread Bruce Evans

On Tue, 23 Aug 2016, Ngie Cooper (yaneurabeya) wrote:


On Aug 23, 2016, at 13:57, Bryan Drewery  wrote:

...


Well yours only supports stable/10+ and not 9- with the older merge style.


*shrugs* The older method promoted broken mergeinfo? The method I wrote 
up works fine with ^/stable/9- ? just with non-sparse checkouts (I don?t 
recommend sparse checkouts, again because it can screw up mergeinfo) :).


I have to/want to use a very sparse checkout.  Currently 19MB.  This
doesn't seem to have caused any problems so far, except I somehow got
.svn databases in the most active subdirs.

Bruce___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r304567 - head/sys/dev/usb/input

2016-08-21 Thread Hans Petter Selasky

On 08/21/16 18:06, Bruce Evans wrote:

Author: bde
Date: Sun Aug 21 16:06:00 2016
New Revision: 304567
URL: https://svnweb.freebsd.org/changeset/base/304567



Don't forget to MFC.

--HPS

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r304567 - head/sys/dev/usb/input

2016-08-22 Thread Bruce Evans

On Sun, 21 Aug 2016, Hans Petter Selasky wrote:


On 08/21/16 18:06, Bruce Evans wrote:

Author: bde
Date: Sun Aug 21 16:06:00 2016
New Revision: 304567
URL: https://svnweb.freebsd.org/changeset/base/304567


Don't forget to MFC.


I had forgotten if for this commit.  I might do it for combined
commits, but don't have enough svn fu for as many MFCs as I would
like.  I want a few things back to FreeBSD-7.

Bruce
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"