/usr/lib/barry/hal-blackberry is in barry-util 0.18.5-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #!/usr/bin/python
import sys, os
import dbus, dbus.glib
import commands
class HalBlackberry:
def __init__(self):
self._dbus = dbus.SystemBus()
self._serv = self._dbus.get_object( 'org.freedesktop.Hal', '/org/freedesktop/Hal/Manager' )
self._hal = dbus.Interface( self._serv, 'org.freedesktop.Hal.Manager' )
self._device = None
self.get_properties()
self.gatherInfo()
def get_properties(self):
self.udi = os.getenv("UDI", "")
self.busnum = self.get_property( 'usb.bus_number' )
self.devnum = self.get_property( 'usb.linux.device_number' )
def get_property(self, name):
return self.device().GetProperty(name, dbus_interface="org.freedesktop.Hal.Device")
def gatherInfo(self):
text = commands.getoutput("/usr/bin/bidentify -B %i -N %i" % (self.busnum, self.devnum))
sys.stderr.write("Found '%s' at %s, %s\n" % (text, self.busnum, self.devnum))
b = text.split(", ")
desc = b[1]
pin = b[0]
self.set_property("sync.serial", pin)
self.set_property("info.product", desc)
def set_property(self, name, value):
return self.device().SetPropertyString(name, value, dbus_interface="org.freedesktop.Hal.Device")
def device(self):
if not self._device:
self._device = self._dbus.get_object("org.freedesktop.Hal", self.udi)
return self._device
h = HalBlackberry()
|