Mining Bits and Knowledge
Artigos com o marcador devicekit
Python e UDisks – Parte 2
30/03/11
| This post is also available in English |
Há alguns posts eu mostrei como listar todos os dispositivos de armazenamento conectados ao seu PC usando Python e UDisks. Neste post irei mostrar como trabalhar com a interface Disks do DeviceKit.
Primeiramente vamor ler algumas documentações! A documentação do UDisks é dividida em cinco sessões:
- Interface Disks;
- Interface Device;
- Interface Adapter;
- Interface Expander;
- Interface Port.
Python and UDisks – Part 2
30/03/11
| Este post também está disponível em Português |
In the last post I’ve shown how to enumerate all storage devices connected to your PC using Python and UDisks. In this post I’ll show how to work with DeviceKit Disks interface.
Fist lets read some documentations! The UDisks documentation is divided in five sections:
- Disks interface;
- Device interface;
- Adapter interface;
- Expander interface;
- Port interface.
Python e UDisks – Parte 1
14/03/11
| This post is also available in English |
Recentemente recebi diversos contatos de pessoas querendo saber se o USBManager iria suportar ou não o DeviceKit/UDev, uma vez que o HAL foi oficialmente descontinuado, então acabei retomando o desenvolvimento desse aplicativo.
Acabei percebendo algumas diferenças e pouca referência na internet, por isso vou postar algumas informações a respeito do desenvolvimento usando o DBus e o DeviceKit para trabalhar com dispositivos de armazenamento via USB.
Há algum tempo, fiz uma pesquisa sobre Python e o DeviceKit e encontrei esse post: Accessing DeviceKit with DBus and Python. Eu havia feito alguns testes e o código funcionou perfeitamente. Escrevi algumas linhas a mais e guardei para mexer em um outro dia. Depois de muito tempo (e uma atualização de distribuição) resolvi mexer novamente no USBManager e percebi que o trecho de código não funciona mais:
>>> import dbus
>>>
>>> bus = dbus.SystemBus()
>>>
>>> proxy = bus.get_object("org.freedesktop.DeviceKit.Disks", "/org/freedesktop/DeviceKit/Disks")
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/usr/lib/pymodules/python2.6/dbus/bus.py", line 244, in get_object
follow_name_owner_changes=follow_name_owner_changes)
File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 241, in __init__
self._named_service = conn.activate_name_owner(bus_name)
File "/usr/lib/pymodules/python2.6/dbus/bus.py", line 183, in activate_name_owner
self.start_service_by_name(bus_name)
File "/usr/lib/pymodules/python2.6/dbus/bus.py", line 281, in start_service_by_name
'su', (bus_name, flags)))
File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 620, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.DeviceKit.Disks was not provided by any .service files
>>>
Python and UDisks – Part 1
14/03/11
| Este post também está disponível em Português |
Recently I received some requests asking is USBManager will someday support DeviceKit/UDev, since HAL is officially deprecated. After some researches I retook this application development.
During the research I found out some mismatching informations and a lack of examples, so I decided to post some informations about Python development with DeviceKit/UDev and DBus. I’ll cover essentially the USB storage devices issue.
Some months ago, I made a research about Python and DeviceKit and I ran into this blog post: Accessing DeviceKit with DBus and Python. I made some tests and the code worked properly. Then I wrote some more lines and leaved there for some months. Later, after a long time (and a distribution update) I retook the code to work on USBManager and noticed that it doesn’t work anymore:
>>> import dbus
>>>
>>> bus = dbus.SystemBus()
>>>
>>> proxy = bus.get_object("org.freedesktop.DeviceKit.Disks", "/org/freedesktop/DeviceKit/Disks")
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/usr/lib/pymodules/python2.6/dbus/bus.py", line 244, in get_object
follow_name_owner_changes=follow_name_owner_changes)
File "/usr/lib/pymodules/python2.6/dbus/proxies.py", line 241, in __init__
self._named_service = conn.activate_name_owner(bus_name)
File "/usr/lib/pymodules/python2.6/dbus/bus.py", line 183, in activate_name_owner
self.start_service_by_name(bus_name)
File "/usr/lib/pymodules/python2.6/dbus/bus.py", line 281, in start_service_by_name
'su', (bus_name, flags)))
File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 620, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.DeviceKit.Disks was not provided by any .service files
>>>





