media:/ shows unnecessary media

Kari Pihkala kari.pihkala at gmail.com
Sun May 29 04:19:24 CDT 2005


Hi,

sorry I haven't been able to respond for a while - I have a real job to do.. :(
Rajeev, thanks for bugfixing my code! (kcookiejar -> kded) :)

I have updated my script according to the previous posts. It now:

1. Hides swap and unknown partitions by preceeding them with .
2. Display names "Windows A7", "Linux A5" (uses hda7, hda5, stripping "hd" off)
3. Updates only those which don't yet have a user label (updating all
labels takes quite a while on my machine, i.e. about a sec.). This
also means that the user can change the name and it won't get
overwritten. However, I don't know what happens if you have removable
hds (if a removable hd is inserted, becomes "hdb1" and then removed
and a different hd is inserted, will it be "hdb1" and have the same
user label?).
4. It only updates the hd-devices, leaving other media untouched.
(i.e., floppy, cd-roms..)
5. option -f forces all disks to be relabeled, -c clears all user
labels (easier to test)

It doesn't use the harddisk volume labels now. The script is attached..

Rejeev, I tried your script, but it gives me an error:
"from: can't read /var/mail/pydcop"
I have the packages that you said should be installed. But don't know
anything about hal.. otherwise, the code looks more intelligent than
my hack to use the command line "dcop"..

About the configuration: yes, it would be nice if devices were
automatically configured. I tried my USB webcam, the system detected
it fine when I just plugged it in! When I plugged in my printer via
USB, it didn't configure it :(. If I run 'lsusb' it will show the
printer correctly. Why not configure it when detected? i.e., display a
simple dialog "USB Hewlett-Packard DeskJet 640c Printer Found - do you
want to add it to the system? Yes/No" USB would finally be truly "Plug
and play" :).

 - Kari

On 5/28/05, Rajeev J Sebastian <rajeev_jsv at dinamis.com> wrote:
> On Saturday 28 May 2005 11:34 am, Giuseppe Bilotta wrote:
> > On Sat, 28 May 2005 05:13:54 +0000, Rajeev J Sebastian wrote:
> > > I have a question:
> > >
> > > Is it only me ? or is anyone else having to mount via console ?
> > >
> > > pmount just isn't working. And there is no bug filed in bugzilla
> either.
> > > This is wierd, no one is reporting the inability to mount hard disks
> > > wuthin media:/.
> What about the above question ? Are you able to mount via pmount/fstab-sync
> or 
> not ? Does mounting via media:/ work (for partitions not in the fstab file)
> ?
> 
> > >
> > > Anyway, after waiting for Kari to respond for 2 days, I have made a
> > > simple script to do the renaming of media nodes with the following
> > > features:
> > >
> > > 1) If the partition has a volume label, it sets that as the label in
> > > media:/
> >
> > What happens if two medias have the same volume label?
> Yeah that is a problem :) Obviosly, we shouldn't allow that, but I havent 
> checked. But I also think
> 
> >
> > > 2) else if the user has already changed the name to something more
> > > appropriate in media:/, it sets that as the label in media :/
> >
> > Is this necessary? :)
> Yep its necessary, otherwise, we might overwrite the label set by the user.
> 
> >
> > > 3) else, it constructs a string "<OS> <device><partitionNumber>" where
> > > <OS> is currently, "Linux", "Windows" and ".Linux Swap", the <device>
> is
> > > A,B,C,D, etc. Volker's suggestion of using "." paid off and swap
> > > partitions are hidden.
> >
> > FWIW, Windows uses the term "Local disk (<drive letter>:)" for
> > unlabeled partitions. Something like "<OS> Local Disk
> > <device><partition number>" might be nice.
> As you said earlier, getting the drive letter is not that simple (since it 
> doesnt progress the same way on different machines). So I thought this was
> an 
> alternative.
> 
> About names, if you look at the code, you can see that the names can be 
> changed easily. In the attached script, I have changed them to (following 
> your need):
> 
> Device name -> label after rename_hdd.py
> /dev/hda1 (ext3) -> Linux Local Disk (A1)
> /dev/hda2 (swap) -> .Swap Disk (A2)
> /dev/hda3 (fat32) -> Windows Local Disk ( A3)
> 
> 
> If someone can give me a printout/screenshot of hal-device-manager showing
> the 
> Advanced properties of a USB stick, I can make sure that such disks are 
> labelled accordingly.
> 
> >
> > I can test it. Would it work with the Live Kubuntu DVD? I haven't
> > installed it on my system yet ...
> Well, as long as you have the dependencies (python2.4-dbus, python2.4-dcop
> and 
> python2.4) then it should run (you need to modify the /etc/defaults/hal as 
> well so that we can retrieve partition type info from HAL).
> 
> 
> 
> 
> I think, this is a good start to a kubuntu-specific default automation 
> package. Seeing the HAL/DBUS system and its bindings in Python, I think its
> 
> very possible to popup nice dialogs, control centre modules etc when devices
> 
> are loaded. For eg, wouldn't it be nice if the printer driver selection is 
> automatically started when a USB printer is started ? For me currently, this
> 
> doesnt occur (atleast for my Canon S200SPx).
> 
> perhaps, it is also a start to a kubuntu specific device-manager ?
> 
> 
> enjoy :)
> Rajeev J Sebastian
> 
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: relabelmedia.py
Type: application/x-python
Size: 2071 bytes
Desc: not available
Url : http://lists.ubuntu.com/archives/kubuntu-devel/attachments/20050529/de6fa1de/relabelmedia.bin


More information about the kubuntu-devel mailing list