Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mdmngr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
IOPSYS
mdmngr
Commits
27795710
Commit
27795710
authored
7 years ago
by
Jakob Olsson
Browse files
Options
Downloads
Patches
Plain Diff
small improvement to code size
parent
44e33d8a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dongle_apn.c
+5
-25
5 additions, 25 deletions
dongle_apn.c
dongle_network.c
+7
-35
7 additions, 35 deletions
dongle_network.c
dongle_pin.c
+3
-8
3 additions, 8 deletions
dongle_pin.c
with
15 additions
and
68 deletions
dongle_apn.c
+
5
−
25
View file @
27795710
...
...
@@ -31,12 +31,8 @@ int list_apn_profiles(struct ubus_context *ctx, struct ubus_object *obj,
struct
blob_attr
*
msg
)
{
char
*
response
=
mobile_get_apn_profiles
();
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
int
delete_apn_profile
(
struct
ubus_context
*
ctx
,
struct
ubus_object
*
obj
,
...
...
@@ -50,12 +46,8 @@ int delete_apn_profile(struct ubus_context *ctx, struct ubus_object *obj,
strncpy
(
name
,
(
char
*
)
blobmsg_data
(
tb
[
APN
]),
1023
);
char
*
response
=
mobile_delete_apn
(
name
);
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
int
set_apn_profile
(
struct
ubus_context
*
ctx
,
struct
ubus_object
*
obj
,
...
...
@@ -69,12 +61,8 @@ int set_apn_profile(struct ubus_context *ctx, struct ubus_object *obj,
strncpy
(
name
,
(
char
*
)
blobmsg_data
(
tb
[
APN
]),
1023
);
char
*
response
=
mobile_set_apn_profile
(
name
);
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
int
create_apn_profile
(
struct
ubus_context
*
ctx
,
struct
ubus_object
*
obj
,
...
...
@@ -88,12 +76,8 @@ int create_apn_profile(struct ubus_context *ctx, struct ubus_object *obj,
strncpy
(
name
,
(
char
*
)
blobmsg_data
(
tb
[
APN
]),
1023
);
char
*
response
=
mobile_create_apn_profile
(
name
);
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
int
show_current_apn
(
struct
ubus_context
*
ctx
,
struct
ubus_object
*
obj
,
...
...
@@ -102,12 +86,8 @@ int show_current_apn(struct ubus_context *ctx, struct ubus_object *obj,
{
//char *wan_apn = mobile_get_request("wan_apn");
char
*
response
=
mobile_get_wan_apn
();
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
struct
ubus_method
dongle_object_methods
[]
=
{
...
...
This diff is collapsed.
Click to expand it.
dongle_network.c
+
7
−
35
View file @
27795710
...
...
@@ -23,24 +23,16 @@ int get_signal_strength(struct ubus_context *ctx, struct ubus_object *obj,
struct
blob_attr
*
msg
)
{
char
*
response
=
mobile_get_rssi
();
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
int
connect_network
(
struct
ubus_context
*
ctx
,
struct
ubus_object
*
obj
,
struct
ubus_request_data
*
req
,
const
char
*
method
,
struct
blob_attr
*
msg
)
{
char
*
response
=
mobile_connect_network
();
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
int
disconnect
(
struct
ubus_context
*
ctx
,
struct
ubus_object
*
obj
,
...
...
@@ -48,12 +40,8 @@ int disconnect(struct ubus_context *ctx, struct ubus_object *obj,
struct
blob_attr
*
msg
)
{
char
*
response
=
mobile_disconnect_network
();
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
int
modem_state
(
struct
ubus_context
*
ctx
,
struct
ubus_object
*
obj
,
...
...
@@ -61,12 +49,8 @@ int modem_state(struct ubus_context *ctx, struct ubus_object *obj,
struct
blob_attr
*
msg
)
{
char
*
response
=
mobile_get_modem_state
();
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
int
enable_roaming
(
struct
ubus_context
*
ctx
,
struct
ubus_object
*
obj
,
...
...
@@ -74,12 +58,8 @@ int enable_roaming(struct ubus_context *ctx, struct ubus_object *obj,
struct
blob_attr
*
msg
)
{
char
*
response
=
mobile_enable_roaming
();
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
int
disable_roaming
(
struct
ubus_context
*
ctx
,
struct
ubus_object
*
obj
,
...
...
@@ -87,12 +67,8 @@ int disable_roaming(struct ubus_context *ctx, struct ubus_object *obj,
struct
blob_attr
*
msg
)
{
char
response
=
*
mobile_disable_roaming
();
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
int
roam_status
(
struct
ubus_context
*
ctx
,
struct
ubus_object
*
obj
,
...
...
@@ -100,12 +76,8 @@ int roam_status(struct ubus_context *ctx, struct ubus_object *obj,
struct
blob_attr
*
msg
)
{
char
*
response
=
mobile_get_roam_status
();
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
struct
ubus_method
dongle_object_methods
[]
=
{
...
...
This diff is collapsed.
Click to expand it.
dongle_pin.c
+
3
−
8
View file @
27795710
...
...
@@ -313,11 +313,9 @@ int verify_pin(struct ubus_context *ctx, struct ubus_object *obj,
}
char
*
response
=
mobile_set_pin
(
pin
,
pin
);
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
parse_and_print
(
response
,
ctx
,
req
);
fail:
return
0
;
return
-
1
;
}
int
remaining_tries
(
struct
ubus_context
*
ctx
,
struct
ubus_object
*
obj
,
...
...
@@ -327,10 +325,7 @@ int remaining_tries(struct ubus_context *ctx, struct ubus_object *obj,
char
*
response
=
mobile_get_pinnumber
();
int
rv
;
rv
=
parse_and_print
(
response
,
ctx
,
req
);
if
(
rv
<
0
)
return
-
1
;
return
0
;
return
parse_and_print
(
response
,
ctx
,
req
);
}
struct
ubus_method
dongle_object_methods
[]
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment