Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1300806pxk; Thu, 10 Sep 2020 11:55:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyunZb4sfOfKDkszjLEE7IEoveCF40FidgkH23lNwgkz44YkfJaH0fUSviaGeB9vFdO5UFk X-Received: by 2002:a17:906:780f:: with SMTP id u15mr10932269ejm.259.1599764115765; Thu, 10 Sep 2020 11:55:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599764115; cv=none; d=google.com; s=arc-20160816; b=jOod+O5AFCmDRLHg4xYl4Vg3m9T1wC+6n5ZlpXZzIVYs5mpGlPVkdIN/L3C+jKZZWw Tbr0ML9wyuZa0MqxBNYuUReCMMbPITTJL7IaKubU/vruPp4d00XXl8/dWbJvRKzAiZz2 vdowjEA9Dj3Wcr0qTna97B9F9X+wrPHfg20mJzDGJ+CIjglbg1PlHqY/KZJmU6bKwcqg TYinc67G8WfeWO+SZdiWTc1lVcqUAqhd6jmb2kgBpxUll64dnbx871PE7y0D01j+0D7q Q6X7tNoRB+D74zLmJA/qoBGdE9tWotJlr4+yWh5XpUNMHniJf3Ebs6yOgfiP0wZO8g9w 95Vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NoURE3RosGdEZhUcwRMpu2K3apR4AlJgBKa/tawEZfk=; b=kuIr3A+3PcPwRxJEXKtKh1OSTyICgJctZBctdFnFmxFVt5TICm3o9gFXfLeP43uvNp KW+7rMTcImdO5pVga12LZQtsHdAy27muEUjAAcBSEGAHomCzk/4BCmZrYFzRbH8w59cH UXjQXOLs/3rsr5ZiJMiYgxT01Q90JTvPq/qLFAqvCZDDzCfRtAWyAR6sqDc8UTNkIopm stP2v/VfJlUfnGKCtOXZQYTJPiDU0IM7BR36v4oapF+pCl2l3u9/POWhzJzWXEiCfdw4 GMiz2t3GwpvKiWdj8qY83QelIKeAoMPA4o34lLFKlmtPFmHQneNkNvCb6mTKUWXBo3BC nZtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Z/IeTM2e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si4085250ejg.609.2020.09.10.11.54.34; Thu, 10 Sep 2020 11:55:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Z/IeTM2e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725913AbgIJSx0 (ORCPT + 99 others); Thu, 10 Sep 2020 14:53:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726871AbgIJSwN (ORCPT ); Thu, 10 Sep 2020 14:52:13 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C735CC061756; Thu, 10 Sep 2020 11:52:00 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id m6so8081199wrn.0; Thu, 10 Sep 2020 11:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NoURE3RosGdEZhUcwRMpu2K3apR4AlJgBKa/tawEZfk=; b=Z/IeTM2e5NkdtHQMUTb3OBmgHD+yR+MMTlGFeyQDVmqgkF5U8650h+tRODQpFU5kgu mo7+bXbrs+gl/nHwF3XbbNUYNC+RwCYpn/Mfr64lBXPq9IzuhbYQm1e/1jftVD8V7/2p esqP62aZvxUvJLR5XZQZldvaHkKKyHC8hawG/RRtVj3A6Ve3SZzXKbAGJGJu8SA5mbiK YqQ1PcoouNZD6SyHdF20+qEnJrBar560sZujlPoMVVddRMqCtSLf8rssgtqmXupduZwY 9vbxwvV04Zo0pv+n6oVhpSlXvE6YVz80BNjhKmxyah2pAotDUvJErEg1xdoxEIBKbuEv ZhxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NoURE3RosGdEZhUcwRMpu2K3apR4AlJgBKa/tawEZfk=; b=Y2CkRtPKo7Hh/r7dAJIAQfeJj9f5nr0RuY7rZcuuvtRAoH1+7VNnr+zovsvieNQNA3 dNoGdhBxN6zeyEj3DI1zcbDD/+wERD+LSw7nR3YIV1TSzME7+iFiH7Y3BsZoruF57RoB kwnShsOC6KEK+8KjTv6yuhwLBo73xUwNB5CZ73bc8wv6PS4AsE5kfx2Rej/aGePEDo/E 4ucrl4F/GH7odjPl9J5ZqcVQunxRTQb6ySvLuANjeHg3eJJIhi0oviqqRxwK5oVs+c5y G13Z64HiIGnPbe8c26pAGGHgogS0asDb0HLEuJA8oXUa/SvFDeyOrrJE7Mb02wIHiEdt 96VA== X-Gm-Message-State: AOAM532anGwOSGArnSvWy305PgJPPvJOaZSk9n4T7SrdxJ0bYKfL012H I7iIATlwyhoidFq1w1c7zZwIt59Uc5bOm/6eB2mpAwB9BfE= X-Received: by 2002:a05:6000:1152:: with SMTP id d18mr10331726wrx.173.1599763919345; Thu, 10 Sep 2020 11:51:59 -0700 (PDT) MIME-Version: 1.0 References: <20200909193419.2006744-1-james.hilliard1@gmail.com> <1599706954.10822.3.camel@suse.de> <20200910080850.GD24441@localhost> <20200910085541.GA1099591@kroah.com> <26a723e4-e166-6377-875a-f737a15dc6b1@marcansoft.com> In-Reply-To: <26a723e4-e166-6377-875a-f737a15dc6b1@marcansoft.com> From: James Hilliard Date: Thu, 10 Sep 2020 12:51:47 -0600 Message-ID: Subject: Re: [PATCH v2] usb: serial: Repair FTDI FT232R bricked eeprom To: Hector Martin Cc: Greg Kroah-Hartman , Johan Hovold , Lars Melin , Oliver Neukum , linux-usb@vger.kernel.org, Linux Kernel Mailing List , Russ Dill Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 10, 2020 at 3:57 AM Hector Martin wrote: > > On 10/09/2020 18.52, James Hilliard wrote: > > So I'm having trouble coming up with a reliable way to fix this in userspace, > > I've already got quite a few moving parts there as is and most of what I > > come up with seems like it would not work reliably, at least for automatically > > repairing the eeprom. > > I'm confused as to why this is hard to fix in userspace. You already > said you have userspace code binding to the proper VID/PID, so your code > won't find the bricked device. Then it's just a matter of having a udev > rule run the unbricker when it detects the bad device (which should > issue a USB reset when it's done reprogramming, making the device appear > as the right VID/PID), thus effectively doing the same thing the kernel > does. If this is embedded and not using udev, then substitute whatever > equivalent you have. If you're polling for the device at runtime instead > and don't have a device manager, just poll for the VID 0 device too and > apply the fix. Wouldn't you have to do a bunch of stuff like unbind the ftdi_sio driver before you can issue usb control commands from userspace? I haven't tested this yet but my assumption was that either a kernel driver or libusb can issue usb control messages, but both can not be bound to a device at the same time. I figured this wouldn't have come up when you tested your python script since the script likely predated adding the brick PID to the ftdi_sio Linux kernel driver. Maybe it makes sense to add a sysfs interface for reading/writing eeprom values without having to unbind the ftdi_sio driver. > > I can't think of a scenario where this would be difficult to fix in > userspace... > > -- > Hector Martin (hector@marcansoft.com) > Public Key: https://mrcn.st/pub