-
-
Notifications
You must be signed in to change notification settings - Fork 152
/
get-se-list
executable file
·61 lines (56 loc) · 1.63 KB
/
get-se-list
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
#!/bin/sh
# This script downloads list of Sony-Ericsson phones from web and
# prepares list suitable for common/gsmphones.c
URL=http://homepage.mac.com/alvinmok/ericsson/types.html
tmp=`mktemp`
wget -O - "$URL" | tr '\r' '\n' > "$tmp"
awk 'BEGIN { p = 0; }
/Type code orderin/ { p = 1; }
/<tr><th>.*<\/th><td>.*<\/td>(<\/tr>)?/ { if (p) print $0; }
/<\/table>/ { p = 0;}' < "$tmp" | \
sed 's@</td></tr><tr><th>@\n@; s@<tr><th>@@; s@</th><td>@;@g; s@</td></tr>@@; s@</td>@@; s@<!-- @@; s@ -->@@;' | \
grep -Ev ' |Cancelled' | \
gawk -F \; '{
delete models;
delete ids;
models[0] = $1;
ids[0] = $2;
if (match($2, "(.*)/(.*)/(.*)", a)) {
ids[0] = a[1];
ids[1] = a[2];
ids[2] = a[3];
} else
if (match($2, "(.*)/(.*)", a)) {
ids[0] = a[1];
ids[1] = a[2];
}
if (match($1, "(.*)-([^-]*)/(.*)", a)) {
models[0] = a[1]"-"a[2];
models[1] = a[1]"-"a[3];
}
/* New ID */
if (length(models[0]) == 14) {
sms = ", F_SUBMIT_SIM_ONLY";
} else {
sms = "";
}
if (models[0] == "FAE-1021011-BV") {
sms = sms", F_SMS_LOCATION_0";
}
if (length(models) == 2 && length(ids) == 2) {
print "\t{\""ids[0]"\",\t\""models[0]"\" ,\"\",\t\t\t\t {F_OBEX"sms", 0}},";
print "\t{\""ids[1]"\",\t\""models[1]"\" ,\"\",\t\t\t\t {F_OBEX"sms", 0}},";
} else {
/* Restore IDs, we need to have unique model */
if (length(models) == 1) {
delete ids;
ids[0] = $2;
}
for (model in models) {
for (id in ids) {
print "\t{\""ids[id]"\",\t\""models[model]"\" ,\"\",\t\t\t\t {F_OBEX"sms", 0}},";
}
}
}
}'
rm -f "$tmp"