Re: How do I get the device description from a device object?



On Thu, 2011-08-25 at 12:41 -0500, Vallevand, Mark K wrote:
> I’m using python and everything is OK, except that I can’t find a way
> to get a device description from a device object.

What kind of description are you looking for?  Like what's shown in the
nm-applet menu or such?  If so, that description isn't provided by NM
itself (because any device description isn't really stable and might
change depending on what components you have in the system), but is
handled by 'libnm-glib' which you probably wouldn't be using with your
python program.

libnm-glib builds the description by looking for the device's entry the
udev database, and grabbing the ID_VENDOR_ENC/ID_MODEL_ENC fields.  udev
fills these fields from various sources, including the device itself (if
any textual description is available) and from static files like
pci.ids/usb.ids/pnp.ids.  If the device node itself doesn't have
anything, it queries the parent and grandparent.  (see
libnm-glib/nm-device.c's _device_update_description() method).

nm-applet attempts to fix this string up by replacing certain words and
removing other words (like "Inc" and "Company") which is kinda fragile
but pretty much works. (see network-manager-applet's src/utils/utils.c
utils_get_device_description() method).

I'd entertain the idea of adding this feature as a property of the
device objects in core NetworkManager, but realize that it (a) wouldn't
be translated at all to different languages, and (b) wouldn't be a
stable description across even minor system updates.

Dan

>  
> 
> A quick pointer is welcome.
> 
> Regards.
> Mark K Vallevand   Mark Vallevand Unisys com
> 
> Eagles may soar, but weasels don't get sucked into jet engines.
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE
> PROPRIETARY MATERIAL and is thus for use only by the intended
> recipient. If you received this in error, please contact the sender
> and delete the e-mail and its attachments from all computers.
> 
> 
> _______________________________________________
> networkmanager-list mailing list
> networkmanager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list




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