grub-devel
[Top][All Lists]
Advanced

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

Re: USB bulk transfert from GRUB ?


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: USB bulk transfert from GRUB ?
Date: Sat, 25 Dec 2010 13:38:33 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101211 Icedove/3.0.11

On 12/20/2010 09:12 PM, Nicolas de Pesloüan wrote:
> Hi,
>
> Some USB devices require a specific command to be sent (using USB bulk
> transfer) before they switch
> to "storage mode". Such devices are switched by USBmodeSwitch
> (http://www.draisberghof.de/usb_modeswitch/), after the operating
> system start. USBmodeSwitch use
> libusb to send the right command to the right USB endpoint, depending
> on the ID of the USB device.
>
> In order to be able to boot from such devices, one needs to switch the
> device early, before the operating system is started. I think GRUB2
> should be the right place for this.
>
> For as far as I understand, libusb is available from inside GRUB2, 
No it's not. We use our own routines for USB transfers. Have a look at
include/grub/usb.h. E.g:
grub_usb_err_t
grub_usb_bulk_write (grub_usb_device_t dev,
                     int endpoint, grub_size_t size, char *data);
> so it shouldn't be really difficult to add a command to initiate a
> given bulk transfert to a given USB endpoint. (My understanding is
> that no such command already exists).
grub_usb_bulk_write does exactly this. However it's not to be exported
as a command
>
> Contrary to USBModeSwitch that use a database at runtime to decide how
> to switch the device, it is probably easier to decide this at
> grub-mkconfig time, using the same database.
>
Doing any USB detection at grub-mkconfig time is a bad idea. USB is in
flux and you can't possibly know e.g. the address of target device on
runtime. On the other hand it should be easy to write a parser for
device_reference.txt. It's also probably easier to write something that
small from scratch than to port it (all the value is in the database,
not code). Another question is how much autoconfigured it should be.
Some people may prefer these devices be in non-storage mode as usually
the only thing they store are useless buggy drivers.
> Of course, I perfectly understand that the first part of GRUB2 cannot
> be located from this kind of USB devices, because it needs to be
> loaded before GRUB2 start, and we would face a chicken and egg problem.
>
> Any comments ?
>
>     Nicolas.
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel
>


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]