[Top][All Lists]

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

Re: USB bulk transfert from GRUB ?

From: Nicolas de Pesloüan
Subject: Re: USB bulk transfert from GRUB ?
Date: Sun, 26 Dec 2010 17:39:23 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101030 Icedove/3.0.10

Le 26/12/2010 13:05, Vladimir 'φ-coder/phcoder' Serbinenko a écrit :

I think we can reasonably discover the particular switchable and
bootable device a grub-mkconfig time and put the single (vendor-id,
device-id, end-point-number, switch-string) in grub.cfg :

usb_bulk_write --vendor 0x0af0 --device 0x7501 --endpoint 0 \

(example from /etc/usb_modeswitch.d/0af0:7501)

How exactly do we do it on mkconfig time? What prevents doing it on runtime?

Thinking about it for long, I don't really know which of mkconfig time or 
runtime is the best.

##### mkconfig time #####

I originally thought I would simply add the required switch command into some menuentry in grub.cfg, to switch the device, if the volume is located on a well known switchable device.

In prepare_grub_to_access_device() (in /usr/lib/grub/grub-mkconfig_lib), one can add some commands (or options to the search command), to switch the device, if the device that hold the boot volume is known to be switchable.

I also thought grub-probe might be enhanced (in probe() function) to query the vendor/product id of the underlying physical device and look for those vendor/product id in the usb_modeswitch database, then report "switchable" as an abstraction.

But, having a closer look at it, I now understand that this would require crossing all the levels down to the physical device, which might be a little tricky. (I don't know, may be it is something already done somewhere).

##### runtime #####

Nothing prevent selecting the right switch string and end-point at run time, based on the vendor/product id and the usb_modeswitch database. This is exactly what usb_modeswitch do. It might even be possible to share part of the code between usb_modeswitch and the GRUB counterpart, only changing the function calls from libusb to GRUB usb library. (Of course, the license for usb_modeswitch should be double checked before).

But we need to have a way to decide which device to switch and which not to switch, based on whether we need this particular device to boot. Again, switching a device early might lead to some problem later, in the operating system. For example, if we boot Windows from GRUB, having the Option device connected (and switched by GRUB), then Windows won't have access to the driver (which is located on the virtual CD), preventing the installation of this driver.

But here, we face a chicken and egg problem: In order to know a given device should be switched, we need to search the UUID (ou label or whatever) in this device.


May be I walk the wrong way. It might be enough to add "usb_modeswitch" to GRUB_PRELOAD_MODULES in /etc/default/grub if one plan to boot from a switchable device, and let the "usb_modeswitch" module switch all known devices at runtime. This assume people able to build such a boot environment are not in trouble with installing the Windows driver by hand if they use Windows...

Or may be we can just add the switch feature in all menuentry except those clearly linked to Windows in 30_os-prober, assuming that switching early cannot cause trouble to any OS except Windows.

I don't know...


reply via email to

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