fix new path
[scm/bb/meta-tizen.git] / meta-tizen-adaptation / meta-oe / recipes-connectivity / connman / connman / 0022-Tethering-Add-test-script-of-open-and-hidden-AP.patch
1 From 395d388931d37b6760d7b9f59a5710dfe42662c7 Mon Sep 17 00:00:00 2001
2 From: Chengyi Zhao <chengyi1.zhao@archermind.com>
3 Date: Thu, 11 Jul 2013 10:29:38 +0800
4 Subject: [PATCH 22/32] Tethering: Add test script of open and hidden AP
5
6 Change-Id: I8dbeaeba5848c8a8739422a93786b2ca6ed31b21
7 ---
8  test/enable-tethering | 34 +++++++++++++++++++++++++++-------
9  1 file changed, 27 insertions(+), 7 deletions(-)
10  mode change 100755 => 100644 test/enable-tethering
11
12 diff --git a/test/enable-tethering b/test/enable-tethering
13 old mode 100755
14 new mode 100644
15 index cbcd4e7..674b3c9
16 --- a/test/enable-tethering
17 +++ b/test/enable-tethering
18 @@ -3,8 +3,17 @@
19  import sys
20  import dbus
21  
22 -if (len(sys.argv) >= 3 and len(sys.argv) != 4 and sys.argv[1] == "wifi"):
23 -       print "Usage: %s wifi [SSID] [passphrase]" % (sys.argv[0])
24 +if (len(sys.argv) >= 2 and len(sys.argv) < 4 and sys.argv[1] == "wifi"):
25 +       print "Usage: %s wifi [SSID] [passphrase] [hidden]" % (sys.argv[0])
26 +       print "Example:"
27 +       print "Create the open system access point:"
28 +       print "%s wifi abcd \"\"" % (sys.argv[0])
29 +       print "Create the security access point:"
30 +       print "%s wifi abcd 123456789" % (sys.argv[0])
31 +       print "Create the hidden access point:"
32 +       print "%s wifi abcd 123456789 hidden" % (sys.argv[0])
33 +       print "Create the open and hidden access point:"
34 +       print "%s wifi abcd \"\" hidden" % (sys.argv[0])
35         sys.exit(1)
36  elif (len(sys.argv) < 2):
37         print "Usage: %s type" % (sys.argv[0])
38 @@ -15,7 +24,7 @@ bus = dbus.SystemBus()
39  manager = dbus.Interface(bus.get_object('net.connman', "/"),
40                                         'net.connman.Manager')
41  
42 -def technology_enable_tethering(path, tech_type, ssid, psk):
43 +def technology_enable_tethering(path, tech_type, ssid, psk, hidden):
44         tech = dbus.Interface(bus.get_object("net.connman", path),
45                                                 "net.connman.Technology")
46  
47 @@ -27,9 +36,17 @@ def technology_enable_tethering(path, tech_type, ssid, psk):
48                                 if len(ssid) > 0:
49                                         tech.SetProperty("TetheringIdentifier",
50                                                                 ssid)
51 -                               if len(psk) > 0:
52                                         tech.SetProperty("TetheringPassphrase",
53                                                                 psk)
54 +                               if tech_type == "wifi":
55 +                                       if len(hidden) > 0:
56 +                                               if hidden == "hidden":
57 +                                                       tech.SetProperty("Hidden",dbus.Boolean(1))
58 +                                               else:
59 +                                                       tech.SetProperty("Hidden",dbus.Boolean(0))
60 +                                       else:
61 +                                               tech.SetProperty("Hidden",dbus.Boolean(0))
62 +
63                                 print "Enabling %s tethering" % tech_type
64                                 tech.SetProperty("Tethering", dbus.Boolean(1))
65  
66 @@ -41,11 +58,14 @@ technologies = manager.GetTechnologies()
67  tech = None
68  
69  for path,_ in technologies:
70 -       if (len(sys.argv) == 4):
71 +       if (len(sys.argv) == 5):
72 +               tech = technology_enable_tethering(path,
73 +                                       sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
74 +       elif (len(sys.argv) == 4):
75                 tech = technology_enable_tethering(path,
76 -                                       sys.argv[1], sys.argv[2], sys.argv[3])
77 +                                       sys.argv[1], sys.argv[2], sys.argv[3], "")
78         else:
79 -               tech = technology_enable_tethering(path, sys.argv[1], "", "")
80 +               tech = technology_enable_tethering(path, sys.argv[1], "", "", "")
81  
82         if tech != None:
83                 break;
84 -- 
85 1.8.1.4
86