All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/5] dm: usb: Add support for USB keyboards with driver model
Date: Mon, 19 Oct 2015 10:34:25 +0200	[thread overview]
Message-ID: <5624AB11.20302@redhat.com> (raw)
In-Reply-To: <CAPnjgZ2zt7QJ6GiOD42DABNivYVtT-YqnfmxaeptJDR-r1+4dQ@mail.gmail.com>

Hi,

On 19-10-15 01:17, Simon Glass wrote:
> Hi Hans,
>
> On 12 September 2015 at 09:15, Hans de Goede <hdegoede@redhat.com> wrote:
>> Hi,
>>
>> On 08-09-15 19:15, Simon Glass wrote:
>>>
>>> Switch USB keyboards over to use driver model instead of scanning with the
>>> horrible usb_get_dev_index() function. This involves creating a new uclass
>>> for keyboards, although so far there is no API.
>>>
>>> Signed-off-by: Simon Glass <sjg@chromium.org>
>>
>>
>> In general I like this patch, so ack for the principle, but the
>> implementation has issues.
>>
>> You're now allowing the registration of multiple usb keyb stdio
>> input devices, but you are still relying on usb_kbd_deregister()
>> to remove them from the stdio devices list, and when multiple
>> or used that one will only remove the first one.
>>
>> This can be fixed by switching to stdio_register_dev, and
>> store the returned struct stdio_dev pointer for the new dev,
>> and add a dm remove callback which deregisters that specific
>> stdio_dev that will also remove the ugliness of looking up
>> the device by its name to unregister it.
>>
>> The name which in itself is another, harder to fix issue,
>> when using iomux, and the stdin string contains usbkbd we
>> really want to get all usbkbd-s to work, but iomux will
>> only take the first one.
>>
>> This can be fixed in 2 ways:
>>
>> 1) in the usbkbd driver by registering a shared stdio_dev
>> for all usbkbd's and deregistering that only when the
>> last usbkbd is removed (in the case of dm), this will
>> require a global list of usbkbd devices, and stdio
>> callbacks to walk over this list, I believe that this
>> is likely the best approach
>>
>> 2) Fix this in iomux, and make it look for multiple
>> devs with the same name and mux them all.
>>
>> This seems cleaner at a conceptual level, but likely
>> somewhat hard to implement.
>>
>
> I've had another look at this and here are my comments so far:
>
> 1. The existing driver does not support multiple keyboards. It
> implements this limitation in multiple ways which would be a real pain
> to fix while keeping the old code. I think it makes much more sense to
> remove this limitation when we have either a) moved all uses of USB
> keyboard to driver model, or perhaps b) moved stdio to driver model.
> For now the driver model approach provides the same functionality as
> before so I think it is fine.

I think that supporting multiple keyboards the way I've outlined
above as "1)" should not be that hard. But I do not plan to make time
for this anytime soon, and as such I can hardly ask you to do this.

So I reluctantly agree to keep this as is (I was hoping the move
to dm would fix this).

> 2. The point about out-of-order devices in the 'usb tree'
> display....well if you disable unbinding that is what you get. I'm
> sure we could fix it by sorting the devices before displaying them,
> but it does not seem that important to me. It is more likely that the
> unbind support will be enabled in U-Boot proper, and perhaps disabled
> in SPL, which doesn't have commands anyway.

I'm fine with "usb tree" showing things the wrong way on builds where
unbinding is disabled. But if I remember the patch-set this thread is
about correctly, it completely removed unbinding from the usb code.

If you do a new version where unbinding is only skipped when compiled
out then that is fine with me.

Regards,

Hans

  reply	other threads:[~2015-10-19  8:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-08 17:15 [U-Boot] [PATCH 0/5] RFC: usb: Drop requirement for USB unbinding Simon Glass
2015-09-08 17:15 ` [U-Boot] [PATCH 1/5] Revert "dm: usb: Rename usb_find_child to usb_find_emul_child" Simon Glass
2015-09-08 17:15 ` [U-Boot] [PATCH 2/5] Revert "dm: usb: Use device_unbind_children to clean up usb devs on stop" Simon Glass
2015-09-08 17:15 ` [U-Boot] [PATCH 3/5] Revert "dm: Export device_remove_children / device_unbind_children" Simon Glass
2015-09-08 17:15 ` [U-Boot] [PATCH 4/5] dm: usb: Add support for USB keyboards with driver model Simon Glass
2015-09-08 18:33   ` Marek Vasut
2015-09-10  2:45     ` Simon Glass
2015-09-10 11:40       ` Marek Vasut
2015-09-11  0:43         ` Simon Glass
2015-09-11  8:14           ` Hans de Goede
2015-09-12 15:15   ` Hans de Goede
2015-10-18 23:17     ` Simon Glass
2015-10-19  8:34       ` Hans de Goede [this message]
2015-10-29 19:09         ` Simon Glass
2015-10-30 20:24           ` Simon Glass
2015-09-08 17:15 ` [U-Boot] [PATCH 5/5] dm: usb: Deprecate usb_get_dev_index() Simon Glass
2015-09-12 15:00 ` [U-Boot] [PATCH 0/5] RFC: usb: Drop requirement for USB unbinding Hans de Goede
2015-09-12 15:11   ` Simon Glass
2015-09-12 15:21     ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5624AB11.20302@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.