BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mangoh-drivers
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
mangoh-drivers
Commits
4b107073
Commit
4b107073
authored
Mar 22, 2019
by
Zahid Chowdhury
Browse files
Options
Browse Files
Download
Plain Diff
Fix conflicts
parents
21aaaab9
f9c1bba2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
64 deletions
+63
-64
location.c
apps/locationService/components/location.c
+58
-54
fb_waveshare_eink.c
...l/waveshare_eink/linux_kernel_modules/fb_waveshare_eink.c
+5
-10
No files found.
apps/locationService/components/location.c
View file @
4b107073
...
...
@@ -126,7 +126,7 @@ static void PackJson
res
=
le_pos_GetTime
(
&
hours
,
&
minutes
,
&
seconds
,
&
millis
);
if
(
res
==
LE_OK
){
res
=
le_pos_GetDate
(
&
years
,
&
months
,
&
days
);
if
(
res
==
LE_OK
){
if
(
res
==
LE_OK
){
time
(
&
rawtime
);
timeinfo
=
localtime
(
&
rawtime
);
timeinfo
->
tm_year
=
years
-
1900
;
...
...
@@ -148,18 +148,18 @@ static void PackJson
}
if
(
loc
==
GPS
)
len
=
snprintf
(
jsonp
,
jsonl
,
"{
\"
lat
\"
: %lf,
\"
lon
\"
: %lf,
\"
hAcc
\"
: %lf,"
"
\"
alt
\"
: %lf,
\"
vAcc
\"
: %lf,
\"
fixType
\"
:
\"
GNSS
\"
,
\"
ts
\"
: %ju}"
,
scanp
->
lat
,
scanp
->
lon
,
scanp
->
hAccuracy
,
scanp
->
alt
,
scanp
->
vAccuracy
,
(
uintmax_t
)
ts
);
len
=
snprintf
(
jsonp
,
jsonl
,
"{
\"
lat
\"
: %lf,
\"
lon
\"
: %lf,
\"
hAcc
\"
: %lf,"
"
\"
alt
\"
: %lf,
\"
vAcc
\"
: %lf,
\"
fixType
\"
:
\"
GNSS
\"
,
\"
ts
\"
: %ju}"
,
scanp
->
lat
,
scanp
->
lon
,
scanp
->
hAccuracy
,
scanp
->
alt
,
scanp
->
vAccuracy
,
(
uintmax_t
)
ts
);
else
if
(
loc
==
WIFI
)
len
=
snprintf
(
jsonp
,
jsonl
,
"{
\"
lat
\"
: %lf,
\"
lon
\"
: %lf,
\"
hAcc
\"
: %lf,"
"
\"
fixType
\"
:
\"
WIFI
\"
,
\"
ts
\"
: %ju}"
,
scanp
->
lat
,
scanp
->
lon
,
scanp
->
hAccuracy
,
(
uintmax_t
)
ts
);
len
=
snprintf
(
jsonp
,
jsonl
,
"{
\"
lat
\"
: %lf,
\"
lon
\"
: %lf,
\"
hAcc
\"
: %lf,"
"
\"
fixType
\"
:
\"
WIFI
\"
,
\"
ts
\"
: %ju}"
,
scanp
->
lat
,
scanp
->
lon
,
scanp
->
hAccuracy
,
(
uintmax_t
)
ts
);
else
LE_FATAL
(
"ILLEGAL Location Type: WIFI|GPS"
);
LE_FATAL
(
"ILLEGAL Location Type: WIFI|GPS"
);
if
(
len
>=
jsonl
)
{
...
...
@@ -174,24 +174,25 @@ static void LocationResultHandler(
{
case
MA_COMBAINLOCATION_RESULT_SUCCESS
:
{
Scan_t
scan
;
char
json
[
256
];
Scan_t
scan
;
char
json
[
256
];
const
le_result_t
res
=
ma_combainLocation_GetSuccessResponse
(
handle
,
&
scan
.
lat
,
&
scan
.
lon
,
&
scan
.
hAccuracy
);
if
(
res
!=
LE_OK
)
{
LE_INFO
(
"Received result notification of type success response, but couldn't fetch the result
\n
"
);
LE_INFO
(
"Received result notification of type success response, but couldn't fetch the result
\n
"
);
}
else
{
LE_INFO
(
"Location: latitude=%f, longitude=%f, accuracy=%f meters
\n
"
,
scan
.
lat
,
scan
.
lon
,
scan
.
hAccuracy
);
PackJson
(
WIFI
,
&
scan
,
json
,
sizeof
(
json
));
scan
.
lat
,
scan
.
lon
,
scan
.
hAccuracy
);
PackJson
(
WIFI
,
&
scan
,
json
,
sizeof
(
json
));
LE_INFO
(
"Sent dhub json: %s"
,
json
);
psensor_PushJson
(
saved_ref
,
0
/* now */
,
json
);
saved_ref
=
NULL
;
psensor_PushJson
(
saved_ref
,
0
/* now */
,
json
);
saved_ref
=
NULL
;
}
break
;
}
...
...
@@ -217,7 +218,8 @@ static void LocationResultHandler(
sizeof
(
message
)
-
1
);
if
(
res
!=
LE_OK
)
{
LE_INFO
(
"Received result notification of type success response, but couldn't fetch the result
\n
"
);
LE_INFO
(
"Received result notification of type success response, but couldn't fetch the result
\n
"
);
}
else
{
...
...
@@ -239,7 +241,8 @@ static void LocationResultHandler(
handle
,
rawResult
,
sizeof
(
rawResult
)
-
1
);
if
(
res
!=
LE_OK
)
{
LE_INFO
(
"Received result notification of type success response, but couldn't fetch the result
\n
"
);
LE_INFO
(
"Received result notification of type success response, but couldn't fetch the result
\n
"
);
}
else
{
...
...
@@ -265,15 +268,15 @@ static bool TrySubmitRequest(void)
const
le_result_t
res
=
ma_combainLocation_SubmitLocationRequest
(
State
.
combainHandle
,
LocationResultHandler
,
NULL
);
if
(
res
==
LE_DUPLICATE
)
{
ma_combainLocation_DestroyLocationRequest
(
State
.
combainHandle
);
return
true
;
}
if
(
res
==
LE_DUPLICATE
)
{
ma_combainLocation_DestroyLocationRequest
(
State
.
combainHandle
);
return
true
;
}
if
(
res
==
LE_OK
)
{
LE_INFO
(
"Submitted request handle: %d"
,
(
uint32_t
)
State
.
combainHandle
);
return
true
;
}
LE_INFO
(
"Submitted request handle: %d"
,
(
uint32_t
)
State
.
combainHandle
);
return
true
;
}
LE_FATAL
(
"Failed to submit location request
\n
"
);
return
false
;
...
...
@@ -314,10 +317,8 @@ static void WifiEventHandler(le_wifiClient_Event_t event, void *context)
LE_INFO
(
"Failed while fetching WiFi BSSID
\n
"
);
}
// TODO: LE-10254 notes that an incorrect error code of 0xFFFF is mentioned in the
// documentation. The error code used in the implementation is 0xFFF.
signalStrength
=
le_wifiClient_GetSignalStrength
(
ap
);
if
(
signalStrength
==
0xFFF
)
if
(
signalStrength
==
LE_WIFICLIENT_NO_SIGNAL_STRENGTH
)
{
LE_INFO
(
"Failed while fetching WiFi signal strength
\n
"
);
}
...
...
@@ -329,7 +330,8 @@ static void WifiEventHandler(le_wifiClient_Event_t event, void *context)
res
=
ma_combainLocation_AppendWifiAccessPoint
(
State
.
combainHandle
,
bssidBytes
,
6
,
ssid
,
ssidLen
,
signalStrength
);
LE_INFO
(
"Submitted AccessPoint: %d ssid: %s"
,
(
uint32_t
)
State
.
combainHandle
,
(
char
*
)
ssid
);
LE_INFO
(
"Submitted AccessPoint: %d ssid: %s"
,
(
uint32_t
)
State
.
combainHandle
,
(
char
*
)
ssid
);
if
(
res
!=
LE_OK
)
{
...
...
@@ -371,7 +373,7 @@ static void Sample
le_result_t
posRes
=
le_pos_Get3DLocation
(
&
lat
,
&
lon
,
&
hAccuracy
,
&
alt
,
&
vAccuracy
);
/* LE_INFO("le_pos_Get3DLocation returned: lat = %d lon: %d hAccuracy: %d alt: %d vAccuracy: %d",
lat, lon, hAccuracy, alt, vAccuracy); */
lat, lon, hAccuracy, alt, vAccuracy); */
scan
.
lat
=
(
double
)
lat
/
1000000
.
0
;
scan
.
lon
=
(
double
)
lon
/
1000000
.
0
;
...
...
@@ -380,18 +382,18 @@ static void Sample
scan
.
vAccuracy
=
(
double
)
vAccuracy
;
/* LE_INFO("CVT double: lat = %f lon: %f hAccuracy: %f alt: %f vAccuracy: %f",
scan.lat, scan.lon, scan.hAccuracy, scan.alt, scan.vAccuracy); */
scan.lat, scan.lon, scan.hAccuracy, scan.alt, scan.vAccuracy); */
// No GPS or low accuracy GPS try Wifi Scan & Combain translation
if
(
posRes
!=
LE_OK
||
scan
.
hAccuracy
>
HACCURACY_GOOD
)
{
le_result_t
startRes
;
le_result_t
startRes
;
if
(
!
State
.
waitingForWifiResults
)
{
/* Legato WIFI is broken so we need to create a fake access point to do a scan */
const
char
*
ssidPtr
=
"mangOH"
;
le_wifiClient_AccessPointRef_t
createdAccessPoint
;
if
(
!
State
.
waitingForWifiResults
)
{
/* Legato WIFI is broken so we need to create a fake access point to do a scan */
const
char
*
ssidPtr
=
"mangOH"
;
le_wifiClient_AccessPointRef_t
createdAccessPoint
;
createdAccessPoint
=
le_wifiClient_Create
((
const
uint8_t
*
)
ssidPtr
,
strlen
(
ssidPtr
));
createdAccessPoint
=
le_wifiClient_Create
((
const
uint8_t
*
)
ssidPtr
,
strlen
(
ssidPtr
));
if
(
NULL
==
createdAccessPoint
)
{
LE_INFO
(
"le_wifiClient_Create returns NULL.
\n
"
);
...
...
@@ -407,30 +409,32 @@ static void Sample
startRes
=
le_wifiClient_Start
();
State
.
combainHandle
=
ma_combainLocation_CreateLocationRequest
();
LE_INFO
(
"Create request handle: %d"
,
(
uint32_t
)
State
.
combainHandle
);
State
.
combainHandle
=
ma_combainLocation_CreateLocationRequest
();
LE_INFO
(
"Create request handle: %d"
,
(
uint32_t
)
State
.
combainHandle
);
if
(
startRes
!=
LE_OK
&&
startRes
!=
LE_BUSY
)
{
LE_FATAL
(
"Couldn't start the WiFi service error code: %s"
,
LE_RESULT_TXT
(
startRes
));
exit
(
1
);
exit
(
1
);
}
State
.
combainHandle
=
ma_combainLocation_CreateLocationRequest
();
LE_INFO
(
"Create request handle: %d"
,
(
uint32_t
)
State
.
combainHandle
);
saved_ref
=
ref
;
le_wifiClient_Scan
();
saved_ref
=
ref
;
State
.
waitingForWifiResults
=
true
;
}
else
LE_INFO
(
"le_wifiClient_Scan still RUNNING"
);
State
.
waitingForWifiResults
=
true
;
}
else
LE_INFO
(
"le_wifiClient_Scan still RUNNING"
);
}
// Good GPS
else
if
(
posRes
==
LE_OK
&&
scan
.
hAccuracy
<=
HACCURACY_GOOD
)
{
PackJson
(
GPS
,
&
scan
,
json
,
sizeof
(
json
));
psensor_PushJson
(
ref
,
0
/* now */
,
json
);
// Kill any errant WIFI sca
n requests as we got GPS
if
(
State
.
waitingForWifiResults
)
State
.
waitingForWifiResults
=
false
;
PackJson
(
GPS
,
&
scan
,
json
,
sizeof
(
json
));
psensor_PushJson
(
ref
,
0
/* now */
,
json
);
// Kill any errant WIFI sac
n requests as we got GPS
if
(
State
.
waitingForWifiResults
)
State
.
waitingForWifiResults
=
false
;
}
else
...
...
@@ -456,6 +460,6 @@ COMPONENT_INIT
dhubIO_SetNumericDefault
(
PSENSOR_PERIOD
,
DEFAULT_PERIOD
);
dhubIO_SetJsonExample
(
"coordinates/value"
,
"{
\"
lat
\"
:0.1,
\"
lon
\"
:0.2,"
"
\"
alt
\"
:0.3,
\"
hAcc
\"
:0.4,
\"
vAcc
\"
:0.5,
\"
fixType
\"
:
\"
GNSS
\"
}"
);
"
\"
alt
\"
:0.3,
\"
hAcc
\"
:0.4,
\"
vAcc
\"
:0.5,
\"
fixType
\"
:
\"
GNSS
\"
}"
);
}
experimental/waveshare_eink/linux_kernel_modules/fb_waveshare_eink.c
View file @
4b107073
...
...
@@ -606,11 +606,11 @@ static int ws_eink_spi_probe(struct spi_device *spi)
disp_init_fail:
framebuffer_release
(
info
);
fbreg_fail:
k
free
(
par
->
ssbuf
);
v
free
(
par
->
ssbuf
);
ssbuf_alloc_fail:
vfree
(
info
->
screen_base
);
screen_base_fail:
k
free
(
info
->
screen_base
);
v
free
(
info
->
screen_base
);
return
retval
;
}
...
...
@@ -618,15 +618,10 @@ static int ws_eink_spi_remove(struct spi_device *spi)
{
struct
fb_info
*
p
=
spi_get_drvdata
(
spi
);
struct
ws_eink_fb_par
*
par
=
p
->
par
;
fb_deferred_io_cleanup
(
p
);
unregister_framebuffer
(
p
);
/*
* TODO: Why is this necessary? It doesn't seem that there is a call to
* fb_alloc_cmap()
*/
fb_dealloc_cmap
(
&
p
->
cmap
);
iounmap
(
p
->
screen_base
);
kfree
(
p
->
screen_base
);
kfree
(
par
->
ssbuf
);
vfree
(
p
->
screen_base
);
vfree
(
par
->
ssbuf
);
framebuffer_release
(
p
);
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment