summaryrefslogtreecommitdiffstats
path: root/input/test-input
blob: 7f41b6f6bd023cfe1842d0a9c55959276fef3452 (plain)
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
#!/usr/bin/python

import sys
import dbus

bus = dbus.SystemBus()

manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'),
							'org.bluez.Manager')

conn = manager.ActivateService('input')

input = dbus.Interface(bus.get_object(conn, '/org/bluez/input'),
						'org.bluez.input.Manager')

if (len(sys.argv) < 2):
	print "Usage: %s <command>" % (sys.argv[0])
	print ""
	print "  list"
	print "  create <address>"
	print "  remove <path>"
	sys.exit(1)

if (sys.argv[1] == "list"):
	list = input.ListDevices()
	print list
	sys.exit(0)

if (sys.argv[1] == "create"):
	if (len(sys.argv) < 3):
		print "Need address parameter"
	else:
		device = input.CreateSecureDevice(sys.argv[2])
		print device
	sys.exit(0)

if (sys.argv[1] == "remove"):
	if (len(sys.argv) < 3):
		print "Need object path parameter"
	else:
		input.RemoveDevice(sys.argv[2])
	sys.exit(0)

print "Unknown command"
sys.exit(1)