lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yzfd+GC7mH3P2Y0Y@google.com>
Date:   Fri, 30 Sep 2022 23:28:08 -0700
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Samuel Holland <samuel@...lland.org>
Cc:     Andy Shevchenko <andy.shevchenko@...il.com>,
        linux-input <linux-input@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Ondrej Jirman <x@....cz>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Chen-Yu Tsai <wens@...e.org>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
        linux-sunxi@...ts.linux.dev
Subject: Re: [PATCH v4 2/4] Input: pinephone-keyboard - Add PinePhone
 keyboard driver

On Mon, Jun 20, 2022 at 11:12:46PM -0500, Samuel Holland wrote:
> On 6/19/22 6:43 AM, Andy Shevchenko wrote:
> > On Sat, Jun 18, 2022 at 7:10 PM Samuel Holland <samuel@...lland.org> wrote:
> >>
> >> The official Pine64 PinePhone keyboard case contains a matrix keypad and
> >> a MCU which runs a libre firmware. Add support for its I2C interface.
> > 
> > ...
> > 
> >> +#include <linux/crc8.h>
> >> +#include <linux/i2c.h>
> >> +#include <linux/input/matrix_keypad.h>
> >> +#include <linux/interrupt.h>
> >> +#include <linux/module.h>
> >> +#include <linux/regulator/consumer.h>
> > 
> > Missed
> > types.h
> > 
> > ...
> > 
> >> +#define PPKB_ROWS                      6
> >> +#define PPKB_COLS                      12
> > 
> > ...
> > 
> >> +       for (col = 0; col < PPKB_COLS; ++col) {
> >> +               u8 old = old_buf[1 + col];
> >> +               u8 new = new_buf[1 + col];
> >> +               u8 changed = old ^ new;
> >> +
> >> +               if (!changed)
> >> +                       continue;
> >> +
> >> +               for (row = 0; row < PPKB_ROWS; ++row) {
> >> +                       u8 mask = BIT(row);
> >> +                       u8 value = new & mask;
> >> +                       unsigned short code;
> >> +                       bool fn_state;
> >> +
> >> +                       if (!(changed & mask))
> >> +                               continue;
> >> +
> >> +                       /*
> >> +                        * Save off the FN key state when the key was pressed,
> >> +                        * and use that to determine the code during a release.
> >> +                        */
> >> +                       fn_state = value ? ppkb->fn_pressed : ppkb->fn_state[col] & mask;
> >> +                       if (fn_state)
> >> +                               ppkb->fn_state[col] ^= mask;
> > 
> > Can't it be converted to use bitmap APIs?
> 
> This is a 2D matrix, with one byte per column, and one bit per row. There are
> only 6 rows, so two bits per byte are unused. Converting this to the bitmap API
> would unnecessarily complicate things.

We could have a constant bitmap masking the unused bits so they are
always skipped.

Anyway, I made a few edits and applied, we can continue improving the
driver in an iterative manner.

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ