This file is indexed.

/usr/lib/hal/scripts/hal-synce-bluetooth is in synce-hal-bluetooth 0.15-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
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env python

import sys
import os
import re
import stat
import time
import subprocess
import logging, logging.handlers
import platform
import ConfigParser

# defaults
config_file = '/etc/synce-hal.conf'
log_level = logging.WARNING
local_ip = "192.168.132.102"
device_ip = "192.168.132.201"

#
# run dccm after the interface is configured
#
def RunDccm(device_ip, local_ip):

    logger.debug("starting hal-dccm ...")

    dccm_log_level = "1"

    if log_level <= logging.DEBUG:
        dccm_log_level = "6"
    elif log_level <= logging.INFO:
        dccm_log_level = "4"
    elif log_level <= logging.WARNING:
        dccm_log_level = "3"

    cmd_list = ["/usr/lib/synce-hal/hal-dccm", "--device-ip="+device_ip, "--local-ip="+local_ip, "--log-level="+dccm_log_level]

    logger.debug("calling hal-dccm as:")
    logger.debug(cmd_list)

    try:
        os.execv("/usr/lib/synce-hal/hal-dccm", cmd_list)
    except Exception,e:
        logger.error("failed to exec hal-dccm !!: %s" % e)

    return


def ProcessConfig():

    global log_level

    logger = logging.getLogger("hal-synce-bluetooth")

    config = ConfigParser.ConfigParser()
    try:
        config.read(config_file)
    except Exception,e:
        logger.warning("failed to parse config file %s: %s" % (config_file, e))
        return False

    if config.has_option('general', 'loglevel'):
        loglevel_txt = config.get('general', 'loglevel').lower()
        if loglevel_txt == 'critical':
            log_level = logging.CRITICAL
        elif loglevel_txt == 'error':
            log_level = logging.ERROR
        elif loglevel_txt == 'warning':
            log_level = logging.WARNING
        elif loglevel_txt == 'info':
            log_level = logging.INFO
        elif loglevel_txt == 'debug':
            log_level = logging.DEBUG
        else:
            logger.warning("found invalid loglevel in config file %s: %s" % (config_file, loglevel_txt))

        logger.setLevel(log_level)

    return True


#
# main()
#
if __name__ == '__main__':

    log_facility = logging.handlers.SysLogHandler.LOG_DAEMON

    logging.basicConfig(level=logging.WARNING,
                        format='%(asctime)s %(name)s %(levelname)s : %(message)s')
    logger = logging.getLogger("hal-synce-bluetooth")
    sys_log = logging.handlers.SysLogHandler("/dev/log", log_facility)
    syslog_form = logging.Formatter('%(name)s[%(process)d] %(levelname)s : %(message)s')
    sys_log.setFormatter(syslog_form)
    logger.addHandler(sys_log)

    if os.environ.has_key("HALD_ACTION"):
        hald_action = os.environ["HALD_ACTION"]
    else:
        logger.critical("Hal environment not set")
        sys.exit(1)

    ProcessConfig()


    if hald_action == "addon":
        logger.debug("running as addon for bluetooth device")

        RunDccm(device_ip, local_ip)

        logger.error("aborting ...")
        sys.exit(1)