Re: [PATCH v3 0/7] Additional fixes for Azoteq IQS7222A/B/C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 28, 2022 at 08:25:07AM -0500, Jeff LaBundy wrote:
> Hi Mattijs,
> 
> Thank you for reaching out and helping to review this series.
> 
> On Fri, Oct 28, 2022 at 09:56:37AM +0200, Mattijs Korpershoek wrote:
> > On sam., oct. 22, 2022 at 19:54, Jeff LaBundy <jeff@xxxxxxxxxxx> wrote:
> > 
> > > This series comprises a second round of fixes that result from
> > > continued testing and updated guidance from the vendor.
> > >
> > > Jeff LaBundy (7):
> > >   Input: iqs7222 - drop unused device node references
> > >   dt-bindings: input: iqs7222: Reduce 'linux,code' to optional
> > >   Input: iqs7222 - report malformed properties
> > >   dt-bindings: input: iqs7222: Correct minimum slider size
> > >   Input: iqs7222 - protect against undefined slider size
> > >   dt-bindings: input: iqs7222: Add support for IQS7222A v1.13+
> > >   Input: iqs7222 - add support for IQS7222A v1.13+
> > >
> > >  .../bindings/input/azoteq,iqs7222.yaml        |  25 +-
> > >  drivers/input/misc/iqs7222.c                  | 504 +++++++++++-------
> > >  2 files changed, 311 insertions(+), 218 deletions(-)
> > 
> > Not sure this requires a re-send, but the series seems ill-formatted.
> > all patches are posted separately to the list instead of replying to the
> > cover letter. Is that expected?
> 
> Yes, this was a goof on my part. I see that the series is threaded
> properly on Patchwork but not on lore.kernel.org.
> 
> Much to my dismay, my mail service recently began enforcing OAuth2
> but declined to enable app-specific passwords as Gmail and others
> do. I can therefore no longer use git send-email directly and I am

You can teach git to work with OAuth - I am using Gmail without
application specific passwords. You simply need to use the credential
helper that would give the token instead of a password.

I have the following in my .gitconfig:

[credential]
	helper = cache --timeout=3000
	helper = local-helper

and I am using the attached script that gets client ID and refresh token
from the disk and generates authentication token. The script is using
Google OAUTH library and endpoint, but since you taught mutt how to work
with your provider you should be able to adjust it as needed.

And please do not judge me for this script ;)

> instead emulating it with a script that tunnels patches through mutt.
> 
> In this last series, my script inadvertenly dropped the '< >' from
> the cover letter's message ID, so some mailers may see this series
> as seven separate threads. This is fixed now.
> 
> That being said, I see this series was already applied earlier this
> week; I think a mail simply did not go out. So no further action is
> needed.

Sorry, my bad, I forgot to send the notice.

Thanks.

-- 
Dmitry
#!/usr/bin/env python3

import argparse
import gnupg
import os
import sys
from google.oauth2.credentials import Credentials as Oauth2Creds
from google.auth.transport.requests import Request as AuthRequest

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)

class SMTPCredential(object):
    CONFIG_DICT = {
        'dtor@xxxxxxxxxxxx' : ('Chromium', False),
        'dtor@xxxxxxxxxx' : ('Google', False),
        'dmitry.torokhov@xxxxxxxxx' : ('Gmail', True),
        'dtor@xxxxxxxxxx' : ('Kernel.org', False),
    }

    def __init__(self):
        self.gpg = gnupg.GPG(gpgbinary="gpg2", use_agent=True)
        self.data_path = os.path.expanduser('~/.mutt/passwords/')

    def get_unencrypted_data(self, config_name):
        file_name = os.path.join(self.data_path, config_name)
        with open(file_name, 'r') as fp:
            lines = fp.read().splitlines()
            return next(iter(lines), None)

    def get_encrypted_data(self, config_name):
        file_name = os.path.join(self.data_path, config_name)
        with open(file_name, 'rb') as fp:
            crypt = self.gpg.decrypt_file(fp)
            if crypt.ok:
                lines = crypt.data.splitlines()
                return next(iter(lines), None)

    def get_password(self, config_name):
        return self.get_encrypted_data(config_name)

    def get_oauth2_creds(self, config_name):
        client_id = self.get_unencrypted_data(config_name + ".oauth.client")
        client_secret = self.get_encrypted_data(config_name + ".oauth.secret")
        refresh_token = self.get_encrypted_data(config_name + ".oauth.refresh")
        if client_id and client_secret and refresh_token:
            return Oauth2Creds(None,
                               refresh_token=refresh_token,
                               token_uri='https://oauth2.googleapis.com/token',
                               client_id=client_id,
                               client_secret=client_secret)

    def get_oauth2_token(self, config_name):
        creds = self.get_oauth2_creds(config_name)
        if creds:
            creds.refresh(AuthRequest())
            return creds.token

    def get(self, username, **kwargs):
        (name, oauth2) = self.CONFIG_DICT[username]
        secret = self.get_oauth2_token(name) if oauth2 \
                 else self.get_password(name)
        if secret:
            print("password={0}".format(secret))

def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('operation', action="store", type=str,
            help="Git action to be performed (get|store|erase)")
    # parse all arguments
    arguments = parser.parse_args()

    myvars = {}
    for line in sys.stdin:
        name, val = line.partition("=")[::2]
        myvars[name.strip()] = val.strip()

    if arguments.operation == "get":
        try:
            protocol = myvars.pop('protocol')
            username = myvars.pop('username')
            cred_class = globals()[protocol.upper() + "Credential"]
            cred = cred_class()
            cred.get(username, **myvars)
        except:
            eprint("Failed to get credential")
            raise
    elif arguments.operation == "store":
        pass
    elif arguments.operation == "erase":
        pass
    else:
        eprint("Invalid git operation")

if __name__ == "__main__":
    main()

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux