summaryrefslogtreecommitdiffstats
path: root/src-wireless
diff options
context:
space:
mode:
authorJames Rayner <james@archlinux.org>2009-05-01 17:47:57 +0200
committerJames Rayner <james@archlinux.org>2009-05-01 17:47:57 +0200
commit7caa9343e8fea3cf653260e4b9458c5aa317734c (patch)
treed604ec03f264fcb6529e25ef6f4909e5c2fcc5e7 /src-wireless
parent22db3ac767600c750f622fe979ce8a7ee746129e (diff)
downloadnetctl-7caa9343e8fea3cf653260e4b9458c5aa317734c.tar.gz
netctl-7caa9343e8fea3cf653260e4b9458c5aa317734c.tar.xz
Working WEP support via dbus/wpa_supplicant
Diffstat (limited to 'src-wireless')
-rwxr-xr-xsrc-wireless/wireless-dbus19
1 files changed, 8 insertions, 11 deletions
diff --git a/src-wireless/wireless-dbus b/src-wireless/wireless-dbus
index 0e241a9..0ddd5ab 100755
--- a/src-wireless/wireless-dbus
+++ b/src-wireless/wireless-dbus
@@ -35,12 +35,7 @@ def wep_hex2dec(key):
x=0
new_key=[]
while x<len(key):
- new_key.append(str(int(key[x:x+2],16)).zfill(3))
- # Convert hex pair to decimal
- #part = int(key[x:x+2],16)
- # Convert to string with 00's filled and append
- #new_key+=str(part).zfill(3)
- # Increment to get next pair
+ new_key.append(int(key[x:x+2],16))
x+=2
return new_key
@@ -120,15 +115,17 @@ def start(profile):
elif profile['SECURITY'] == "wep":
key=profile['KEY']
if key[:2] == "s:": # String key prefixed by "s:"
- key=key[2:]
- else: # Hex key
+ keydbus=key[2:]
+ else: # Hex key
key=wep_hex2dec(key)
-
- print key
+ keydbus = dbus.ByteArray()
+ for l in key:
+ keydbus+=chr(l)
+
opts = dbus.Dictionary({"ssid": dbus.ByteArray(profile['ESSID']),
"key_mgmt": dbus.String("NONE"),
"wep_tx_keyidx": dbus.Int32(1),
- "wep_key0": dbus.ByteArray(key)},
+ "wep_key0": dbus.ByteArray(keydbus)},
signature="sv")
rnet.set(opts)
elif profile['SECURITY'] == "none":