From: "Nicolas de Pesloüan" <nicolas.2p.debian@gmail.com>
To: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
Cc: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: USB bulk transfert from GRUB ?
Date: Sun, 26 Dec 2010 17:39:23 +0100 [thread overview]
Message-ID: <4D176FBB.4060103@gmail.com> (raw)
In-Reply-To: <4D172F7D.1090909@gmail.com>
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 \
>> --string
>> 0x55534243785634120100000080000601000000000000000000000000000000
>>
>> (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...
Nicolas.
next prev parent reply other threads:[~2010-12-26 16:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-20 20:12 USB bulk transfert from GRUB ? Nicolas de Pesloüan
2010-12-25 12:38 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-12-25 19:57 ` Nicolas de Pesloüan
2010-12-25 20:13 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-12-25 22:32 ` Nicolas de Pesloüan
2010-12-25 23:25 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-12-26 10:26 ` Nicolas de Pesloüan
2010-12-26 10:47 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-12-26 11:46 ` Nicolas de Pesloüan
2010-12-26 12:05 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-12-26 16:39 ` Nicolas de Pesloüan [this message]
2010-12-28 8:01 ` Nicolas de Pesloüan
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=4D176FBB.4060103@gmail.com \
--to=nicolas.2p.debian@gmail.com \
--cc=grub-devel@gnu.org \
--cc=phcoder@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).