Switch common msm8916 configurations to msm8916-common
Change-Id: I84b86674ff045ee5297520c9ec28bfe598b5e08dcm-14.0
parent
5decd31225
commit
dca77dd5ac
@ -1,280 +0,0 @@
|
||||
# List of effect libraries to load. Each library element must contain a "path" element
|
||||
# giving the full path of the library .so file.
|
||||
# libraries {
|
||||
# <lib name> {
|
||||
# path <lib path>
|
||||
# }
|
||||
# }
|
||||
libraries {
|
||||
bundle {
|
||||
path /system/lib/soundfx/libbundlewrapper.so
|
||||
}
|
||||
reverb {
|
||||
path /system/lib/soundfx/libreverbwrapper.so
|
||||
}
|
||||
qcbassboost {
|
||||
path /vendor/lib/soundfx/libqcbassboost.so
|
||||
}
|
||||
qcvirt {
|
||||
path /vendor/lib/soundfx/libqcvirt.so
|
||||
}
|
||||
qcreverb {
|
||||
path /vendor/lib/soundfx/libqcreverb.so
|
||||
}
|
||||
visualizer_sw {
|
||||
path /system/lib/soundfx/libvisualizer.so
|
||||
}
|
||||
visualizer_hw {
|
||||
path /system/lib/soundfx/libqcomvisualizer.so
|
||||
}
|
||||
downmix {
|
||||
path /system/lib/soundfx/libdownmix.so
|
||||
}
|
||||
loudness_enhancer {
|
||||
path /system/lib/soundfx/libldnhncr.so
|
||||
}
|
||||
proxy {
|
||||
path /system/lib/soundfx/libeffectproxy.so
|
||||
}
|
||||
offload_bundle {
|
||||
path /system/lib/soundfx/libqcompostprocbundle.so
|
||||
}
|
||||
audio_pre_processing {
|
||||
path /system/lib/soundfx/libqcomvoiceprocessing.so
|
||||
}
|
||||
}
|
||||
|
||||
# Default pre-processing library. Add to audio_effect.conf "libraries" section if
|
||||
# audio HAL implements support for default software audio pre-processing effects
|
||||
#
|
||||
# pre_processing {
|
||||
# path /system/lib/soundfx/libaudiopreprocessing.so
|
||||
# }
|
||||
|
||||
# list of effects to load. Each effect element must contain a "library" and a "uuid" element.
|
||||
# The value of the "library" element must correspond to the name of one library element in the
|
||||
# "libraries" element.
|
||||
# The name of the effect element is indicative, only the value of the "uuid" element
|
||||
# designates the effect.
|
||||
# The uuid is the implementation specific UUID as specified by the effect vendor. This is not the
|
||||
# generic effect type UUID.
|
||||
# effects {
|
||||
# <fx name> {
|
||||
# library <lib name>
|
||||
# uuid <effect uuid>
|
||||
# }
|
||||
# ...
|
||||
# }
|
||||
|
||||
effects {
|
||||
|
||||
# additions for the proxy implementation
|
||||
# Proxy implementation
|
||||
#effectname {
|
||||
#library proxy
|
||||
#uuid xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
||||
|
||||
# SW implemetation of the effect. Added as a node under the proxy to
|
||||
# indicate this as a sub effect.
|
||||
#libsw {
|
||||
#library libSW
|
||||
#uuid yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy
|
||||
#} End of SW effect
|
||||
|
||||
# HW implementation of the effect. Added as a node under the proxy to
|
||||
# indicate this as a sub effect.
|
||||
#libhw {
|
||||
#library libHW
|
||||
#uuid zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz
|
||||
#}End of HW effect
|
||||
#} End of effect proxy
|
||||
|
||||
bassboost {
|
||||
library proxy
|
||||
uuid 14804144-a5ee-4d24-aa88-0002a5d5c51b
|
||||
|
||||
libsw {
|
||||
library qcbassboost
|
||||
uuid 23aca180-44bd-11e2-bcfd-0800200c9a66
|
||||
}
|
||||
|
||||
libhw {
|
||||
library offload_bundle
|
||||
uuid 2c4a8c24-1581-487f-94f6-0002a5d5c51b
|
||||
}
|
||||
}
|
||||
virtualizer {
|
||||
library proxy
|
||||
uuid d3467faa-acc7-4d34-acaf-0002a5d5c51b
|
||||
|
||||
libsw {
|
||||
library qcvirt
|
||||
uuid e6c98a16-22a3-11e2-b87b-f23c91aec05e
|
||||
}
|
||||
|
||||
libhw {
|
||||
library offload_bundle
|
||||
uuid 509a4498-561a-4bea-b3b1-0002a5d5c51b
|
||||
}
|
||||
}
|
||||
equalizer {
|
||||
library proxy
|
||||
uuid c8e70ecd-48ca-456e-8a4f-0002a5d5c51b
|
||||
|
||||
libsw {
|
||||
library bundle
|
||||
uuid ce772f20-847d-11df-bb17-0002a5d5c51b
|
||||
}
|
||||
|
||||
libhw {
|
||||
library offload_bundle
|
||||
uuid a0dac280-401c-11e3-9379-0002a5d5c51b
|
||||
}
|
||||
}
|
||||
volume {
|
||||
library bundle
|
||||
uuid 119341a0-8469-11df-81f9-0002a5d5c51b
|
||||
}
|
||||
reverb_env_aux {
|
||||
library proxy
|
||||
uuid 48404ac9-d202-4ccc-bf84-0002a5d5c51b
|
||||
|
||||
libsw {
|
||||
library qcreverb
|
||||
uuid a8c1e5f3-293d-43cd-95ec-d5e26c02e217
|
||||
}
|
||||
|
||||
libhw {
|
||||
library offload_bundle
|
||||
uuid 79a18026-18fd-4185-8233-0002a5d5c51b
|
||||
}
|
||||
}
|
||||
reverb_env_ins {
|
||||
library proxy
|
||||
uuid b707403a-a1c1-4291-9573-0002a5d5c51b
|
||||
|
||||
libsw {
|
||||
library qcreverb
|
||||
uuid 791fff8b-8129-4655-83a4-59bc61034c3a
|
||||
}
|
||||
|
||||
libhw {
|
||||
library offload_bundle
|
||||
uuid eb64ea04-973b-43d2-8f5e-0002a5d5c51b
|
||||
}
|
||||
}
|
||||
reverb_pre_aux {
|
||||
library proxy
|
||||
uuid 1b78f587-6d1c-422e-8b84-0002a5d5c51b
|
||||
|
||||
libsw {
|
||||
library qcreverb
|
||||
uuid 53ef1db5-c0c0-445b-b060-e34d20ebb70a
|
||||
}
|
||||
|
||||
libhw {
|
||||
library offload_bundle
|
||||
uuid 6987be09-b142-4b41-9056-0002a5d5c51b
|
||||
}
|
||||
}
|
||||
reverb_pre_ins {
|
||||
library proxy
|
||||
uuid f3e178d2-ebcb-408e-8357-0002a5d5c51b
|
||||
|
||||
libsw {
|
||||
library qcreverb
|
||||
uuid b08a0e38-22a5-11e2-b87b-f23c91aec05e
|
||||
}
|
||||
|
||||
libhw {
|
||||
library offload_bundle
|
||||
uuid aa2bebf6-47cf-4613-9bca-0002a5d5c51b
|
||||
}
|
||||
}
|
||||
visualizer {
|
||||
library proxy
|
||||
uuid 1d0a1a53-7d5d-48f2-8e71-27fbd10d842c
|
||||
|
||||
libsw {
|
||||
library visualizer_sw
|
||||
uuid d069d9e0-8329-11df-9168-0002a5d5c51b
|
||||
}
|
||||
|
||||
libhw {
|
||||
library visualizer_hw
|
||||
uuid 7a8044a0-1a71-11e3-a184-0002a5d5c51b
|
||||
}
|
||||
}
|
||||
downmix {
|
||||
library downmix
|
||||
uuid 93f04452-e4fe-41cc-91f9-e475b6d1d69f
|
||||
}
|
||||
loudness_enhancer {
|
||||
library loudness_enhancer
|
||||
uuid fa415329-2034-4bea-b5dc-5b381c8d1e2c
|
||||
}
|
||||
aec {
|
||||
library audio_pre_processing
|
||||
uuid 0f8d0d2a-59e5-45fe-b6e4-248c8a799109
|
||||
}
|
||||
ns {
|
||||
library audio_pre_processing
|
||||
uuid 1d97bb0b-9e2f-4403-9ae3-58c2554306f8
|
||||
}
|
||||
}
|
||||
|
||||
# Default pre-processing effects. Add to audio_effect.conf "effects" section if
|
||||
# audio HAL implements support for them.
|
||||
#
|
||||
# agc {
|
||||
# library pre_processing
|
||||
# uuid aa8130e0-66fc-11e0-bad0-0002a5d5c51b
|
||||
# }
|
||||
# aec {
|
||||
# library pre_processing
|
||||
# uuid bb392ec0-8d4d-11e0-a896-0002a5d5c51b
|
||||
# }
|
||||
# ns {
|
||||
# library pre_processing
|
||||
# uuid c06c8400-8e06-11e0-9cb6-0002a5d5c51b
|
||||
# }
|
||||
|
||||
# Audio preprocessor configurations.
|
||||
# The pre processor configuration consists in a list of elements each describing
|
||||
# pre processor settings for a given input source. Valid input source names are:
|
||||
# "mic", "camcorder", "voice_recognition", "voice_communication"
|
||||
# Each input source element contains a list of effects elements. The name of the effect
|
||||
# element must be the name of one of the effects in the "effects" list of the file.
|
||||
# Each effect element may optionally contain a list of parameters and their
|
||||
# default value to apply when the pre processor effect is created.
|
||||
# A parameter is defined by a "param" element and a "value" element. Each of these elements
|
||||
# consists in one or more elements specifying a type followed by a value.
|
||||
# The types defined are: "int", "short", "float", "bool" and "string"
|
||||
# When both "param" and "value" are a single int, a simple form is allowed where just
|
||||
# the param and value pair is present in the parameter description
|
||||
# pre_processing {
|
||||
# <input source name> {
|
||||
# <fx name> {
|
||||
# <param 1 name> {
|
||||
# param {
|
||||
# int|short|float|bool|string <value>
|
||||
# [ int|short|float|bool|string <value> ]
|
||||
# ...
|
||||
# }
|
||||
# value {
|
||||
# int|short|float|bool|string <value>
|
||||
# [ int|short|float|bool|string <value> ]
|
||||
# ...
|
||||
# }
|
||||
# }
|
||||
# <param 2 name > {<param> <value>}
|
||||
# ...
|
||||
# }
|
||||
# ...
|
||||
# }
|
||||
# ...
|
||||
# }
|
||||
|
||||
#
|
||||
# TODO: add default audio pre processor configurations after debug and tuning phase
|
||||
#
|
||||
@ -1,2 +0,0 @@
|
||||
0 0 android
|
||||
0 1 adreno
|
||||
@ -1,3 +0,0 @@
|
||||
# List of MAC addresses that are allowed to authenticate (IEEE 802.11)
|
||||
# with the AP. Optional VLAN ID can be assigned for clients based on the
|
||||
# MAC address if dynamic VLANs (hostapd.conf dynamic_vlan option) are used.
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,2 +0,0 @@
|
||||
# List of MAC addresses that are not allowed to authenticate (IEEE 802.11)
|
||||
# with the AP.
|
||||
@ -1,114 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!-- Copyright (C) 2012 The Android Open Source Project
|
||||
Copyright (C) 2014 The Linux Foundation. All rights reserved.
|
||||
Not a contribution.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<MediaCodecs>
|
||||
<Include href="media_codecs_google_audio.xml" />
|
||||
<Include href="media_codecs_google_telephony.xml" />
|
||||
<Encoders>
|
||||
<!-- Audio Hardware -->
|
||||
<MediaCodec name="OMX.qcom.audio.encoder.evrc" type="audio/evrc" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.audio.encoder.qcelp13" type="audio/qcelp" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
</MediaCodec>
|
||||
<!-- Audio Software -->
|
||||
<!-- Video Hardware -->
|
||||
<MediaCodec name="OMX.qcom.video.encoder.avc" type="video/avc" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Quirk name="requires-loaded-to-idle-after-allocation" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.video.encoder.mpeg4" type="video/mp4v-es" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Quirk name="requires-loaded-to-idle-after-allocation"/>
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.video.encoder.h263" type="video/3gpp" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Quirk name="requires-loaded-to-idle-after-allocation" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.video.encoder.vp8" type="video/x-vnd.on2.vp8" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Quirk name="requires-loaded-to-idle-after-allocation" />
|
||||
</MediaCodec>
|
||||
</Encoders>
|
||||
<Decoders>
|
||||
<MediaCodec name="OMX.qcom.audio.decoder.amrwbplus" type="audio/amr-wb-plus" >
|
||||
</MediaCodec>
|
||||
<!-- Audio Software -->
|
||||
<MediaCodec name="OMX.google.aac.decoder" type="audio/mp4a-latm" />
|
||||
<MediaCodec name="OMX.qcom.audio.decoder.Qcelp13" type="audio/qcelp" >
|
||||
<Quirk name="requires-global-flush" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.audio.decoder.evrc" type="audio/evrc" >
|
||||
<Quirk name="requires-global-flush" />
|
||||
</MediaCodec>
|
||||
<!-- Video Hardware -->
|
||||
<MediaCodec name="OMX.qcom.video.decoder.avc" type="video/avc" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.video.decoder.mpeg2" type="video/mpeg2" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.video.decoder.mpeg4" type="video/mp4v-es" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.video.decoder.h263" type="video/3gpp" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.video.decoder.divx" type="video/divx" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.video.decoder.divx311" type="video/divx311" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.video.decoder.divx4" type="video/divx4" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.video.decoder.vp8" type="video/x-vnd.on2.vp8" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
<MediaCodec name="OMX.qcom.video.decoder.hevchybrid" type="video/hevc" >
|
||||
<Quirk name="requires-allocate-on-input-ports" />
|
||||
<Quirk name="requires-allocate-on-output-ports" />
|
||||
<Feature name="adaptive-playback" />
|
||||
</MediaCodec>
|
||||
</Decoders>
|
||||
<Include href="media_codecs_google_video.xml" />
|
||||
<Include href="media_codecs_ffmpeg.xml" />
|
||||
</MediaCodecs>
|
||||
@ -1,2 +0,0 @@
|
||||
PRIO=0,0,0,0,1,1,1,1
|
||||
IGNORED_IRQ=20,39,200,203
|
||||
@ -1,2 +0,0 @@
|
||||
disable_scan_offload=1
|
||||
p2p_no_group_iface=1
|
||||
@ -1,262 +0,0 @@
|
||||
/* IPC Security Config */
|
||||
/* <GPS QMI Service ID - 16>:<GPS QMI Instance ID - all instances>:<Client Group ID> */
|
||||
16:4294967295:1000:3004
|
||||
/* Allow SS CTL service to be used by system and net_raw processes */
|
||||
43:4294967295:1000:3004
|
||||
/* Allow Sensor services to be used by sensor process */
|
||||
256:4294967295:3011
|
||||
257:4294967295:3011
|
||||
258:4294967295:3011
|
||||
259:4294967295:3011
|
||||
260:4294967295:3011
|
||||
261:4294967295:3011
|
||||
262:4294967295:3011
|
||||
263:4294967295:3011
|
||||
264:4294967295:3011
|
||||
265:4294967295:3011
|
||||
266:4294967295:3011
|
||||
267:4294967295:3011
|
||||
268:4294967295:3011
|
||||
269:4294967295:3011
|
||||
270:4294967295:3011
|
||||
271:4294967295:3011
|
||||
272:4294967295:3011
|
||||
273:4294967295:3011
|
||||
274:4294967295:3011
|
||||
275:4294967295:3011
|
||||
276:4294967295:3011
|
||||
277:4294967295:3011
|
||||
278:4294967295:3011
|
||||
279:4294967295:3011
|
||||
280:4294967295:3011
|
||||
281:4294967295:3011
|
||||
282:4294967295:3011
|
||||
283:4294967295:3011
|
||||
284:4294967295:3011
|
||||
285:4294967295:3011
|
||||
286:4294967295:3011
|
||||
287:4294967295:3011
|
||||
288:4294967295:3011
|
||||
289:4294967295:3011
|
||||
290:4294967295:3011
|
||||
291:4294967295:3011
|
||||
292:4294967295:3011
|
||||
293:4294967295:3011
|
||||
294:4294967295:3011
|
||||
295:4294967295:3011
|
||||
296:4294967295:3011
|
||||
297:4294967295:3011
|
||||
298:4294967295:3011
|
||||
299:4294967295:3011
|
||||
300:4294967295:3011
|
||||
301:4294967295:3011
|
||||
302:4294967295:3011
|
||||
303:4294967295:3011
|
||||
304:4294967295:3011
|
||||
305:4294967295:3011
|
||||
306:4294967295:3011
|
||||
307:4294967295:3011
|
||||
308:4294967295:3011
|
||||
309:4294967295:3011
|
||||
310:4294967295:3011
|
||||
311:4294967295:3011
|
||||
312:4294967295:3011
|
||||
313:4294967295:3011
|
||||
314:4294967295:3011
|
||||
315:4294967295:3011
|
||||
316:4294967295:3011
|
||||
317:4294967295:3011
|
||||
318:4294967295:3011
|
||||
319:4294967295:3011
|
||||
320:4294967295:3011
|
||||
321:4294967295:3011
|
||||
322:4294967295:3011
|
||||
323:4294967295:3011
|
||||
324:4294967295:3011
|
||||
325:4294967295:3011
|
||||
326:4294967295:3011
|
||||
327:4294967295:3011
|
||||
328:4294967295:3011
|
||||
329:4294967295:3011
|
||||
330:4294967295:3011
|
||||
331:4294967295:3011
|
||||
332:4294967295:3011
|
||||
333:4294967295:3011
|
||||
334:4294967295:3011
|
||||
335:4294967295:3011
|
||||
336:4294967295:3011
|
||||
337:4294967295:3011
|
||||
338:4294967295:3011
|
||||
339:4294967295:3011
|
||||
340:4294967295:3011
|
||||
341:4294967295:3011
|
||||
342:4294967295:3011
|
||||
343:4294967295:3011
|
||||
344:4294967295:3011
|
||||
345:4294967295:3011
|
||||
346:4294967295:3011
|
||||
347:4294967295:3011
|
||||
348:4294967295:3011
|
||||
349:4294967295:3011
|
||||
350:4294967295:3011
|
||||
351:4294967295:3011
|
||||
352:4294967295:3011
|
||||
353:4294967295:3011
|
||||
354:4294967295:3011
|
||||
355:4294967295:3011
|
||||
356:4294967295:3011
|
||||
357:4294967295:3011
|
||||
358:4294967295:3011
|
||||
359:4294967295:3011
|
||||
360:4294967295:3011
|
||||
361:4294967295:3011
|
||||
362:4294967295:3011
|
||||
363:4294967295:3011
|
||||
364:4294967295:3011
|
||||
365:4294967295:3011
|
||||
366:4294967295:3011
|
||||
367:4294967295:3011
|
||||
368:4294967295:3011
|
||||
369:4294967295:3011
|
||||
370:4294967295:3011
|
||||
371:4294967295:3011
|
||||
372:4294967295:3011
|
||||
373:4294967295:3011
|
||||
374:4294967295:3011
|
||||
375:4294967295:3011
|
||||
376:4294967295:3011
|
||||
377:4294967295:3011
|
||||
378:4294967295:3011
|
||||
379:4294967295:3011
|
||||
380:4294967295:3011
|
||||
381:4294967295:3011
|
||||
382:4294967295:3011
|
||||
383:4294967295:3011
|
||||
384:4294967295:3011
|
||||
385:4294967295:3011
|
||||
386:4294967295:3011
|
||||
387:4294967295:3011
|
||||
388:4294967295:3011
|
||||
389:4294967295:3011
|
||||
390:4294967295:3011
|
||||
391:4294967295:3011
|
||||
392:4294967295:3011
|
||||
393:4294967295:3011
|
||||
394:4294967295:3011
|
||||
395:4294967295:3011
|
||||
396:4294967295:3011
|
||||
397:4294967295:3011
|
||||
398:4294967295:3011
|
||||
399:4294967295:3011
|
||||
400:4294967295:3011
|
||||
401:4294967295:3011
|
||||
402:4294967295:3011
|
||||
403:4294967295:3011
|
||||
404:4294967295:3011
|
||||
405:4294967295:3011
|
||||
406:4294967295:3011
|
||||
407:4294967295:3011
|
||||
408:4294967295:3011
|
||||
409:4294967295:3011
|
||||
410:4294967295:3011
|
||||
411:4294967295:3011
|
||||
412:4294967295:3011
|
||||
413:4294967295:3011
|
||||
414:4294967295:3011
|
||||
415:4294967295:3011
|
||||
416:4294967295:3011
|
||||
417:4294967295:3011
|
||||
418:4294967295:3011
|
||||
419:4294967295:3011
|
||||
420:4294967295:3011
|
||||
421:4294967295:3011
|
||||
422:4294967295:3011
|
||||
423:4294967295:3011
|
||||
424:4294967295:3011
|
||||
425:4294967295:3011
|
||||
426:4294967295:3011
|
||||
427:4294967295:3011
|
||||
428:4294967295:3011
|
||||
429:4294967295:3011
|
||||
430:4294967295:3011
|
||||
431:4294967295:3011
|
||||
432:4294967295:3011
|
||||
433:4294967295:3011
|
||||
434:4294967295:3011
|
||||
435:4294967295:3011
|
||||
436:4294967295:3011
|
||||
437:4294967295:3011
|
||||
438:4294967295:3011
|
||||
439:4294967295:3011
|
||||
440:4294967295:3011
|
||||
441:4294967295:3011
|
||||
442:4294967295:3011
|
||||
443:4294967295:3011
|
||||
444:4294967295:3011
|
||||
445:4294967295:3011
|
||||
446:4294967295:3011
|
||||
447:4294967295:3011
|
||||
448:4294967295:3011
|
||||
449:4294967295:3011
|
||||
450:4294967295:3011
|
||||
451:4294967295:3011
|
||||
452:4294967295:3011
|
||||
453:4294967295:3011
|
||||
454:4294967295:3011
|
||||
455:4294967295:3011
|
||||
456:4294967295:3011
|
||||
457:4294967295:3011
|
||||
458:4294967295:3011
|
||||
459:4294967295:3011
|
||||
460:4294967295:3011
|
||||
461:4294967295:3011
|
||||
462:4294967295:3011
|
||||
463:4294967295:3011
|
||||
464:4294967295:3011
|
||||
465:4294967295:3011
|
||||
466:4294967295:3011
|
||||
467:4294967295:3011
|
||||
468:4294967295:3011
|
||||
469:4294967295:3011
|
||||
470:4294967295:3011
|
||||
471:4294967295:3011
|
||||
472:4294967295:3011
|
||||
473:4294967295:3011
|
||||
474:4294967295:3011
|
||||
475:4294967295:3011
|
||||
476:4294967295:3011
|
||||
477:4294967295:3011
|
||||
478:4294967295:3011
|
||||
479:4294967295:3011
|
||||
480:4294967295:3011
|
||||
481:4294967295:3011
|
||||
482:4294967295:3011
|
||||
483:4294967295:3011
|
||||
484:4294967295:3011
|
||||
485:4294967295:3011
|
||||
486:4294967295:3011
|
||||
487:4294967295:3011
|
||||
488:4294967295:3011
|
||||
489:4294967295:3011
|
||||
490:4294967295:3011
|
||||
491:4294967295:3011
|
||||
492:4294967295:3011
|
||||
493:4294967295:3011
|
||||
494:4294967295:3011
|
||||
495:4294967295:3011
|
||||
496:4294967295:3011
|
||||
497:4294967295:3011
|
||||
498:4294967295:3011
|
||||
499:4294967295:3011
|
||||
500:4294967295:3011
|
||||
501:4294967295:3011
|
||||
502:4294967295:3011
|
||||
503:4294967295:3011
|
||||
504:4294967295:3011
|
||||
505:4294967295:3011
|
||||
506:4294967295:3011
|
||||
507:4294967295:3011
|
||||
508:4294967295:3011
|
||||
509:4294967295:3011
|
||||
510:4294967295:3011
|
||||
511:4294967295:3011
|
||||
@ -1,3 +0,0 @@
|
||||
disable_scan_offload=1
|
||||
p2p_disabled=1
|
||||
p2p_no_group_iface=1
|
||||
@ -1 +0,0 @@
|
||||
include $(call all-subdir-makefiles)
|
||||
@ -1,11 +0,0 @@
|
||||
# Makefile.am - Automake script for Data-opensource
|
||||
#
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
SUBDIRS = rmnetctl/src rmnetctl/cli
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = data-oss.pc
|
||||
EXTRA_DIST = $(pkgconfig_DATA)
|
||||
|
||||
@ -1,50 +0,0 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ([2.65])
|
||||
AC_INIT(data-oss, 1.0.0)
|
||||
AM_INIT_AUTOMAKE(data-oss, 1.0.0)
|
||||
AC_OUTPUT(Makefile rmnetctl/src/Makefile rmnetctl/cli/Makefile data-oss.pc)
|
||||
AC_CONFIG_SRCDIR([rmnetctl/src/librmnetctl.c])
|
||||
#AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
# Checks for libraries.
|
||||
AC_ARG_WITH(sanitized-headers,
|
||||
AS_HELP_STRING([--with-sanitized-headers=DIR],
|
||||
[Specify the location of the sanitized Linux headers]),
|
||||
[CPPFLAGS="$CPPFLAGS -idirafter $withval"])
|
||||
|
||||
AC_ARG_WITH([glib],
|
||||
AC_HELP_STRING([--with-glib],
|
||||
[enable glib, building HLOS systems which use glib]))
|
||||
|
||||
if (test "x${with_glib}" = "xyes"); then
|
||||
AC_DEFINE(ENABLE_USEGLIB, 1, [Define if HLOS systems uses glib])
|
||||
PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= 2.16, dummy=yes,
|
||||
AC_MSG_ERROR(GThread >= 2.16 is required))
|
||||
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.16, dummy=yes,
|
||||
AC_MSG_ERROR(GLib >= 2.16 is required))
|
||||
GLIB_CFLAGS="$GLIB_CFLAGS $GTHREAD_CFLAGS"
|
||||
GLIB_LIBS="$GLIB_LIBS $GTHREAD_LIBS"
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(USE_GLIB, test "x${with_glib}" = "xyes")
|
||||
|
||||
# Checks for header files.
|
||||
AC_CHECK_HEADERS([sys/socket.h stdint.h linux/netlink.h string.h stdio.h unistd.h stdlib.h linux/rmnet_data.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_TYPE_OFF_T
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
|
||||
#AC_FUNC_MMAP
|
||||
#AC_CHECK_FUNCS([memset malloc sendto recvfrom ])
|
||||
AC_OUTPUT
|
||||
@ -1,10 +0,0 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: data-oss
|
||||
Description: Data Opensource Components
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lrmnetctl
|
||||
Cflags: -I${includedir}/data-oss
|
||||
@ -1,2 +0,0 @@
|
||||
include $(call all-subdir-makefiles)
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := rmnetcli.c
|
||||
LOCAL_CFLAGS := -Wall -Werror
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../inc
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../src
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)
|
||||
|
||||
LOCAL_MODULE := rmnetcli
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := librmnetctl
|
||||
include $(BUILD_EXECUTABLE)
|
||||
@ -1,9 +0,0 @@
|
||||
AM_CFLAGS = -Wall -Werror -Wundef -Wstrict-prototypes -Wno-trigraphs
|
||||
AM_CFLAGS += -I./../inc
|
||||
rmnetcli_SOURCES = rmnetcli.c
|
||||
bin_PROGRAMS = rmnetcli
|
||||
requiredlibs = ../src/librmnetctl.la
|
||||
rmnetcli_LDADD = $(requiredlibs)
|
||||
LOCAL_MODULE := librmnetctl
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
@ -1,415 +0,0 @@
|
||||
/******************************************************************************
|
||||
|
||||
R M N E T C L I . C
|
||||
|
||||
Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of The Linux Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
@file rmnetcli.c
|
||||
@brief command line interface to expose rmnet control API's
|
||||
|
||||
DESCRIPTION
|
||||
File containing implementation of the command line interface to expose the
|
||||
rmnet control configuration .
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
/*===========================================================================
|
||||
INCLUDE FILES
|
||||
===========================================================================*/
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <stdint.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "rmnetcli.h"
|
||||
#include "librmnetctl.h"
|
||||
|
||||
#define RMNET_MAX_STR_LEN 16
|
||||
|
||||
#define _RMNETCLI_CHECKNULL(X) do { if (!X) { \
|
||||
print_rmnet_api_status(RMNETCTL_INVALID_ARG, RMNETCTL_CFG_FAILURE_NO_COMMAND); \
|
||||
rmnetctl_cleanup(handle); \
|
||||
return RMNETCTL_INVALID_ARG; \
|
||||
} } while (0);
|
||||
#define _STRTOUI32(X) (uint32_t)strtoul(X, NULL, 0)
|
||||
#define _STRTOUI16(X) (uint16_t)strtoul(X, NULL, 0)
|
||||
#define _STRTOUI8(X) (uint8_t)strtoul(X, NULL, 0)
|
||||
#define _STRTOI32(X) (int32_t)strtol(X, NULL, 0)
|
||||
|
||||
#define _5TABS "\n\t\t\t\t\t"
|
||||
#define _2TABS "\n\t\t"
|
||||
|
||||
/*!
|
||||
* @brief Contains a list of error message from CLI
|
||||
*/
|
||||
char rmnetcfg_error_code_text
|
||||
[RMNETCFG_TOTAL_ERR_MSGS][RMNETCTL_ERR_MSG_SIZE] = {
|
||||
"Help option Specified",
|
||||
"ERROR: No\\Invalid command was specified\n",
|
||||
"ERROR: Could not allocate buffer for Egress device\n"
|
||||
};
|
||||
|
||||
/*!
|
||||
* @brief Method to display the syntax for the commands
|
||||
* @details Displays the syntax and usage for the commands
|
||||
* @param void
|
||||
* @return void
|
||||
*/
|
||||
static void rmnet_api_usage(void)
|
||||
{
|
||||
printf("RmNet API Usage:\n\n");
|
||||
printf("rmnetcli help Displays this help\n");
|
||||
printf("\n");
|
||||
printf("rmnetcli assocnetdev <dev_name> Registers the RmNet");
|
||||
printf(_5TABS" data driver on a particular");
|
||||
printf(_5TABS" device.dev_name cannot");
|
||||
printf(_5TABS" be larger than 15");
|
||||
printf(_5TABS" characters. Returns");
|
||||
printf(_5TABS" the status code.\n\n");
|
||||
printf("rmnetcli unassocnetdev <dev_name> Unregisters the");
|
||||
printf(_5TABS" RmNet data driver on a particular");
|
||||
printf(_5TABS" device. dev_name cannot");
|
||||
printf(_5TABS" be larger than 15");
|
||||
printf(_5TABS" characters. Returns");
|
||||
printf(_5TABS" the status code.\n\n");
|
||||
printf("rmnetcli getnetdevassoc <dev_name> Get if the RmNet");
|
||||
printf(_5TABS" data driver is registered on");
|
||||
printf(_5TABS" a particular device.");
|
||||
printf(_5TABS" dev_name cannot be");
|
||||
printf(_5TABS" larger than 15");
|
||||
printf(_5TABS" characters. Returns 1");
|
||||
printf(_5TABS" if is registered and");
|
||||
printf(_5TABS" 0 if it is not");
|
||||
printf(_5TABS" registered\n\n");
|
||||
printf("rmnetcli setledf <egress_flags> Sets the egress data");
|
||||
printf(_2TABS" <agg_size> format for a particular link.");
|
||||
printf(_2TABS" <agg_count> dev_name cannot be larger");
|
||||
printf(_2TABS" <dev_name> than 15 characters.");
|
||||
printf(_5TABS" Returns the status code\n\n");
|
||||
printf("rmnetcli getledf <dev_name> Gets the egress data");
|
||||
printf(_5TABS" format for a particular link.");
|
||||
printf(_5TABS" dev_name cannot be larger");
|
||||
printf(_5TABS" than 15. Returns the 4");
|
||||
printf(_5TABS" byte unsigned integer");
|
||||
printf(_5TABS" egress_flags\n\n");
|
||||
printf("rmnetcli setlidf <ingress_flags> Sets the ingress");
|
||||
printf(_2TABS" <tail_spacing> data format for a particular");
|
||||
printf(_2TABS" <dev_name> link. ingress_flags is 4");
|
||||
printf(_5TABS" byte unsigned integer.");
|
||||
printf(_5TABS" tail_spacing is a one.");
|
||||
printf(_5TABS" byte unsigned integer.");
|
||||
printf(_5TABS" dev_name cannot be");
|
||||
printf(_5TABS" larger than 15.");
|
||||
printf(_5TABS" characters. Returns");
|
||||
printf(_5TABS" the status code\n\n");
|
||||
printf("rmnetcli getlidf <dev_name> Gets the ingress");
|
||||
printf(_5TABS" data format for a particular");
|
||||
printf(_5TABS" link. dev_name cannot be");
|
||||
printf(_5TABS" larger than 15. Returns");
|
||||
printf(_5TABS" the 4 byte unsigned");
|
||||
printf(_5TABS" integer ingress_flags\n\n");
|
||||
printf("rmnetcli setlepc <logical_ep_id> Sets the logical");
|
||||
printf(_2TABS" <rmnet_mode> endpoint configuration for");
|
||||
printf(_2TABS" <dev_name> a particular link.");
|
||||
printf(_2TABS" <egress_dev_name> logical_ep_id are 32bit");
|
||||
printf(_5TABS" integers from -1 to 31.");
|
||||
printf(_5TABS" rmnet_mode is a 1 byte");
|
||||
printf(_5TABS" unsigned integer of");
|
||||
printf(_5TABS" value none, vnd or");
|
||||
printf(_5TABS" bridged. dev_name");
|
||||
printf(_5TABS" and egress_dev_name");
|
||||
printf(_5TABS" cannot be larger");
|
||||
printf(_5TABS" than 15 tcharacters");
|
||||
printf(_5TABS" Returns the status code\n\n");
|
||||
printf("rmnetcli unsetlepc <logical_ep_id> Un-sets the logical");
|
||||
printf(_2TABS" <dev_name> endpoint configuration for");
|
||||
printf(_5TABS" a particular link.");
|
||||
printf(_5TABS" integers from -1 to 31.");
|
||||
printf(_5TABS" dev_name cannot be larger");
|
||||
printf(_5TABS" than 15 tcharacters");
|
||||
printf(_5TABS" Returns the status code\n\n");
|
||||
printf("rmnetcli getlepc <logical_ep_id> Sets the logical");
|
||||
printf(_2TABS" <dev_name> enpoint configuration for a");
|
||||
printf(_5TABS" particular link.");
|
||||
printf(_5TABS" logical_ep_id are 32bit");
|
||||
printf(_5TABS" integers from -1 to 31.");
|
||||
printf(_5TABS" Returns the rmnet_mode");
|
||||
printf(_5TABS" and egress_dev_name.");
|
||||
printf(_5TABS" rmnet_mode is a 1");
|
||||
printf(_5TABS" byte unsigned integer");
|
||||
printf(_5TABS" of value none, vnd or");
|
||||
printf(_5TABS" bridged. dev_name and");
|
||||
printf(_5TABS" egress_dev_name cannot be");
|
||||
printf(_5TABS" larger than 15 ");
|
||||
printf(_5TABS" characters. Returns the");
|
||||
printf(_5TABS" status code\n\n");
|
||||
printf("rmnetcli newvnd <dev_id> Creates a new");
|
||||
printf(_5TABS" virtual network device node.");
|
||||
printf(_5TABS" dev_id is an int");
|
||||
printf(_5TABS" less than 32. Returns");
|
||||
printf(_5TABS" the status code\n\n");
|
||||
printf("rmnetcli newvndprefix <dev_id> <name_prefix> Creates");
|
||||
printf(_5TABS" virtual network device node.");
|
||||
printf(_5TABS" dev_id is an int");
|
||||
printf(_5TABS" less than 32. Prefix");
|
||||
printf(_5TABS" must be less than");
|
||||
printf(_5TABS" 15 chars. Returns");
|
||||
printf(_5TABS" the status code\n\n");
|
||||
printf("rmnetcli getvndname <dev_id> Get name of");
|
||||
printf(_5TABS" network device node from id\n\n");
|
||||
printf("rmnetcli freevnd <dev_id> Removes virtual");
|
||||
printf(_5TABS" network device node. dev_name");
|
||||
printf(_5TABS" cannot be larger than 15.");
|
||||
printf(_5TABS" Returns the status code\n\n");
|
||||
printf("rmnetcli addvnctcflow <dev_id> Add a modem flow");
|
||||
printf(_2TABS" <mdm_flow_hndl> handle - tc flow handle");
|
||||
printf(_2TABS" <tc_flow_hndl> mapping for a virtual network");
|
||||
printf(_2TABS" device node\n\n");
|
||||
printf("rmnetcli delvnctcflow <dev_id> Delete a modem flow");
|
||||
printf(_2TABS" <mdm_flow_hndl> handle - tc flow handle");
|
||||
printf(_2TABS" <tc_flow_hndl> mapping for a virtual network");
|
||||
printf(_2TABS" device node\n\n");
|
||||
}
|
||||
|
||||
static void print_rmnetctl_lib_errors(uint16_t error_number)
|
||||
{
|
||||
if ((error_number > RMNETCTL_API_SUCCESS) &&
|
||||
(error_number < RMNETCTL_API_ERR_ENUM_LENGTH)) {
|
||||
printf("%s", rmnetctl_error_code_text[error_number]);
|
||||
}
|
||||
if ((error_number >= RMNETCFG_ERR_NUM_START) &&
|
||||
(error_number < RMNETCFG_ERR_NUM_START + RMNETCFG_TOTAL_ERR_MSGS)) {
|
||||
printf("%s", rmnetcfg_error_code_text
|
||||
[error_number - RMNETCFG_ERR_NUM_START]);
|
||||
if ((error_number == RMNETCTL_CFG_SUCCESS_HELP_COMMAND) ||
|
||||
(error_number == RMNETCTL_CFG_FAILURE_NO_COMMAND))
|
||||
rmnet_api_usage();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Method to check the error numbers generated from API calls
|
||||
* @details Displays the error messages based on each error code
|
||||
* @param error_number Error number returned from the API and the CLI
|
||||
* @return void
|
||||
*/
|
||||
static void print_rmnet_api_status(int return_code, uint16_t error_number)
|
||||
{
|
||||
if (return_code == RMNETCTL_SUCCESS)
|
||||
printf("SUCCESS\n");
|
||||
else if (return_code == RMNETCTL_LIB_ERR) {
|
||||
printf("LIBRARY ");
|
||||
print_rmnetctl_lib_errors(error_number);
|
||||
} else if (return_code == RMNETCTL_KERNEL_ERR)
|
||||
printf("KERNEL %s", rmnetctl_error_code_text[error_number]);
|
||||
else if (return_code == RMNETCTL_INVALID_ARG)
|
||||
printf("INVALID_ARG\n");
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Method to make the API calls
|
||||
* @details Checks for each type of parameter and calls the appropriate
|
||||
* function based on the number of parameters and paramter type
|
||||
* @param argc Number of arguments which vary based on the commands
|
||||
* @param argv Value of the arguments which vary based on the commands
|
||||
* @return RMNETCTL_SUCCESS if successful. Relevant data might be printed
|
||||
* based on the message type
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Error code will be
|
||||
* printed
|
||||
* @return RMNETCTL_KERNEL_ERR if there was a error in the kernel. Error code will be
|
||||
* printed
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
|
||||
static int rmnet_api_call(int argc, char *argv[])
|
||||
{
|
||||
struct rmnetctl_hndl_s *handle = NULL;
|
||||
uint16_t error_number = RMNETCTL_CFG_FAILURE_NO_COMMAND;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
if ((!argc) || (!*argv)) {
|
||||
print_rmnet_api_status(RMNETCTL_LIB_ERR,
|
||||
RMNETCTL_CFG_FAILURE_NO_COMMAND);
|
||||
return RMNETCTL_LIB_ERR;
|
||||
}
|
||||
if (!strcmp(*argv, "help")) {
|
||||
print_rmnet_api_status(RMNETCTL_LIB_ERR,
|
||||
RMNETCTL_CFG_SUCCESS_HELP_COMMAND);
|
||||
return RMNETCTL_LIB_ERR;
|
||||
}
|
||||
return_code = rmnetctl_init(&handle, &error_number);
|
||||
if (return_code!= RMNETCTL_SUCCESS) {
|
||||
print_rmnet_api_status(return_code, error_number);
|
||||
return RMNETCTL_LIB_ERR;
|
||||
}
|
||||
error_number = RMNETCTL_CFG_FAILURE_NO_COMMAND;
|
||||
return_code = RMNETCTL_LIB_ERR;
|
||||
if (!strcmp(*argv, "assocnetdev")) {
|
||||
return_code = rmnet_associate_network_device(handle,
|
||||
argv[1], &error_number, RMNETCTL_DEVICE_ASSOCIATE);
|
||||
} else if (!strcmp(*argv, "unassocnetdev")) {
|
||||
return_code = rmnet_associate_network_device(handle,
|
||||
argv[1], &error_number, RMNETCTL_DEVICE_UNASSOCIATE);
|
||||
} else if (!strcmp(*argv, "getnetdevassoc")) {
|
||||
int register_status;
|
||||
return_code = rmnet_get_network_device_associated(handle,
|
||||
argv[1], ®ister_status, &error_number);
|
||||
if (return_code == RMNETCTL_SUCCESS)
|
||||
printf("register_status is %d\n", register_status);
|
||||
} else if (!strcmp(*argv, "getledf")) {
|
||||
uint32_t egress_flags;
|
||||
uint16_t agg_size, agg_count;
|
||||
return_code = rmnet_get_link_egress_data_format(handle,
|
||||
argv[1], &egress_flags, &agg_size, &agg_count, &error_number);
|
||||
if (return_code == RMNETCTL_SUCCESS) {
|
||||
printf("egress_flags is %u\n", egress_flags);
|
||||
printf("agg_size is %u\n", agg_size);
|
||||
printf("agg_count is %u\n", agg_count);
|
||||
}
|
||||
} else if (!strcmp(*argv, "getlidf")) {
|
||||
uint32_t ingress_flags;
|
||||
uint8_t tail_spacing;
|
||||
return_code = rmnet_get_link_ingress_data_format_tailspace(
|
||||
handle, argv[1], &ingress_flags, &tail_spacing, &error_number);
|
||||
if (return_code == RMNETCTL_SUCCESS) {
|
||||
printf("ingress_flags is %u\n", ingress_flags);
|
||||
printf("tail_spacing is %u\n", tail_spacing);
|
||||
}
|
||||
} else if (!strcmp(*argv, "newvndprefix")) {
|
||||
_RMNETCLI_CHECKNULL(argv[1]);
|
||||
_RMNETCLI_CHECKNULL(argv[2]);
|
||||
return_code = rmnet_new_vnd_prefix(handle,
|
||||
_STRTOUI32(argv[1]), &error_number, RMNETCTL_NEW_VND, argv[2]);
|
||||
} else if (!strcmp(*argv, "newvnd")) {
|
||||
_RMNETCLI_CHECKNULL(argv[1]);
|
||||
return_code = rmnet_new_vnd(handle,
|
||||
_STRTOUI32(argv[1]), &error_number, RMNETCTL_NEW_VND);
|
||||
} else if (!strcmp(*argv, "getvndname")) {
|
||||
char buffer[32];
|
||||
memset(buffer, 0, 32);
|
||||
_RMNETCLI_CHECKNULL(argv[1]);
|
||||
return_code = rmnet_get_vnd_name(handle, _STRTOUI32(argv[1]),
|
||||
&error_number, buffer, 32);
|
||||
if (return_code == RMNETCTL_SUCCESS) {
|
||||
printf("VND name: %s\n", buffer);
|
||||
}
|
||||
} else if (!strcmp(*argv, "freevnd")) {
|
||||
_RMNETCLI_CHECKNULL(argv[1]);
|
||||
return_code = rmnet_new_vnd(handle,
|
||||
_STRTOUI32(argv[1]), &error_number, RMNETCTL_FREE_VND);
|
||||
} else if (!strcmp(*argv, "setlidf")) {
|
||||
_RMNETCLI_CHECKNULL(argv[1]);
|
||||
_RMNETCLI_CHECKNULL(argv[2]);
|
||||
_RMNETCLI_CHECKNULL(argv[3]);
|
||||
return_code = rmnet_set_link_ingress_data_format_tailspace(
|
||||
handle, _STRTOUI32(argv[1]), _STRTOUI8(argv[2]), argv[3],
|
||||
&error_number);
|
||||
} else if (!strcmp(*argv, "delvnctcflow")) {
|
||||
_RMNETCLI_CHECKNULL(argv[1]);
|
||||
_RMNETCLI_CHECKNULL(argv[2]);
|
||||
_RMNETCLI_CHECKNULL(argv[3]);
|
||||
return_code = rmnet_add_del_vnd_tc_flow(handle,
|
||||
_STRTOUI32(argv[1]), _STRTOUI32(argv[2]), _STRTOUI32(argv[3]),
|
||||
RMNETCTL_DEL_FLOW, &error_number);
|
||||
} else if (!strcmp(*argv, "getlepc")) {
|
||||
_RMNETCLI_CHECKNULL(argv[1]);
|
||||
uint8_t rmnet_mode;
|
||||
char *egress_dev_name;
|
||||
egress_dev_name = NULL;
|
||||
egress_dev_name = (char *)malloc(RMNET_MAX_STR_LEN
|
||||
* sizeof(char));
|
||||
if (!egress_dev_name) {
|
||||
print_rmnet_api_status(RMNETCTL_LIB_ERR,
|
||||
RMNETCTL_CFG_FAILURE_EGRESS_DEV_NAME_NULL);
|
||||
rmnetctl_cleanup(handle);
|
||||
return RMNETCTL_LIB_ERR;
|
||||
}
|
||||
return_code = rmnet_get_logical_ep_config(handle,
|
||||
_STRTOI32(argv[1]), argv[2], &rmnet_mode,
|
||||
&egress_dev_name, RMNET_MAX_STR_LEN, &error_number);
|
||||
if (return_code == RMNETCTL_SUCCESS) {
|
||||
printf("rmnet_mode is %u\n", rmnet_mode);
|
||||
printf("egress_dev_name is %s\n", egress_dev_name);
|
||||
}
|
||||
free(egress_dev_name);
|
||||
} else if (!strcmp(*argv, "addvnctcflow")) {
|
||||
_RMNETCLI_CHECKNULL(argv[1]);
|
||||
_RMNETCLI_CHECKNULL(argv[2]);
|
||||
_RMNETCLI_CHECKNULL(argv[3]);
|
||||
return_code = rmnet_add_del_vnd_tc_flow(handle,
|
||||
_STRTOUI32(argv[1]), _STRTOUI32(argv[2]), _STRTOUI32(argv[3]),
|
||||
RMNETCTL_ADD_FLOW, &error_number);
|
||||
} else if (!strcmp(*argv, "setledf")) {
|
||||
_RMNETCLI_CHECKNULL(argv[1]);
|
||||
_RMNETCLI_CHECKNULL(argv[2]);
|
||||
_RMNETCLI_CHECKNULL(argv[3]);
|
||||
return_code = rmnet_set_link_egress_data_format(handle,
|
||||
_STRTOUI32(argv[1]), _STRTOUI16(argv[2]), _STRTOUI16(argv[3]),
|
||||
argv[4], &error_number);
|
||||
} else if (!strcmp(*argv, "setlepc")) {
|
||||
_RMNETCLI_CHECKNULL(argv[1]);
|
||||
_RMNETCLI_CHECKNULL(argv[2]);
|
||||
return_code = rmnet_set_logical_ep_config(handle,
|
||||
_STRTOI32(argv[1]), _STRTOUI8(argv[2]), argv[3], argv[4],
|
||||
&error_number);
|
||||
} else if (!strcmp(*argv, "unsetlepc")) {
|
||||
_RMNETCLI_CHECKNULL(argv[1]);
|
||||
return_code = rmnet_unset_logical_ep_config(handle,
|
||||
_STRTOI32(argv[1]), argv[2], &error_number);
|
||||
}
|
||||
print_rmnet_api_status(return_code, error_number);
|
||||
rmnetctl_cleanup(handle);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Method which serves as en entry point to the rmnetcli function
|
||||
* @details Entry point for the RmNet Netlink API. This is the command line
|
||||
* interface for the RmNet API
|
||||
* @param argc Number of arguments which vary based on the commands
|
||||
* @param argv Value of the arguments which vary based on the commands
|
||||
* @return RMNETCTL_SUCCESS if successful. Relevant data might be printed
|
||||
* based on the message type
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Error code will be
|
||||
* printed
|
||||
* @return RMNETCTL_KERNEL_ERR if there was a error in the kernel. Error code will be
|
||||
* printed
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
argc--;
|
||||
argv++;
|
||||
return rmnet_api_call(argc, argv);
|
||||
}
|
||||
@ -1,61 +0,0 @@
|
||||
/******************************************************************************
|
||||
|
||||
R M N E T C L I . H
|
||||
|
||||
Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of The Linux Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
|
||||
@file rmnetcli.h
|
||||
@brief headers for the command line interface to expose rmnet control API's
|
||||
|
||||
DESCRIPTION
|
||||
Header file containing definition for the command line interface to expose
|
||||
rmnet control API's
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef RMNETCLI_H
|
||||
#define RMNETCLI_H
|
||||
|
||||
/* Print the help for the commands since the help flag was used. */
|
||||
#define RMNETCTL_CFG_SUCCESS_HELP_COMMAND 100
|
||||
/* No/invalid API call was specified. So return an error. */
|
||||
#define RMNETCTL_CFG_FAILURE_NO_COMMAND 101
|
||||
/* The buffer for egress device name was NULL */
|
||||
#define RMNETCTL_CFG_FAILURE_EGRESS_DEV_NAME_NULL 102
|
||||
|
||||
/* This should always be the value of the starting element */
|
||||
#define RMNETCFG_ERR_NUM_START 100
|
||||
|
||||
/* This should always be the total number of error message from CLI */
|
||||
#define RMNETCFG_TOTAL_ERR_MSGS 3
|
||||
|
||||
#endif /* not defined RMNETCLI_H */
|
||||
@ -1,499 +0,0 @@
|
||||
/******************************************************************************
|
||||
|
||||
L I B R M N E T C T L . H
|
||||
|
||||
Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of The Linux Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
/*!
|
||||
* @file librmnetctl.h
|
||||
* @brief rmnet control API's header file
|
||||
*/
|
||||
|
||||
#ifndef LIBRMNETCTL_H
|
||||
#define LIBRMNETCTL_H
|
||||
|
||||
/* RMNET API succeeded */
|
||||
#define RMNETCTL_SUCCESS 0
|
||||
/* RMNET API encountered an error while executing within the library. Check the
|
||||
* error code in this case */
|
||||
#define RMNETCTL_LIB_ERR 1
|
||||
/* RMNET API encountered an error while executing in the kernel. Check the
|
||||
* error code in this case */
|
||||
#define RMNETCTL_KERNEL_ERR 2
|
||||
/* RMNET API encountered an error because of invalid arguments*/
|
||||
#define RMNETCTL_INVALID_ARG 3
|
||||
|
||||
/* Flag to associate a network device*/
|
||||
#define RMNETCTL_DEVICE_ASSOCIATE 1
|
||||
/* Flag to unassociate a network device*/
|
||||
#define RMNETCTL_DEVICE_UNASSOCIATE 0
|
||||
/* Flag to create a new virtual network device*/
|
||||
#define RMNETCTL_NEW_VND 1
|
||||
/* Flag to free a new virtual network device*/
|
||||
#define RMNETCTL_FREE_VND 0
|
||||
/* Flag to add a new flow*/
|
||||
#define RMNETCTL_ADD_FLOW 1
|
||||
/* Flag to delete an existing flow*/
|
||||
#define RMNETCTL_DEL_FLOW 0
|
||||
|
||||
enum rmnetctl_error_codes_e {
|
||||
/* API succeeded. This should always be the first element. */
|
||||
RMNETCTL_API_SUCCESS,
|
||||
|
||||
RMNETCTL_API_FIRST_ERR,
|
||||
/* API failed because not enough memory to create buffer to send
|
||||
* message */
|
||||
RMNETCTL_API_ERR_REQUEST_INVALID = RMNETCTL_API_FIRST_ERR,
|
||||
/* API failed because not enough memory to create buffer for the
|
||||
* response message */
|
||||
RMNETCTL_API_ERR_RESPONSE_INVALID,
|
||||
/* API failed because could not send the message to kernel */
|
||||
RMNETCTL_API_ERR_MESSAGE_SEND,
|
||||
/* API failed because could not receive message from the kernel */
|
||||
RMNETCTL_API_ERR_MESSAGE_RECEIVE,
|
||||
|
||||
RMNETCTL_INIT_FIRST_ERR,
|
||||
/* Invalid process id. So return an error. */
|
||||
RMNETCTL_INIT_ERR_PROCESS_ID = RMNETCTL_INIT_FIRST_ERR,
|
||||
/* Invalid socket descriptor id. So return an error. */
|
||||
RMNETCTL_INIT_ERR_NETLINK_FD,
|
||||
/* Could not bind the socket to the Netlink file descriptor */
|
||||
RMNETCTL_INIT_ERR_BIND,
|
||||
/* Invalid user id. Only root has access to this function. (NA) */
|
||||
RMNETCTL_INIT_ERR_INVALID_USER,
|
||||
|
||||
RMNETCTL_API_SECOND_ERR,
|
||||
/* API failed because the RmNet handle for the transaction was NULL */
|
||||
RMNETCTL_API_ERR_HNDL_INVALID = RMNETCTL_API_SECOND_ERR,
|
||||
/* API failed because the request buffer for the transaction was NULL */
|
||||
RMNETCTL_API_ERR_REQUEST_NULL,
|
||||
/* API failed because the response buffer for the transaction was NULL*/
|
||||
RMNETCTL_API_ERR_RESPONSE_NULL,
|
||||
/* API failed because the request and response type do not match*/
|
||||
RMNETCTL_API_ERR_MESSAGE_TYPE,
|
||||
/* API failed because the return type is invalid */
|
||||
RMNETCTL_API_ERR_RETURN_TYPE,
|
||||
/* API failed because the string was truncated */
|
||||
RMNETCTL_API_ERR_STRING_TRUNCATION,
|
||||
|
||||
/* These error are 1-to-1 with rmnet_data config errors in rmnet_data.h
|
||||
for each conversion.
|
||||
please keep the enums synced.
|
||||
*/
|
||||
RMNETCTL_KERNEL_FIRST_ERR,
|
||||
/* No error */
|
||||
RMNETCTL_KERNEL_ERROR_NO_ERR = RMNETCTL_KERNEL_FIRST_ERR,
|
||||
/* Invalid / unsupported message */
|
||||
RMNETCTL_KERNEL_ERR_UNKNOWN_MESSAGE,
|
||||
/* Internal problem in the kernel modeule */
|
||||
RMNETCTL_KERNEL_ERR_INTERNAL,
|
||||
/* Kernel is temporarely out of memory */
|
||||
RMNETCTL_KERNEL_ERR_OUT_OF_MEM,
|
||||
/* Device already exists / Still in use */
|
||||
RMETNCTL_KERNEL_ERR_DEVICE_IN_USE,
|
||||
/* Invalid request / Unsupported scenario */
|
||||
RMNETCTL_KERNEL_ERR_INVALID_REQUEST,
|
||||
/* Device doesn't exist */
|
||||
RMNETCTL_KERNEL_ERR_NO_SUCH_DEVICE,
|
||||
/* One or more of the arguments is invalid */
|
||||
RMNETCTL_KERNEL_ERR_BAD_ARGS,
|
||||
/* Egress device is invalid */
|
||||
RMNETCTL_KERNEL_ERR_BAD_EGRESS_DEVICE,
|
||||
/* TC handle is full */
|
||||
RMNETCTL_KERNEL_ERR_TC_HANDLE_FULL,
|
||||
|
||||
/* This should always be the last element */
|
||||
RMNETCTL_API_ERR_ENUM_LENGTH
|
||||
};
|
||||
|
||||
#define RMNETCTL_ERR_MSG_SIZE 100
|
||||
|
||||
/*!
|
||||
* @brief Contains a list of error message from API
|
||||
*/
|
||||
char rmnetctl_error_code_text
|
||||
[RMNETCTL_API_ERR_ENUM_LENGTH][RMNETCTL_ERR_MSG_SIZE] = {
|
||||
"ERROR: API succeeded\n",
|
||||
"ERROR: Unable to allocate the buffer to send message\n",
|
||||
"ERROR: Unable to allocate the buffer to receive message\n",
|
||||
"ERROR: Could not send the message to kernel\n",
|
||||
"ERROR: Unable to receive message from the kernel\n",
|
||||
"ERROR: Invalid process id\n",
|
||||
"ERROR: Invalid socket descriptor id\n",
|
||||
"ERROR: Could not bind to netlink socket\n",
|
||||
"ERROR: Only root can access this API\n",
|
||||
"ERROR: RmNet handle for the transaction was NULL\n",
|
||||
"ERROR: Request buffer for the transaction was NULL\n",
|
||||
"ERROR: Response buffer for the transaction was NULL\n",
|
||||
"ERROR: Request and response type do not match\n",
|
||||
"ERROR: Return type is invalid\n",
|
||||
"ERROR: String was truncated\n",
|
||||
/* Kernel errors */
|
||||
"ERROR: Kernel call succeeded\n",
|
||||
"ERROR: Invalid / Unsupported directive\n",
|
||||
"ERROR: Internal problem in the kernel module\n",
|
||||
"ERROR: The kernel is temporarely out of memory\n",
|
||||
"ERROR: Device already exists / Still in use\n",
|
||||
"ERROR: Invalid request / Unsupported scenario\n",
|
||||
"ERROR: Device doesn't exist\n",
|
||||
"ERROR: One or more of the arguments is invalid\n",
|
||||
"ERROR: Egress device is invalid\n",
|
||||
"ERROR: TC handle is full\n"
|
||||
};
|
||||
|
||||
/*===========================================================================
|
||||
DEFINITIONS AND DECLARATIONS
|
||||
===========================================================================*/
|
||||
typedef struct rmnetctl_hndl_s rmnetctl_hndl_t;
|
||||
|
||||
/*!
|
||||
* @brief Public API to initialize the RMNET control driver
|
||||
* @details Allocates memory for the RmNet handle. Creates and binds to a and
|
||||
* netlink socket if successful
|
||||
* @param **rmnetctl_hndl_t_val RmNet handle to be initialized
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnetctl_init(rmnetctl_hndl_t **hndl, uint16_t *error_code);
|
||||
|
||||
/*!
|
||||
* @brief Public API to clean up the RmNeT control handle
|
||||
* @details Close the socket and free the RmNet handle
|
||||
* @param *rmnetctl_hndl_t_val RmNet handle to be initialized
|
||||
* @return void
|
||||
*/
|
||||
void rmnetctl_cleanup(rmnetctl_hndl_t *hndl);
|
||||
|
||||
/*!
|
||||
* @brief Public API to register/unregister a RMNET driver on a particular device
|
||||
* @details Message type is RMNET_NETLINK_ASSOCIATE_NETWORK_DEVICE or
|
||||
* RMNET_NETLINK_UNASSOCIATE_NETWORK_DEVICE based on the flag for assoc_dev
|
||||
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
|
||||
* @param dev_name Device on which to register the RmNet driver
|
||||
* @param error_code Status code of this operation
|
||||
* @param assoc_dev registers the device if RMNETCTL_DEVICE_ASSOCIATE or
|
||||
* unregisters the device if RMNETCTL_DEVICE_UNASSOCIATE
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnet_associate_network_device(rmnetctl_hndl_t *hndl,
|
||||
const char *dev_name,
|
||||
uint16_t *error_code,
|
||||
uint8_t assoc_dev);
|
||||
|
||||
/*!
|
||||
* @brief Public API to get if a RMNET driver is registered on a particular
|
||||
* device
|
||||
* @details Message type is RMNET_NETLINK_GET_NETWORK_DEVICE_ASSOCIATED.
|
||||
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
|
||||
* @param dev_name Device on which to check if the RmNet driver is registered
|
||||
* @param register_status 1 if RmNet data driver is registered on a particular
|
||||
* device, 0 if not
|
||||
* @param error_code Status code of this operation
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnet_get_network_device_associated(rmnetctl_hndl_t *hndl,
|
||||
const char *dev_name,
|
||||
int *register_status,
|
||||
uint16_t *error_code);
|
||||
|
||||
/*!
|
||||
* @brief Public API to set the egress data format for a particular link.
|
||||
* @details Message type is RMNET_NETLINK_SET_LINK_EGRESS_DATA_FORMAT.
|
||||
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
|
||||
* @param egress_flags Egress flags to be set on the device
|
||||
* @param agg_size Max size of aggregated packets
|
||||
* @param agg_count Number of packets to be aggregated
|
||||
* @param dev_name Device on which to set the egress data format
|
||||
* @param error_code Status code of this operation returned from the kernel
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnet_set_link_egress_data_format(rmnetctl_hndl_t *hndl,
|
||||
uint32_t egress_flags,
|
||||
uint16_t agg_size,
|
||||
uint16_t agg_count,
|
||||
const char *dev_name,
|
||||
uint16_t *error_code);
|
||||
|
||||
/*!
|
||||
* @brief Public API to get the egress data format for a particular link.
|
||||
* @details Message type is RMNET_NETLINK_GET_LINK_EGRESS_DATA_FORMAT.
|
||||
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
|
||||
* @param dev_name Device on which to get the egress data format
|
||||
* @param egress_flags Egress flags from the device
|
||||
* @param agg_count Number of packets to be aggregated
|
||||
* @param error_code Status code of this operation returned from the kernel
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnet_get_link_egress_data_format(rmnetctl_hndl_t *hndl,
|
||||
const char *dev_name,
|
||||
uint32_t *egress_flags,
|
||||
uint16_t *agg_size,
|
||||
uint16_t *agg_count,
|
||||
uint16_t *error_code);
|
||||
|
||||
/*!
|
||||
* @brief Public API to set the ingress data format for a particular link.
|
||||
* @details Message type is RMNET_NETLINK_SET_LINK_INGRESS_DATA_FORMAT.
|
||||
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
|
||||
* @param ingress_flags Ingress flags from the device
|
||||
* @param tail_spacing Tail spacing needed for the packet
|
||||
* @param dev_name Device on which to set the ingress data format
|
||||
* @param error_code Status code of this operation returned from the kernel
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnet_set_link_ingress_data_format_tailspace(rmnetctl_hndl_t *hndl,
|
||||
uint32_t ingress_flags,
|
||||
uint8_t tail_spacing,
|
||||
const char *dev_name,
|
||||
uint16_t *error_code);
|
||||
|
||||
/*!
|
||||
* @brief Public API to get the ingress data format for a particular link.
|
||||
* @details Message type is RMNET_NETLINK_GET_LINK_INGRESS_DATA_FORMAT.
|
||||
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
|
||||
* @param dev_name Device on which to get the ingress data format
|
||||
* @param ingress_flags Ingress flags from the device
|
||||
* @param tail_spacing Tail spacing needed for the packet
|
||||
* @param error_code Status code of this operation returned from the kernel
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnet_get_link_ingress_data_format_tailspace(rmnetctl_hndl_t *hndl,
|
||||
const char *dev_name,
|
||||
uint32_t *ingress_flags,
|
||||
uint8_t *tail_spacing,
|
||||
uint16_t *error_code);
|
||||
|
||||
inline int rmnet_set_link_ingress_data_format(rmnetctl_hndl_t *hndl,
|
||||
uint32_t ingress_flags,
|
||||
const char *dev_name,
|
||||
uint16_t *error_code)
|
||||
{
|
||||
return rmnet_set_link_ingress_data_format_tailspace(hndl,
|
||||
ingress_flags,
|
||||
0,
|
||||
dev_name,
|
||||
error_code);
|
||||
}
|
||||
|
||||
inline int rmnet_get_link_ingress_data_format(rmnetctl_hndl_t *hndl,
|
||||
const char *dev_name,
|
||||
uint32_t *ingress_flags,
|
||||
uint16_t *error_code)
|
||||
{
|
||||
return rmnet_get_link_ingress_data_format_tailspace(hndl,
|
||||
dev_name,
|
||||
ingress_flags,
|
||||
0,
|
||||
error_code);
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Public API to set the logical endpoint configuration for a
|
||||
* particular link.
|
||||
* @details Message type is RMNET_NETLINK_SET_LOGICAL_EP_CONFIG.
|
||||
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
|
||||
* @param logical_ep_id Logical end point id on which the configuration is to be
|
||||
* set
|
||||
* @param rmnet_mode RmNet mode to be set on the device
|
||||
* @param dev_name Device on which to set the logical end point configuration
|
||||
* @param egress_dev_name Egress Device if operating in bridge mode
|
||||
* @param error_code Status code of this operation returned from the kernel
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnet_set_logical_ep_config(rmnetctl_hndl_t *hndl,
|
||||
int32_t ep_id,
|
||||
uint8_t operating_mode,
|
||||
const char *dev_name,
|
||||
const char *next_dev,
|
||||
uint16_t *error_code);
|
||||
|
||||
/*!
|
||||
* @brief Public API to un-set the logical endpoint configuration for a
|
||||
* particular link.
|
||||
* @details Message type is RMNET_NETLINK_UNSET_LOGICAL_EP_CONFIG.
|
||||
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
|
||||
* @param logical_ep_id Logical end point id on which the configuration is to be
|
||||
* un-set
|
||||
* @param dev_name Device on which to un-set the logical end point configuration
|
||||
* @param error_code Status code of this operation returned from the kernel
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnet_unset_logical_ep_config(rmnetctl_hndl_t *hndl,
|
||||
int32_t ep_id,
|
||||
const char *dev_name,
|
||||
uint16_t *error_code);
|
||||
/*!
|
||||
* @brief Public API to get the logical endpoint configuration for a
|
||||
* particular link.
|
||||
* @details Message type is RMNET_NETLINK_GET_LOGICAL_EP_CONFIG.
|
||||
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
|
||||
* @param logical_ep_id Logical end point id from which to get the configuration
|
||||
* @param dev_name Device on which to get the logical end point configuration
|
||||
* @param rmnet_mode RmNet mode from the device
|
||||
* @param next_dev Egress Device name
|
||||
* @param next_dev_len Egress Device I/O string len
|
||||
* @param error_code Status code of this operation returned from the kernel
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnet_get_logical_ep_config(rmnetctl_hndl_t *hndl,
|
||||
int32_t ep_id,
|
||||
const char *dev_name,
|
||||
uint8_t *operating_mode,
|
||||
char **next_dev,
|
||||
uint32_t next_dev_len,
|
||||
uint16_t *error_code);
|
||||
|
||||
/*!
|
||||
* @brief Public API to create a new virtual device node
|
||||
* @details Message type is RMNET_NETLINK_NEW_VND or
|
||||
* RMNETCTL_FREE_VND based on the flag for new_vnd
|
||||
* @param hndl RmNet handle for the Netlink message
|
||||
* @param id Node number to create the virtual network device node
|
||||
* @param error_code Status code of this operation returned from the kernel
|
||||
* @param new_vnd creates a new virtual network device if RMNETCTL_NEW_VND or
|
||||
* frees the device if RMNETCTL_FREE_VND
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnet_new_vnd(rmnetctl_hndl_t *hndl,
|
||||
uint32_t id,
|
||||
uint16_t *error_code,
|
||||
uint8_t new_vnd);
|
||||
|
||||
/*!
|
||||
* @brief Public API to create a new virtual device node with a custom prefix
|
||||
* @details Message type is RMNET_NETLINK_NEW_VND or
|
||||
* RMNETCTL_FREE_VND based on the flag for new_vnd
|
||||
* @param hndl RmNet handle for the Netlink message
|
||||
* @param id Node number to create the virtual network device node
|
||||
* @param error_code Status code of this operation returned from the kernel
|
||||
* @param new_vnd creates a new virtual network device if RMNETCTL_NEW_VND or
|
||||
* frees the device if RMNETCTL_FREE_VND
|
||||
* @param prefix Prefix to be used when naming the network interface
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnet_new_vnd_prefix(rmnetctl_hndl_t *hndl,
|
||||
uint32_t id,
|
||||
uint16_t *error_code,
|
||||
uint8_t new_vnd,
|
||||
const char *prefix);
|
||||
/*!
|
||||
* @brief API to get the ASCII name of a virtual network device from its ID
|
||||
* @param hndl RmNet handle for the Netlink message
|
||||
* @param id Node number to create the virtual network device node
|
||||
* @param error_code Status code of this operation returned from the kernel
|
||||
* @param buf Buffer to store ASCII representation of device name
|
||||
* @param buflen Length of the buffer
|
||||
* @param prefix Prefix to be used when naming the network interface
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
|
||||
int rmnet_get_vnd_name(rmnetctl_hndl_t *hndl,
|
||||
uint32_t id,
|
||||
uint16_t *error_code,
|
||||
char *buf,
|
||||
uint32_t buflen);
|
||||
|
||||
/*!
|
||||
* @brief Public API to set or clear a flow
|
||||
* @details Message type is RMNET_NETLINK_ADD_VND_TC_FLOW or
|
||||
* RMNET_NETLINK_DEL_VND_TC_FLOW based on the flag for set_flow
|
||||
* @param *rmnetctl_hndl_t_val RmNet handle for the Netlink message
|
||||
* @param id Node number to set or clear the flow on the virtual network
|
||||
* device node
|
||||
* @param map_flow_id Flow handle of the modem
|
||||
* @param tc_flow_id Software flow handle
|
||||
* @param set_flow sets the flow if RMNET_NETLINK_SET_FLOW or
|
||||
* clears the flow if RMNET_NETLINK_CLEAR_FLOW
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
int rmnet_add_del_vnd_tc_flow(rmnetctl_hndl_t *hndl,
|
||||
uint32_t id,
|
||||
uint32_t map_flow_id,
|
||||
uint32_t tc_flow_id,
|
||||
uint8_t set_flow,
|
||||
uint16_t *error_code);
|
||||
|
||||
#endif /* not defined LIBRMNETCTL_H */
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
/******************************************************************************
|
||||
|
||||
L I B R M N E T C T L _ H N D L. H
|
||||
|
||||
Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of The Linux Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
/*!
|
||||
* @file librmnetctl_hndl.h
|
||||
* @brief rmnet control API's handle file
|
||||
*/
|
||||
|
||||
#ifndef LIBRMNETCTL_HNDL_H
|
||||
#define LIBRMNETCTL_HNDL_H
|
||||
|
||||
/*===========================================================================
|
||||
DEFINITIONS AND DECLARATIONS
|
||||
===========================================================================*/
|
||||
|
||||
/*!
|
||||
* @brief Structure for RMNET control handles. A rmnet hndl contains the caller
|
||||
* process id, the transaction id which is initialized to 0 for each new
|
||||
* initialized handle and the netlink file descriptor for this handle.
|
||||
* @var pid process id to be used for the netlink message
|
||||
* @var transaction_id message number for debugging
|
||||
* @var netlink_fd netlink file descriptor to be used
|
||||
* @var src_addr source socket address properties for this message
|
||||
* @var dest_addr destination socket address properties for this message
|
||||
*/
|
||||
|
||||
struct rmnetctl_hndl_s {
|
||||
uint32_t pid;
|
||||
uint32_t transaction_id;
|
||||
int netlink_fd;
|
||||
struct sockaddr_nl src_addr, dest_addr;
|
||||
};
|
||||
|
||||
#endif /* not defined LIBRMNETCTL_HNDL_H */
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_COPY_HEADERS_TO := dataservices/rmnetctl
|
||||
LOCAL_COPY_HEADERS := ../inc/librmnetctl.h
|
||||
|
||||
LOCAL_SRC_FILES := librmnetctl.c
|
||||
LOCAL_CFLAGS := -Wall -Werror
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../inc
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)
|
||||
LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
|
||||
|
||||
|
||||
LOCAL_MODULE := librmnetctl
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_PRELINK_MODULE := false
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
@ -1,16 +0,0 @@
|
||||
AM_CFLAGS = -Wall -Werror -Wundef -Wstrict-prototypes -Wno-trigraphs
|
||||
AM_CFLAGS += -I./../inc
|
||||
|
||||
librmnetctl_la_C = @C@
|
||||
librmnetctl_la_SOURCES = librmnetctl.c
|
||||
|
||||
common_CFLAGS = -DUSE_GLIB @GLIB_CFLAGS@
|
||||
common_LDFLAGS = -lpthread -lrt @GLIB_LIBS@
|
||||
|
||||
librmnetctl_la_CFLAGS := $(AM_CFLAGS) $(common_CFLAGS)
|
||||
librmnetctl_la_LDFLAGS := -shared $(common_LDFLAGS)
|
||||
|
||||
library_includedir = $(pkgincludedir)
|
||||
library_include_HEADERS = ./../inc/librmnetctl.h
|
||||
|
||||
lib_LTLIBRARIES = librmnetctl.la
|
||||
@ -1,870 +0,0 @@
|
||||
/******************************************************************************
|
||||
|
||||
L I B R M N E T C T L . C
|
||||
|
||||
Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of The Linux Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
/*!
|
||||
* @file librmnetctl.c
|
||||
* @brief rmnet control API's implentations file
|
||||
*/
|
||||
|
||||
/*===========================================================================
|
||||
INCLUDE FILES
|
||||
===========================================================================*/
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <stdint.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <linux/rmnet_data.h>
|
||||
#include "librmnetctl_hndl.h"
|
||||
#include "librmnetctl.h"
|
||||
|
||||
#ifdef USE_GLIB
|
||||
#include <glib.h>
|
||||
#define strlcpy g_strlcpy
|
||||
#endif
|
||||
|
||||
#define RMNETCTL_SOCK_FLAG 0
|
||||
#define ROOT_USER_ID 0
|
||||
#define MIN_VALID_PROCESS_ID 0
|
||||
#define MIN_VALID_SOCKET_FD 0
|
||||
#define KERNEL_PROCESS_ID 0
|
||||
#define UNICAST 0
|
||||
#define MAX_BUF_SIZE sizeof(struct nlmsghdr) + sizeof(struct rmnet_nl_msg_s)
|
||||
#define INGRESS_FLAGS_MASK (RMNET_INGRESS_FIX_ETHERNET | \
|
||||
RMNET_INGRESS_FORMAT_MAP | \
|
||||
RMNET_INGRESS_FORMAT_DEAGGREGATION | \
|
||||
RMNET_INGRESS_FORMAT_DEMUXING | \
|
||||
RMNET_INGRESS_FORMAT_MAP_COMMANDS | \
|
||||
RMNET_INGRESS_FORMAT_MAP_CKSUMV3)
|
||||
#define EGRESS_FLAGS_MASK (RMNET_EGRESS_FORMAT__RESERVED__ | \
|
||||
RMNET_EGRESS_FORMAT_MAP | \
|
||||
RMNET_EGRESS_FORMAT_AGGREGATION | \
|
||||
RMNET_EGRESS_FORMAT_MUXING)
|
||||
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
/*===========================================================================
|
||||
LOCAL FUNCTION DEFINITIONS
|
||||
===========================================================================*/
|
||||
/*!
|
||||
* @brief Synchronous method to send and receive messages to and from the kernel
|
||||
* using netlink sockets
|
||||
* @details Increments the transaction id for each message sent to the kernel.
|
||||
* Sends the netlink message to the kernel and receives the response from the
|
||||
* kernel.
|
||||
* @param *hndl RmNet handle for this transaction
|
||||
* @param request Message to be sent to the kernel
|
||||
* @param response Message received from the kernel
|
||||
* @return RMNETCTL_API_SUCCESS if successfully able to send and receive message
|
||||
* from the kernel
|
||||
* @return RMNETCTL_API_ERR_HNDL_INVALID if RmNet handle for the transaction was
|
||||
* NULL
|
||||
* @return RMNETCTL_API_ERR_REQUEST_NULL not enough memory to create buffer for
|
||||
* sending the message
|
||||
* @return RMNETCTL_API_ERR_MESSAGE_SEND if could not send the message to kernel
|
||||
* @return RMNETCTL_API_ERR_MESSAGE_RECEIVE if could not receive message from the
|
||||
* kernel
|
||||
* @return RMNETCTL_API_ERR_MESSAGE_TYPE if the request and response type do not
|
||||
* match
|
||||
*/
|
||||
static uint16_t rmnetctl_transact(rmnetctl_hndl_t *hndl,
|
||||
struct rmnet_nl_msg_s *request,
|
||||
struct rmnet_nl_msg_s *response) {
|
||||
uint8_t *request_buf, *response_buf;
|
||||
struct nlmsghdr *nlmsghdr_val;
|
||||
struct rmnet_nl_msg_s *rmnet_nl_msg_s_val;
|
||||
ssize_t bytes_read = -1;
|
||||
uint16_t return_code = RMNETCTL_API_ERR_HNDL_INVALID;
|
||||
struct sockaddr_nl* __attribute__((__may_alias__)) saddr_ptr;
|
||||
request_buf = NULL;
|
||||
response_buf = NULL;
|
||||
nlmsghdr_val = NULL;
|
||||
rmnet_nl_msg_s_val = NULL;
|
||||
do {
|
||||
if (!hndl){
|
||||
break;
|
||||
}
|
||||
if (!request){
|
||||
return_code = RMNETCTL_API_ERR_REQUEST_NULL;
|
||||
break;
|
||||
}
|
||||
if (!response){
|
||||
return_code = RMNETCTL_API_ERR_RESPONSE_NULL;
|
||||
break;
|
||||
}
|
||||
request_buf = (uint8_t *)malloc(MAX_BUF_SIZE * sizeof(uint8_t));
|
||||
if (!request_buf){
|
||||
return_code = RMNETCTL_API_ERR_REQUEST_NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
response_buf = (uint8_t *)malloc(MAX_BUF_SIZE * sizeof(uint8_t));
|
||||
if (!response_buf) {
|
||||
free(request_buf);
|
||||
return_code = RMNETCTL_API_ERR_RESPONSE_NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
nlmsghdr_val = (struct nlmsghdr *)request_buf;
|
||||
rmnet_nl_msg_s_val = (struct rmnet_nl_msg_s *)NLMSG_DATA(request_buf);
|
||||
|
||||
memset(request_buf, 0, MAX_BUF_SIZE*sizeof(uint8_t));
|
||||
memset(response_buf, 0, MAX_BUF_SIZE*sizeof(uint8_t));
|
||||
|
||||
nlmsghdr_val->nlmsg_seq = hndl->transaction_id;
|
||||
nlmsghdr_val->nlmsg_pid = hndl->pid;
|
||||
nlmsghdr_val->nlmsg_len = MAX_BUF_SIZE;
|
||||
|
||||
memcpy((void *)NLMSG_DATA(request_buf), request,
|
||||
sizeof(struct rmnet_nl_msg_s));
|
||||
|
||||
rmnet_nl_msg_s_val->crd = RMNET_NETLINK_MSG_COMMAND;
|
||||
hndl->transaction_id++;
|
||||
|
||||
saddr_ptr = &hndl->dest_addr;
|
||||
socklen_t addrlen = sizeof(struct sockaddr_nl);
|
||||
if (sendto(hndl->netlink_fd,
|
||||
request_buf,
|
||||
MAX_BUF_SIZE,
|
||||
RMNETCTL_SOCK_FLAG,
|
||||
(struct sockaddr*)saddr_ptr,
|
||||
sizeof(struct sockaddr_nl)) < 0) {
|
||||
return_code = RMNETCTL_API_ERR_MESSAGE_SEND;
|
||||
free(request_buf);
|
||||
free(response_buf);
|
||||
break;
|
||||
}
|
||||
|
||||
saddr_ptr = &hndl->src_addr;
|
||||
bytes_read = recvfrom(hndl->netlink_fd,
|
||||
response_buf,
|
||||
MAX_BUF_SIZE,
|
||||
RMNETCTL_SOCK_FLAG,
|
||||
(struct sockaddr*)saddr_ptr,
|
||||
&addrlen);
|
||||
if (bytes_read < 0) {
|
||||
return_code = RMNETCTL_API_ERR_MESSAGE_RECEIVE;
|
||||
free(request_buf);
|
||||
free(response_buf);
|
||||
break;
|
||||
}
|
||||
|
||||
memcpy(response, (void *)NLMSG_DATA(response_buf),
|
||||
sizeof(struct rmnet_nl_msg_s));
|
||||
if (sizeof(*response) < sizeof(struct rmnet_nl_msg_s)) {
|
||||
return_code = RMNETCTL_API_ERR_RESPONSE_NULL;
|
||||
free(request_buf);
|
||||
free(response_buf);
|
||||
break;
|
||||
}
|
||||
|
||||
if (request->message_type != response->message_type) {
|
||||
return_code = RMNETCTL_API_ERR_MESSAGE_TYPE;
|
||||
free(request_buf);
|
||||
free(response_buf);
|
||||
break;
|
||||
}
|
||||
return_code = RMNETCTL_SUCCESS;
|
||||
} while(0);
|
||||
free(request_buf);
|
||||
free(response_buf);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Static function to check the dev name
|
||||
* @details Checks if the name is not NULL and if the name is less than the
|
||||
* RMNET_MAX_STR_LEN
|
||||
* @param dev_name Name of the device
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_INVALID_ARG if invalid arguments were passed to the API
|
||||
*/
|
||||
static inline int _rmnetctl_check_dev_name(const char *dev_name) {
|
||||
int return_code = RMNETCTL_INVALID_ARG;
|
||||
do {
|
||||
if (!dev_name)
|
||||
break;
|
||||
if (strlen(dev_name) >= RMNET_MAX_STR_LEN)
|
||||
break;
|
||||
return_code = RMNETCTL_SUCCESS;
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Static function to check the string length after a copy
|
||||
* @details Checks if the string length is not lesser than zero and lesser than
|
||||
* RMNET_MAX_STR_LEN
|
||||
* @param str_len length of the string after a copy
|
||||
* @param error_code Status code of this operation
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
*/
|
||||
static inline int _rmnetctl_check_len(size_t str_len, uint16_t *error_code) {
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if (str_len > RMNET_MAX_STR_LEN) {
|
||||
*error_code = RMNETCTL_API_ERR_STRING_TRUNCATION;
|
||||
break;
|
||||
}
|
||||
return_code = RMNETCTL_SUCCESS;
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Static function to check the response type
|
||||
* @details Checks if the response type of this message was return code
|
||||
* @param crd The crd field passed
|
||||
* @param error_code Status code of this operation
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
*/
|
||||
static inline int _rmnetctl_check_code(int crd, uint16_t *error_code) {
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if (crd != RMNET_NETLINK_MSG_RETURNCODE) {
|
||||
*error_code = RMNETCTL_API_ERR_RETURN_TYPE;
|
||||
break;
|
||||
}
|
||||
return_code = RMNETCTL_SUCCESS;
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Static function to check the response type
|
||||
* @details Checks if the response type of this message was data
|
||||
* @param crd The crd field passed
|
||||
* @param error_code Status code of this operation
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_LIB_ERR if there was a library error. Check error_code
|
||||
*/
|
||||
static inline int _rmnetctl_check_data(int crd, uint16_t *error_code) {
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if (crd != RMNET_NETLINK_MSG_RETURNDATA) {
|
||||
*error_code = RMNETCTL_API_ERR_RETURN_TYPE;
|
||||
break;
|
||||
}
|
||||
return_code = RMNETCTL_SUCCESS;
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*!
|
||||
* @brief Static function to set the return value
|
||||
* @details Checks if the error_code from the transaction is zero for a return
|
||||
* code type message and sets the message type as RMNETCTL_SUCCESS
|
||||
* @param crd The crd field passed
|
||||
* @param error_code Status code of this operation
|
||||
* @return RMNETCTL_SUCCESS if successful
|
||||
* @return RMNETCTL_KERNEL_ERR if there was an error in the kernel.
|
||||
* Check error_code
|
||||
*/
|
||||
static inline int _rmnetctl_set_codes(int error_val, uint16_t *error_code) {
|
||||
int return_code = RMNETCTL_KERNEL_ERR;
|
||||
if (error_val == RMNET_CONFIG_OK)
|
||||
return_code = RMNETCTL_SUCCESS;
|
||||
else
|
||||
*error_code = (uint16_t)error_val + RMNETCTL_KERNEL_FIRST_ERR;
|
||||
return return_code;
|
||||
}
|
||||
|
||||
/*===========================================================================
|
||||
EXPOSED API
|
||||
===========================================================================*/
|
||||
|
||||
int rmnetctl_init(rmnetctl_hndl_t **hndl, uint16_t *error_code)
|
||||
{
|
||||
pid_t pid = 0;
|
||||
int netlink_fd = -1, return_code = RMNETCTL_LIB_ERR;
|
||||
struct sockaddr_nl* __attribute__((__may_alias__)) saddr_ptr;
|
||||
do {
|
||||
if ((!hndl) || (!error_code)){
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
*hndl = (rmnetctl_hndl_t *)malloc(sizeof(rmnetctl_hndl_t));
|
||||
if (!*hndl) {
|
||||
*error_code = RMNETCTL_API_ERR_HNDL_INVALID;
|
||||
break;
|
||||
}
|
||||
|
||||
memset(*hndl, 0, sizeof(rmnetctl_hndl_t));
|
||||
|
||||
pid = getpid();
|
||||
if (pid < MIN_VALID_PROCESS_ID) {
|
||||
free(*hndl);
|
||||
*error_code = RMNETCTL_INIT_ERR_PROCESS_ID;
|
||||
break;
|
||||
}
|
||||
(*hndl)->pid = (uint32_t)pid;
|
||||
netlink_fd = socket(PF_NETLINK, SOCK_RAW, RMNET_NETLINK_PROTO);
|
||||
if (netlink_fd < MIN_VALID_SOCKET_FD) {
|
||||
free(*hndl);
|
||||
*error_code = RMNETCTL_INIT_ERR_NETLINK_FD;
|
||||
break;
|
||||
}
|
||||
|
||||
(*hndl)->netlink_fd = netlink_fd;
|
||||
|
||||
memset(&(*hndl)->src_addr, 0, sizeof(struct sockaddr_nl));
|
||||
|
||||
(*hndl)->src_addr.nl_family = AF_NETLINK;
|
||||
(*hndl)->src_addr.nl_pid = (*hndl)->pid;
|
||||
|
||||
saddr_ptr = &(*hndl)->src_addr;
|
||||
if (bind((*hndl)->netlink_fd,
|
||||
(struct sockaddr*)saddr_ptr,
|
||||
sizeof(struct sockaddr_nl)) < 0) {
|
||||
close((*hndl)->netlink_fd);
|
||||
free(*hndl);
|
||||
*error_code = RMNETCTL_INIT_ERR_BIND;
|
||||
break;
|
||||
}
|
||||
|
||||
memset(&(*hndl)->dest_addr, 0, sizeof(struct sockaddr_nl));
|
||||
|
||||
(*hndl)->dest_addr.nl_family = AF_NETLINK;
|
||||
(*hndl)->dest_addr.nl_pid = KERNEL_PROCESS_ID;
|
||||
(*hndl)->dest_addr.nl_groups = UNICAST;
|
||||
|
||||
return_code = RMNETCTL_SUCCESS;
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
void rmnetctl_cleanup(rmnetctl_hndl_t *hndl)
|
||||
{
|
||||
if (!hndl)
|
||||
return;
|
||||
close(hndl->netlink_fd);
|
||||
free(hndl);
|
||||
}
|
||||
|
||||
int rmnet_associate_network_device(rmnetctl_hndl_t *hndl,
|
||||
const char *dev_name,
|
||||
uint16_t *error_code,
|
||||
uint8_t assoc_dev)
|
||||
{
|
||||
struct rmnet_nl_msg_s request, response;
|
||||
size_t str_len = 0;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if ((!hndl) || (!error_code) || _rmnetctl_check_dev_name(dev_name) ||
|
||||
((assoc_dev != RMNETCTL_DEVICE_ASSOCIATE) &&
|
||||
(assoc_dev != RMNETCTL_DEVICE_UNASSOCIATE))) {
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
if (assoc_dev == RMNETCTL_DEVICE_ASSOCIATE)
|
||||
request.message_type = RMNET_NETLINK_ASSOCIATE_NETWORK_DEVICE;
|
||||
else
|
||||
request.message_type = RMNET_NETLINK_UNASSOCIATE_NETWORK_DEVICE;
|
||||
|
||||
request.arg_length = RMNET_MAX_STR_LEN;
|
||||
str_len = strlcpy((char *)(request.data), dev_name, (size_t)RMNET_MAX_STR_LEN);
|
||||
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
if (_rmnetctl_check_code(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
return_code = _rmnetctl_set_codes(response.return_code, error_code);
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
int rmnet_get_network_device_associated(rmnetctl_hndl_t *hndl,
|
||||
const char *dev_name,
|
||||
int *register_status,
|
||||
uint16_t *error_code) {
|
||||
struct rmnet_nl_msg_s request, response;
|
||||
size_t str_len = 0;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if ((!hndl) || (!register_status) || (!error_code) ||
|
||||
_rmnetctl_check_dev_name(dev_name)) {
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
request.message_type = RMNET_NETLINK_GET_NETWORK_DEVICE_ASSOCIATED;
|
||||
|
||||
request.arg_length = RMNET_MAX_STR_LEN;
|
||||
str_len = strlcpy((char *)(request.data), dev_name, RMNET_MAX_STR_LEN);
|
||||
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
*register_status = response.return_code;
|
||||
return_code = RMNETCTL_SUCCESS;
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
int rmnet_set_link_egress_data_format(rmnetctl_hndl_t *hndl,
|
||||
uint32_t egress_flags,
|
||||
uint16_t agg_size,
|
||||
uint16_t agg_count,
|
||||
const char *dev_name,
|
||||
uint16_t *error_code) {
|
||||
struct rmnet_nl_msg_s request, response;
|
||||
size_t str_len = 0;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if ((!hndl) || (!error_code) || _rmnetctl_check_dev_name(dev_name) ||
|
||||
((~EGRESS_FLAGS_MASK) & egress_flags)) {
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
request.message_type = RMNET_NETLINK_SET_LINK_EGRESS_DATA_FORMAT;
|
||||
|
||||
request.arg_length = RMNET_MAX_STR_LEN +
|
||||
sizeof(uint32_t) + sizeof(uint16_t) + sizeof(uint16_t);
|
||||
str_len = strlcpy((char *)(request.data_format.dev),
|
||||
dev_name,
|
||||
RMNET_MAX_STR_LEN);
|
||||
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
request.data_format.flags = egress_flags;
|
||||
request.data_format.agg_size = agg_size;
|
||||
request.data_format.agg_count = agg_count;
|
||||
|
||||
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
if (_rmnetctl_check_code(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
return_code = _rmnetctl_set_codes(response.return_code, error_code);
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
int rmnet_get_link_egress_data_format(rmnetctl_hndl_t *hndl,
|
||||
const char *dev_name,
|
||||
uint32_t *egress_flags,
|
||||
uint16_t *agg_size,
|
||||
uint16_t *agg_count,
|
||||
uint16_t *error_code) {
|
||||
struct rmnet_nl_msg_s request, response;
|
||||
size_t str_len = 0;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if ((!hndl) || (!egress_flags) || (!agg_size) || (!agg_count) ||
|
||||
(!error_code) || _rmnetctl_check_dev_name(dev_name)) {
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
request.message_type = RMNET_NETLINK_GET_LINK_EGRESS_DATA_FORMAT;
|
||||
|
||||
request.arg_length = RMNET_MAX_STR_LEN;
|
||||
str_len = strlcpy((char *)(request.data_format.dev),
|
||||
dev_name,
|
||||
RMNET_MAX_STR_LEN);
|
||||
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
*egress_flags = response.data_format.flags;
|
||||
*agg_size = response.data_format.agg_size;
|
||||
*agg_count = response.data_format.agg_count;
|
||||
return_code = RMNETCTL_SUCCESS;
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
int rmnet_set_link_ingress_data_format_tailspace(rmnetctl_hndl_t *hndl,
|
||||
uint32_t ingress_flags,
|
||||
uint8_t tail_spacing,
|
||||
const char *dev_name,
|
||||
uint16_t *error_code) {
|
||||
struct rmnet_nl_msg_s request, response;
|
||||
size_t str_len = 0;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if ((!hndl) || (!error_code) || _rmnetctl_check_dev_name(dev_name) ||
|
||||
((~INGRESS_FLAGS_MASK) & ingress_flags)) {
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
request.message_type = RMNET_NETLINK_SET_LINK_INGRESS_DATA_FORMAT;
|
||||
|
||||
request.arg_length = RMNET_MAX_STR_LEN +
|
||||
sizeof(uint32_t) + sizeof(uint16_t) + sizeof(uint16_t);
|
||||
str_len = strlcpy((char *)(request.data_format.dev),
|
||||
dev_name,
|
||||
RMNET_MAX_STR_LEN);
|
||||
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
request.data_format.flags = ingress_flags;
|
||||
request.data_format.tail_spacing = tail_spacing;
|
||||
|
||||
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
if (_rmnetctl_check_code(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
return_code = _rmnetctl_set_codes(response.return_code, error_code);
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
int rmnet_get_link_ingress_data_format_tailspace(rmnetctl_hndl_t *hndl,
|
||||
const char *dev_name,
|
||||
uint32_t *ingress_flags,
|
||||
uint8_t *tail_spacing,
|
||||
uint16_t *error_code) {
|
||||
struct rmnet_nl_msg_s request, response;
|
||||
size_t str_len = 0;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if ((!hndl) || (!error_code) ||
|
||||
_rmnetctl_check_dev_name(dev_name)) {
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
request.message_type = RMNET_NETLINK_GET_LINK_INGRESS_DATA_FORMAT;
|
||||
|
||||
request.arg_length = RMNET_MAX_STR_LEN;
|
||||
str_len = strlcpy((char *)(request.data_format.dev),
|
||||
dev_name,
|
||||
RMNET_MAX_STR_LEN);
|
||||
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
if (ingress_flags)
|
||||
*ingress_flags = response.data_format.flags;
|
||||
|
||||
if (tail_spacing)
|
||||
*tail_spacing = response.data_format.tail_spacing;
|
||||
|
||||
return_code = RMNETCTL_SUCCESS;
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
int rmnet_set_logical_ep_config(rmnetctl_hndl_t *hndl,
|
||||
int32_t ep_id,
|
||||
uint8_t operating_mode,
|
||||
const char *dev_name,
|
||||
const char *next_dev,
|
||||
uint16_t *error_code) {
|
||||
struct rmnet_nl_msg_s request, response;
|
||||
size_t str_len = 0;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if ((!hndl) || ((ep_id < -1) || (ep_id > 31)) || (!error_code) ||
|
||||
_rmnetctl_check_dev_name(dev_name) ||
|
||||
_rmnetctl_check_dev_name(next_dev) ||
|
||||
operating_mode >= RMNET_EPMODE_LENGTH) {
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
request.message_type = RMNET_NETLINK_SET_LOGICAL_EP_CONFIG;
|
||||
|
||||
request.arg_length = RMNET_MAX_STR_LEN +
|
||||
RMNET_MAX_STR_LEN + sizeof(int32_t) + sizeof(uint8_t);
|
||||
str_len = strlcpy((char *)(request.local_ep_config.dev),
|
||||
dev_name,
|
||||
RMNET_MAX_STR_LEN);
|
||||
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
str_len = strlcpy((char *)(request.local_ep_config.next_dev),
|
||||
next_dev,
|
||||
RMNET_MAX_STR_LEN);
|
||||
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
request.local_ep_config.ep_id = ep_id;
|
||||
request.local_ep_config.operating_mode = operating_mode;
|
||||
|
||||
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
if (_rmnetctl_check_code(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
return_code = _rmnetctl_set_codes(response.return_code, error_code);
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
int rmnet_unset_logical_ep_config(rmnetctl_hndl_t *hndl,
|
||||
int32_t ep_id,
|
||||
const char *dev_name,
|
||||
uint16_t *error_code) {
|
||||
struct rmnet_nl_msg_s request, response;
|
||||
size_t str_len = 0;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
|
||||
if ((!hndl) || ((ep_id < -1) || (ep_id > 31)) || (!error_code) ||
|
||||
_rmnetctl_check_dev_name(dev_name)) {
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
request.message_type = RMNET_NETLINK_UNSET_LOGICAL_EP_CONFIG;
|
||||
|
||||
request.arg_length = RMNET_MAX_STR_LEN + sizeof(int32_t);
|
||||
str_len = strlcpy((char *)(request.local_ep_config.dev),
|
||||
dev_name,
|
||||
RMNET_MAX_STR_LEN);
|
||||
|
||||
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
request.local_ep_config.ep_id = ep_id;
|
||||
|
||||
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
if (_rmnetctl_check_code(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
return_code = _rmnetctl_set_codes(response.return_code, error_code);
|
||||
} while(0);
|
||||
|
||||
return return_code;
|
||||
}
|
||||
|
||||
int rmnet_get_logical_ep_config(rmnetctl_hndl_t *hndl,
|
||||
int32_t ep_id,
|
||||
const char *dev_name,
|
||||
uint8_t *operating_mode,
|
||||
char **next_dev,
|
||||
uint32_t next_dev_len,
|
||||
uint16_t *error_code) {
|
||||
struct rmnet_nl_msg_s request, response;
|
||||
size_t str_len = 0;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if ((!hndl) || (!operating_mode) || (!error_code) || ((ep_id < -1) ||
|
||||
(ep_id > 31)) || _rmnetctl_check_dev_name(dev_name) || (!next_dev)
|
||||
|| (0 == next_dev_len)) {
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
request.message_type = RMNET_NETLINK_GET_LOGICAL_EP_CONFIG;
|
||||
|
||||
request.arg_length = RMNET_MAX_STR_LEN + sizeof(int32_t);
|
||||
str_len = strlcpy((char *)(request.local_ep_config.dev),
|
||||
dev_name,
|
||||
RMNET_MAX_STR_LEN);
|
||||
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
request.local_ep_config.ep_id = ep_id;
|
||||
|
||||
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
str_len = strlcpy(*next_dev,
|
||||
(char *)(response.local_ep_config.next_dev),
|
||||
min(RMNET_MAX_STR_LEN, next_dev_len));
|
||||
if (_rmnetctl_check_len(str_len, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
*operating_mode = response.local_ep_config.operating_mode;
|
||||
return_code = RMNETCTL_SUCCESS;
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
int rmnet_new_vnd_prefix(rmnetctl_hndl_t *hndl,
|
||||
uint32_t id,
|
||||
uint16_t *error_code,
|
||||
uint8_t new_vnd,
|
||||
const char *prefix)
|
||||
{
|
||||
struct rmnet_nl_msg_s request, response;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
size_t str_len = 0;
|
||||
do {
|
||||
if ((!hndl) || (!error_code) ||
|
||||
((new_vnd != RMNETCTL_NEW_VND) && (new_vnd != RMNETCTL_FREE_VND))) {
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
memset(request.vnd.vnd_name, 0, RMNET_MAX_STR_LEN);
|
||||
if (new_vnd == RMNETCTL_NEW_VND) {
|
||||
if (prefix) {
|
||||
request.message_type =RMNET_NETLINK_NEW_VND_WITH_PREFIX;
|
||||
str_len = strlcpy((char *)request.vnd.vnd_name,
|
||||
prefix, RMNET_MAX_STR_LEN);
|
||||
if (_rmnetctl_check_len(str_len, error_code)
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
} else {
|
||||
request.message_type = RMNET_NETLINK_NEW_VND;
|
||||
}
|
||||
} else {
|
||||
request.message_type = RMNET_NETLINK_FREE_VND;
|
||||
}
|
||||
|
||||
request.arg_length = sizeof(uint32_t);
|
||||
request.vnd.id = id;
|
||||
|
||||
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
if (_rmnetctl_check_code(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
return_code = _rmnetctl_set_codes(response.return_code, error_code);
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
int rmnet_new_vnd(rmnetctl_hndl_t *hndl,
|
||||
uint32_t id,
|
||||
uint16_t *error_code,
|
||||
uint8_t new_vnd)
|
||||
{
|
||||
return rmnet_new_vnd_prefix(hndl, id, error_code, new_vnd, 0);
|
||||
}
|
||||
|
||||
int rmnet_get_vnd_name(rmnetctl_hndl_t *hndl,
|
||||
uint32_t id,
|
||||
uint16_t *error_code,
|
||||
char *buf,
|
||||
uint32_t buflen)
|
||||
{
|
||||
struct rmnet_nl_msg_s request, response;
|
||||
uint32_t str_len;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if ((!hndl) || (!error_code) || (!buf) || (0 == buflen)) {
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
|
||||
request.message_type = RMNET_NETLINK_GET_VND_NAME;
|
||||
request.arg_length = sizeof(uint32_t);
|
||||
request.vnd.id = id;
|
||||
|
||||
|
||||
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
if (_rmnetctl_check_data(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
|
||||
str_len = (uint32_t)strlcpy(buf,
|
||||
(char *)(response.vnd.vnd_name),
|
||||
buflen);
|
||||
if (str_len >= buflen) {
|
||||
*error_code = RMNETCTL_API_ERR_STRING_TRUNCATION;
|
||||
break;
|
||||
}
|
||||
|
||||
return_code = RMNETCTL_SUCCESS;
|
||||
} while (0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
int rmnet_add_del_vnd_tc_flow(rmnetctl_hndl_t *hndl,
|
||||
uint32_t id,
|
||||
uint32_t map_flow_id,
|
||||
uint32_t tc_flow_id,
|
||||
uint8_t set_flow,
|
||||
uint16_t *error_code) {
|
||||
struct rmnet_nl_msg_s request, response;
|
||||
int return_code = RMNETCTL_LIB_ERR;
|
||||
do {
|
||||
if ((!hndl) || (!error_code) || ((set_flow != RMNETCTL_ADD_FLOW) &&
|
||||
(set_flow != RMNETCTL_DEL_FLOW))) {
|
||||
return_code = RMNETCTL_INVALID_ARG;
|
||||
break;
|
||||
}
|
||||
if (set_flow == RMNETCTL_ADD_FLOW)
|
||||
request.message_type = RMNET_NETLINK_ADD_VND_TC_FLOW;
|
||||
else
|
||||
request.message_type = RMNET_NETLINK_DEL_VND_TC_FLOW;
|
||||
|
||||
request.arg_length = (sizeof(uint32_t))*3;
|
||||
request.flow_control.id = id;
|
||||
request.flow_control.map_flow_id = map_flow_id;
|
||||
request.flow_control.tc_flow_id = tc_flow_id;
|
||||
|
||||
if ((*error_code = rmnetctl_transact(hndl, &request, &response))
|
||||
!= RMNETCTL_SUCCESS)
|
||||
break;
|
||||
if (_rmnetctl_check_code(response.crd, error_code) != RMNETCTL_SUCCESS)
|
||||
break;
|
||||
return_code = _rmnetctl_set_codes(response.return_code, error_code);
|
||||
} while(0);
|
||||
return return_code;
|
||||
}
|
||||
|
||||
@ -1,2 +0,0 @@
|
||||
include $(call all-subdir-makefiles)
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := sockev_cli.c
|
||||
LOCAL_CFLAGS := -Wall -Werror
|
||||
|
||||
LOCAL_C_INCLUDES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
|
||||
|
||||
LOCAL_MODULE := sockev
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
@ -1,94 +0,0 @@
|
||||
/******************************************************************************
|
||||
S O C K E V _ C L I . C
|
||||
Copyright (c) 2013, The Linux Foundation. All rights reserved.
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials provided
|
||||
with the distribution.
|
||||
* Neither the name of The Linux Foundation nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
@file sockev_cli.c
|
||||
@brief command line test utility to receive sockev netlink messages.
|
||||
******************************************************************************/
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/sockev.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define SOCKEVCLI_ERROR -1
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int skfd, addrlen, rc;
|
||||
struct sockaddr_nl my_addr, src_addr;
|
||||
struct nlmsghdr *nlh = NULL;
|
||||
struct sknlsockevmsg *msg;
|
||||
|
||||
nlh = (struct nlmsghdr *)
|
||||
malloc(NLMSG_SPACE(sizeof(struct sknlsockevmsg) + 16));
|
||||
if (!nlh) {
|
||||
fprintf(stderr, "malloc() failed\n");
|
||||
return SOCKEVCLI_ERROR;
|
||||
}
|
||||
|
||||
skfd = socket(AF_NETLINK, SOCK_RAW, NETLINK_SOCKEV);
|
||||
if (skfd < 0) {
|
||||
fprintf(stderr, "nl_open_sock: socket failed\n");
|
||||
return SOCKEVCLI_ERROR;
|
||||
}
|
||||
|
||||
memset(&my_addr, 0, sizeof(struct sockaddr_nl));
|
||||
|
||||
my_addr.nl_family = AF_NETLINK;
|
||||
my_addr.nl_pid = getpid();
|
||||
my_addr.nl_groups = SKNLGRP_SOCKEV;
|
||||
|
||||
rc = bind(skfd, (struct sockaddr *)&my_addr,
|
||||
sizeof(struct sockaddr_nl));
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "nl_open_sock: bind failed\n");
|
||||
close(skfd);
|
||||
return SOCKEVCLI_ERROR;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
recvfrom(skfd, nlh, sizeof(struct sknlsockevmsg) + 16, 0,
|
||||
(const struct sockaddr *)&src_addr, &addrlen);
|
||||
msg = NLMSG_DATA(nlh);
|
||||
printf("----------------------------\n");
|
||||
printf("pid:\t%d\n", msg->pid);
|
||||
printf("event:\t%s\n", msg->event);
|
||||
printf("skfamily:\t0x%04X\n", msg->skfamily);
|
||||
printf("skstate:\t%03d\n", msg->skstate);
|
||||
printf("skprotocol:\t%03d\n", msg->skprotocol);
|
||||
printf("sktype:\t0x%04X\n", msg->sktype);
|
||||
printf("skflags:\t0x%016llX\n", msg->skflags);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
## Build and run dtbtool
|
||||
DTBTOOL := $(HOST_OUT_EXECUTABLES)/dtbToolCM$(HOST_EXECUTABLE_SUFFIX)
|
||||
INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img
|
||||
|
||||
ifneq ($(TARGET_KERNEL_ARCH),)
|
||||
KERNEL_ARCH := $(TARGET_KERNEL_ARCH)
|
||||
else
|
||||
KERNEL_ARCH := $(TARGET_ARCH)
|
||||
endif
|
||||
|
||||
$(INSTALLED_DTIMAGE_TARGET): $(DTBTOOL) $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr $(INSTALLED_KERNEL_TARGET)
|
||||
$(call pretty,"Target dt image: $(INSTALLED_DTIMAGE_TARGET)")
|
||||
$(DTBTOOL) -2 -o $(INSTALLED_DTIMAGE_TARGET) -s $(BOARD_KERNEL_PAGESIZE) -p $(KERNEL_OUT)/scripts/dtc/ $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/
|
||||
@echo -e ${CL_CYN}"Made DT image: $@"${CL_RST}
|
||||
|
||||
|
||||
## Overload bootimg generation: Same as the original, + --dt arg
|
||||
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(INSTALLED_DTIMAGE_TARGET)
|
||||
$(call pretty,"Target boot image: $@")
|
||||
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --dt $(INSTALLED_DTIMAGE_TARGET) --ramdisk_offset $(BOARD_RAMDISK_OFFSET) --tags_offset $(BOARD_KERNEL_TAGS_OFFSET) --output $@
|
||||
$(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw)
|
||||
@echo -e ${CL_CYN}"Made boot image: $@"${CL_RST}
|
||||
|
||||
## Overload recoveryimg generation: Same as the original, + --dt arg
|
||||
$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_DTIMAGE_TARGET) \
|
||||
$(recovery_ramdisk) \
|
||||
$(recovery_kernel)
|
||||
@echo -e ${CL_CYN}"----- Making recovery image ------"${CL_RST}
|
||||
$(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --dt $(INSTALLED_DTIMAGE_TARGET) --ramdisk_offset $(BOARD_RAMDISK_OFFSET) --tags_offset $(BOARD_KERNEL_TAGS_OFFSET) --output $@
|
||||
$(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
|
||||
@echo -e ${CL_CYN}"Made recovery image: $@"${CL_RST}
|
||||
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 The CyanogenMod Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Show enabled lte option for lte device -->
|
||||
<bool name="config_enabled_lte" translatable="false">true</bool>
|
||||
|
||||
</resources>
|
||||
@ -1,109 +0,0 @@
|
||||
# Copyright (C) 2009 The Android Open Source Project
|
||||
# Copyright (c) 2011, The Linux Foundation. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Emit commands needed for QCOM devices during OTA installation
|
||||
(installing the radio image)."""
|
||||
|
||||
import hashlib
|
||||
import common
|
||||
import re
|
||||
|
||||
def LoadFilesMap(zip):
|
||||
try:
|
||||
data = zip.read("RADIO/filesmap")
|
||||
except KeyError:
|
||||
print "Warning: could not find RADIO/filesmap in %s." % zip
|
||||
data = ""
|
||||
d = {}
|
||||
for line in data.split("\n"):
|
||||
line = line.strip()
|
||||
if not line or line.startswith("#"): continue
|
||||
pieces = line.split()
|
||||
if not (len(pieces) == 2 or len(pieces) == 3):
|
||||
raise ValueError("malformed filesmap line: \"%s\"" % (line,))
|
||||
file_size = zip.getinfo("RADIO/"+pieces[0]).file_size
|
||||
sha1 = hashlib.sha1()
|
||||
sha1.update(zip.read("RADIO/"+pieces[0]))
|
||||
d[pieces[0]] = (pieces[1], sha1.hexdigest(), file_size)
|
||||
return d
|
||||
|
||||
def GetRadioFiles(z):
|
||||
out = {}
|
||||
for info in z.infolist():
|
||||
if info.filename.startswith("RADIO/") and (info.filename.__len__() > len("RADIO/")):
|
||||
fn = "RADIO/" + info.filename[6:]
|
||||
out[fn] = fn
|
||||
return out
|
||||
|
||||
def FullOTA_Assertions(info):
|
||||
#TODO: Implement device specific asserstions.
|
||||
return
|
||||
|
||||
def IncrementalOTA_Assertions(info):
|
||||
#TODO: Implement device specific asserstions.
|
||||
return
|
||||
|
||||
def InstallRawImage(image_data, api_version, input_zip, fn, info, filesmap):
|
||||
#fn is in RADIO/* format. Extracting just file name.
|
||||
filename = fn[6:]
|
||||
if api_version >= 3:
|
||||
if filename not in filesmap:
|
||||
return
|
||||
partition = filesmap[filename][0]
|
||||
checksum = filesmap[filename][1]
|
||||
file_size = filesmap[filename][2]
|
||||
# read_file returns a blob or NULL. Use sha1_check to convert to a string
|
||||
# that can be evaluated (a NULL results in an empty string)
|
||||
info.script.AppendExtra('ifelse((sha1_check(read_file("EMMC:%s:%d:%s")) != ""),'
|
||||
'(ui_print("%s already up to date")),'
|
||||
'(package_extract_file("%s", "%s")));'
|
||||
% (partition, file_size, checksum, partition, filename, partition))
|
||||
common.ZipWriteStr(info.output_zip, filename, image_data)
|
||||
return
|
||||
else:
|
||||
print "warning radio-update: no support for api_version less than 3."
|
||||
|
||||
def InstallRadioFiles(info):
|
||||
files = GetRadioFiles(info.input_zip)
|
||||
if files == {}:
|
||||
print "warning radio-update: no radio image in input target_files; not flashing radio"
|
||||
return
|
||||
info.script.Print("Writing radio image...")
|
||||
#Load filesmap file
|
||||
filesmap = LoadFilesMap(info.input_zip)
|
||||
if filesmap == {}:
|
||||
print "warning radio-update: no or invalid filesmap file found. not flashing radio"
|
||||
return
|
||||
if hasattr(info, 'source_zip'):
|
||||
source_filesmap = LoadFilesMap(info.source_zip)
|
||||
else:
|
||||
source_filesmap = None
|
||||
for f in files:
|
||||
if source_filesmap:
|
||||
filename = f[6:]
|
||||
source_checksum = source_filesmap.get(filename, [None, 'no_source'])[1]
|
||||
target_checksum = filesmap.get(filename, [None, 'no_target'])[1]
|
||||
if source_checksum == target_checksum:
|
||||
print "info radio-update: source and target match for %s... skipping" % filename
|
||||
continue
|
||||
image_data = info.input_zip.read(f)
|
||||
InstallRawImage(image_data, info.input_version, info.input_zip, f, info, filesmap)
|
||||
return
|
||||
|
||||
def FullOTA_InstallEnd(info):
|
||||
InstallRadioFiles(info)
|
||||
|
||||
def IncrementalOTA_InstallEnd(info):
|
||||
InstallRadioFiles(info)
|
||||
@ -1,15 +0,0 @@
|
||||
# Android fstab file.
|
||||
# The filesystem that contains the filesystem checker binary (typically /system) cannot
|
||||
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
|
||||
|
||||
/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1 wait
|
||||
/dev/block/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,barrier=1,noauto_da_alloc wait,check,encryptable=footer,length=-16384
|
||||
/dev/block/bootdevice/by-name/cache /cache ext4 noatime,nosuid,nodev,barrier=1,noauto_da_alloc wait,check
|
||||
/dev/block/bootdevice/by-name/persist /persist ext4 noatime,nosuid,nodev,barrier=1,noauto_da_alloc wait
|
||||
/dev/block/bootdevice/by-name/boot /boot emmc defaults defaults
|
||||
/dev/block/bootdevice/by-name/recovery /recovery emmc defaults defaults
|
||||
/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults
|
||||
/dev/block/bootdevice/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1026,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait
|
||||
|
||||
/devices/soc.0/7864900.sdhci/mmc_host auto auto defaults voldmanaged=sdcard1:auto,noemulatedsd
|
||||
/devices/platform/msm_hsusb auto auto defaults voldmanaged=usbdisk:auto
|
||||
@ -1,34 +0,0 @@
|
||||
#!/system/bin/sh
|
||||
# Copyright (c) 2012, The Linux Foundation. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of The Linux Foundation nor
|
||||
# the names of its contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
country=`getprop wlan.crda.country`
|
||||
# crda takes input in COUNTRY environment variable
|
||||
if [ $country != "" ]
|
||||
then
|
||||
COUNTRY="$country" /system/bin/crda
|
||||
fi
|
||||
@ -1,341 +0,0 @@
|
||||
#!/system/bin/sh
|
||||
# Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of The Linux Foundation nor
|
||||
# the names of its contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
#Read the arguments passed to the script
|
||||
config="$1"
|
||||
|
||||
BLUETOOTH_SLEEP_PATH=/proc/bluetooth/sleep/proto
|
||||
LOG_TAG="qcom-bluetooth"
|
||||
LOG_NAME="${0}:"
|
||||
|
||||
hciattach_pid=""
|
||||
|
||||
loge ()
|
||||
{
|
||||
/system/bin/log -t $LOG_TAG -p e "$LOG_NAME $@"
|
||||
}
|
||||
|
||||
logi ()
|
||||
{
|
||||
/system/bin/log -t $LOG_TAG -p i "$LOG_NAME $@"
|
||||
}
|
||||
|
||||
failed ()
|
||||
{
|
||||
loge "$1: exit code $2"
|
||||
exit $2
|
||||
}
|
||||
|
||||
program_bdaddr ()
|
||||
{
|
||||
/system/bin/btnvtool -O
|
||||
logi "Bluetooth Address programmed successfully"
|
||||
}
|
||||
|
||||
#
|
||||
# enable bluetooth profiles dynamically
|
||||
#
|
||||
config_bt ()
|
||||
{
|
||||
baseband=`getprop ro.baseband`
|
||||
target=`getprop ro.board.platform`
|
||||
if [ -f /sys/devices/soc0/soc_id ]; then
|
||||
soc_hwid=`cat /sys/devices/soc0/soc_id`
|
||||
else
|
||||
soc_hwid=`cat /sys/devices/system/soc/soc0/id`
|
||||
fi
|
||||
btsoc=`getprop qcom.bluetooth.soc`
|
||||
|
||||
case $baseband in
|
||||
"apq")
|
||||
setprop ro.qualcomm.bluetooth.opp true
|
||||
setprop ro.qualcomm.bluetooth.ftp true
|
||||
setprop ro.qualcomm.bluetooth.nap false
|
||||
setprop ro.bluetooth.sap false
|
||||
setprop ro.bluetooth.dun false
|
||||
# For MPQ as baseband is same for both
|
||||
case $soc_hwid in
|
||||
"130")
|
||||
setprop ro.qualcomm.bluetooth.hsp true
|
||||
setprop ro.qualcomm.bluetooth.hfp true
|
||||
setprop ro.qualcomm.bluetooth.pbap false
|
||||
setprop ro.qualcomm.bluetooth.map false
|
||||
;;
|
||||
*)
|
||||
setprop ro.qualcomm.bluetooth.hsp false
|
||||
setprop ro.qualcomm.bluetooth.hfp false
|
||||
setprop ro.qualcomm.bluetooth.pbap true
|
||||
setprop ro.qualcomm.bluetooth.map true
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"mdm" | "svlte2a" | "svlte1" | "csfb")
|
||||
setprop ro.qualcomm.bluetooth.opp true
|
||||
setprop ro.qualcomm.bluetooth.hfp true
|
||||
setprop ro.qualcomm.bluetooth.hsp true
|
||||
setprop ro.qualcomm.bluetooth.pbap true
|
||||
setprop ro.qualcomm.bluetooth.ftp true
|
||||
setprop ro.qualcomm.bluetooth.map true
|
||||
setprop ro.qualcomm.bluetooth.nap true
|
||||
setprop ro.bluetooth.sap true
|
||||
case $target in
|
||||
"apq8084")
|
||||
setprop ro.bluetooth.dun true
|
||||
logi "Enabling BT-DUN for APQ8084"
|
||||
;;
|
||||
*)
|
||||
setprop ro.bluetooth.dun false
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"msm")
|
||||
setprop ro.qualcomm.bluetooth.opp true
|
||||
setprop ro.qualcomm.bluetooth.hfp true
|
||||
setprop ro.qualcomm.bluetooth.hsp true
|
||||
setprop ro.qualcomm.bluetooth.pbap true
|
||||
setprop ro.qualcomm.bluetooth.ftp true
|
||||
setprop ro.qualcomm.bluetooth.nap true
|
||||
setprop ro.bluetooth.sap true
|
||||
setprop ro.bluetooth.dun true
|
||||
case $btsoc in
|
||||
"ath3k")
|
||||
setprop ro.qualcomm.bluetooth.map false
|
||||
;;
|
||||
*)
|
||||
setprop ro.qualcomm.bluetooth.map true
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
setprop ro.qualcomm.bluetooth.opp true
|
||||
setprop ro.qualcomm.bluetooth.hfp true
|
||||
setprop ro.qualcomm.bluetooth.hsp true
|
||||
setprop ro.qualcomm.bluetooth.pbap true
|
||||
setprop ro.qualcomm.bluetooth.ftp true
|
||||
setprop ro.qualcomm.bluetooth.map true
|
||||
setprop ro.qualcomm.bluetooth.nap true
|
||||
setprop ro.bluetooth.sap true
|
||||
setprop ro.bluetooth.dun true
|
||||
;;
|
||||
esac
|
||||
|
||||
#Enable Bluetooth Profiles specific to target Dynamically
|
||||
case $target in
|
||||
"msm8960")
|
||||
if [ "$btsoc" != "ath3k" ] && [ "$soc_hwid" != "130" ]
|
||||
then
|
||||
setprop ro.bluetooth.hfp.ver 1.6
|
||||
setprop ro.qualcomm.bt.hci_transport smd
|
||||
fi
|
||||
;;
|
||||
"msm8974" | "msm8226" | "msm8610" | "msm8916" )
|
||||
if [ "$btsoc" != "ath3k" ]
|
||||
then
|
||||
setprop ro.bluetooth.hfp.ver 1.6
|
||||
setprop ro.qualcomm.bt.hci_transport smd
|
||||
fi
|
||||
;;
|
||||
"apq8084" | "mpq8092" )
|
||||
if [ "$btsoc" != "rome" ]
|
||||
then
|
||||
setprop ro.qualcomm.bt.hci_transport smd
|
||||
elif [ "$btsoc" = "rome" ]
|
||||
then
|
||||
setprop ro.bluetooth.hfp.ver 1.6
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -f /system/etc/bluetooth/stack.conf ]; then
|
||||
stack=`cat /system/etc/bluetooth/stack.conf`
|
||||
fi
|
||||
|
||||
case "$stack" in
|
||||
"bluez")
|
||||
logi "Bluetooth stack is $stack"
|
||||
setprop ro.qc.bluetooth.stack $stack
|
||||
reason=`getprop vold.decrypt`
|
||||
case "$reason" in
|
||||
"trigger_restart_framework")
|
||||
start dbus
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
logi "Bluetooth stack is Bluedroid"
|
||||
;;
|
||||
esac
|
||||
|
||||
}
|
||||
|
||||
start_hciattach ()
|
||||
{
|
||||
/system/bin/hciattach -n $BTS_DEVICE $BTS_TYPE $BTS_BAUD &
|
||||
hciattach_pid=$!
|
||||
logi "start_hciattach: pid = $hciattach_pid"
|
||||
echo 1 > $BLUETOOTH_SLEEP_PATH
|
||||
}
|
||||
|
||||
kill_hciattach ()
|
||||
{
|
||||
echo 0 > $BLUETOOTH_SLEEP_PATH
|
||||
logi "kill_hciattach: pid = $hciattach_pid"
|
||||
## careful not to kill zero or null!
|
||||
kill -TERM $hciattach_pid
|
||||
# this shell doesn't exit now -- wait returns for normal exit
|
||||
}
|
||||
|
||||
logi "init.qcom.bt.sh config = $config"
|
||||
case "$config" in
|
||||
"onboot")
|
||||
program_bdaddr
|
||||
config_bt
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
# mimic hciattach options parsing -- maybe a waste of effort
|
||||
USAGE="hciattach [-n] [-p] [-b] [-t timeout] [-s initial_speed] <tty> <type | id> [speed] [flow|noflow] [bdaddr]"
|
||||
|
||||
while getopts "blnpt:s:" f
|
||||
do
|
||||
case $f in
|
||||
b | l | n | p) opt_flags="$opt_flags -$f" ;;
|
||||
t) timeout=$OPTARG;;
|
||||
s) initial_speed=$OPTARG;;
|
||||
\?) echo $USAGE; exit 1;;
|
||||
esac
|
||||
done
|
||||
shift $(($OPTIND-1))
|
||||
|
||||
# Note that "hci_qcomm_init -e" prints expressions to set the shell variables
|
||||
# BTS_DEVICE, BTS_TYPE, BTS_BAUD, and BTS_ADDRESS.
|
||||
|
||||
#Selectively Disable sleep
|
||||
BOARD=`getprop ro.board.platform`
|
||||
STACK=`getprop ro.qc.bluetooth.stack`
|
||||
|
||||
# BR/EDR & LE power class configurations
|
||||
POWER_CLASS=`getprop qcom.bt.dev_power_class`
|
||||
LE_POWER_CLASS=`getprop qcom.bt.le_dev_pwr_class`
|
||||
|
||||
#find the transport type
|
||||
TRANSPORT=`getprop ro.qualcomm.bt.hci_transport`
|
||||
logi "Transport : $TRANSPORT"
|
||||
case $STACK in
|
||||
"bluez")
|
||||
logi "** Bluez stack **"
|
||||
;;
|
||||
*)
|
||||
logi "** Bluedroid stack **"
|
||||
setprop bluetooth.status off
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
case $POWER_CLASS in
|
||||
1) PWR_CLASS="-p 0" ;
|
||||
logi "Power Class: 1";;
|
||||
2) PWR_CLASS="-p 1" ;
|
||||
logi "Power Class: 2";;
|
||||
3) PWR_CLASS="-p 2" ;
|
||||
logi "Power Class: CUSTOM";;
|
||||
*) PWR_CLASS="";
|
||||
logi "Power Class: Ignored. Default(1) used (1-CLASS1/2-CLASS2/3-CUSTOM)";
|
||||
logi "Power Class: To override, Before turning BT ON; setprop qcom.bt.dev_power_class <1 or 2 or 3>";;
|
||||
esac
|
||||
|
||||
case $LE_POWER_CLASS in
|
||||
1) LE_PWR_CLASS="-P 0" ;
|
||||
logi "LE Power Class: 1";;
|
||||
2) LE_PWR_CLASS="-P 1" ;
|
||||
logi "LE Power Class: 2";;
|
||||
3) LE_PWR_CLASS="-P 2" ;
|
||||
logi "LE Power Class: CUSTOM";;
|
||||
*) LE_PWR_CLASS="-P 1";
|
||||
logi "LE Power Class: Ignored. Default(2) used (1-CLASS1/2-CLASS2/3-CUSTOM)";
|
||||
logi "LE Power Class: To override, Before turning BT ON; setprop qcom.bt.le_dev_pwr_class <1 or 2 or 3>";;
|
||||
esac
|
||||
|
||||
eval $(/system/bin/hci_qcomm_init -e $PWR_CLASS $LE_PWR_CLASS && echo "exit_code_hci_qcomm_init=0" || echo "exit_code_hci_qcomm_init=1")
|
||||
|
||||
case $exit_code_hci_qcomm_init in
|
||||
0) logi "Bluetooth QSoC firmware download succeeded, $BTS_DEVICE $BTS_TYPE $BTS_BAUD $BTS_ADDRESS";;
|
||||
*) failed "Bluetooth QSoC firmware download failed" $exit_code_hci_qcomm_init;
|
||||
case $STACK in
|
||||
"bluez")
|
||||
logi "** Bluez stack **"
|
||||
;;
|
||||
*)
|
||||
logi "** Bluedroid stack **"
|
||||
setprop bluetooth.status off
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $exit_code_hci_qcomm_init;;
|
||||
esac
|
||||
|
||||
# init does SIGTERM on ctl.stop for service
|
||||
trap "kill_hciattach" TERM INT
|
||||
|
||||
case $TRANSPORT in
|
||||
"smd")
|
||||
case $STACK in
|
||||
"bluez")
|
||||
logi "** Bluez stack **"
|
||||
echo 1 > /sys/module/hci_smd/parameters/hcismd_set
|
||||
;;
|
||||
*)
|
||||
logi "** Bluedroid stack **"
|
||||
setprop bluetooth.status on
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
logi "start hciattach"
|
||||
start_hciattach
|
||||
case $STACK in
|
||||
"bluez")
|
||||
logi "Bluetooth is turning On with Bluez stack "
|
||||
;;
|
||||
*)
|
||||
logi "** Bluedroid stack **"
|
||||
setprop bluetooth.status on
|
||||
;;
|
||||
esac
|
||||
|
||||
wait $hciattach_pid
|
||||
logi "Bluetooth stopped"
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@ -1,114 +0,0 @@
|
||||
#!/system/bin/sh
|
||||
# Copyright (c) 2009-2010, 2012, The Linux Foundation. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of The Linux Foundation nor
|
||||
# the names of its contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
LOG_TAG="qcom-bt-wlan-coex"
|
||||
LOG_NAME="${0}:"
|
||||
|
||||
coex_pid=""
|
||||
ath_wlan_supported=`getprop wlan.driver.ath`
|
||||
|
||||
loge ()
|
||||
{
|
||||
/system/bin/log -t $LOG_TAG -p e "$LOG_NAME $@"
|
||||
}
|
||||
|
||||
logi ()
|
||||
{
|
||||
/system/bin/log -t $LOG_TAG -p i "$LOG_NAME $@"
|
||||
}
|
||||
|
||||
failed ()
|
||||
{
|
||||
loge "$1: exit code $2"
|
||||
exit $2
|
||||
}
|
||||
|
||||
start_coex ()
|
||||
{
|
||||
case "$ath_wlan_supported" in
|
||||
"2")
|
||||
echo "ATH WLAN Chip ID AR6004 is enabled"
|
||||
/system/bin/abtfilt -d -z -n -m -a -w wlan0 &
|
||||
;;
|
||||
"1")
|
||||
echo "ATH WLAN Chip ID is enabled"
|
||||
# Must have -d -z -n -v -s -w wlan0 parameters for atheros btfilter.
|
||||
/system/bin/abtfilt -d -z -n -v -q -s -w wlan0 &
|
||||
;;
|
||||
"0")
|
||||
echo "WCN WLAN Chip ID is enabled"
|
||||
# Must have -o turned on to avoid daemon (otherwise we cannot get pid)
|
||||
/system/bin/btwlancoex -o $opt_flags &
|
||||
;;
|
||||
*)
|
||||
echo "NO WLAN Chip ID is enabled, so enabling ATH as default"
|
||||
# Must have -d -z -n -v -s -w wlan0 parameters for atheros btfilter.
|
||||
/system/bin/abtfilt -d -z -n -v -q -s -w wlan0 &
|
||||
;;
|
||||
esac
|
||||
coex_pid=$!
|
||||
logi "start_coex: pid = $coex_pid"
|
||||
}
|
||||
|
||||
kill_coex ()
|
||||
{
|
||||
logi "kill_coex: pid = $coex_pid"
|
||||
kill -TERM $coex_pid
|
||||
# this shell doesn't exit now -- wait returns for normal exit
|
||||
}
|
||||
|
||||
# mimic coex options parsing -- maybe a waste of effort
|
||||
USAGE="${0} [-o] [-c] [-r] [-i] [-h]"
|
||||
|
||||
while getopts "ocrih" f
|
||||
do
|
||||
case $f in
|
||||
o | c | r | i | h) opt_flags="$opt_flags -$f" ;;
|
||||
\?) echo $USAGE; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
# init does SIGTERM on ctl.stop for service
|
||||
trap "kill_coex" TERM INT
|
||||
|
||||
#Selectively start coex module
|
||||
target=`getprop ro.board.platform`
|
||||
|
||||
if [ "$target" == "msm8960" ] && [ "$ath_wlan_supported" != "2" ]; then
|
||||
logi "btwlancoex/abtfilt is not needed"
|
||||
else
|
||||
# Build settings may not produce the coex executable
|
||||
if ls /system/bin/btwlancoex || ls /system/bin/abtfilt
|
||||
then
|
||||
start_coex
|
||||
wait $coex_pid
|
||||
logi "Coex stopped"
|
||||
else
|
||||
logi "btwlancoex/abtfilt not available"
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
@ -1,721 +0,0 @@
|
||||
# Copyright (c) 2009-2012, 2014, The Linux Foundation. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of The Linux Foundation nor
|
||||
# the names of its contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
import init.qcom.usb.rc
|
||||
import init.target.rc
|
||||
|
||||
on early-init
|
||||
mount debugfs debugfs /sys/kernel/debug
|
||||
mkdir /firmware 0771 system system
|
||||
mkdir /system 0777 root root
|
||||
symlink /data/tombstones /tombstones
|
||||
write /sys/block/mmcblk0/queue/scheduler noop
|
||||
write /sys/block/mmcblk0/bdi/read_ahead_kb 512
|
||||
|
||||
on init
|
||||
# Set permissions for persist partition
|
||||
mkdir /persist 0771 system system
|
||||
|
||||
# See storage config details at http://source.android.com/tech/storage/
|
||||
mkdir /mnt/shell/emulated 0700 shell shell
|
||||
mkdir /storage/emulated 0555 root root
|
||||
mkdir /mnt/media_rw/sdcard1 0700 media_rw media_rw
|
||||
mkdir /mnt/media_rw/usbdisk 0700 media_rw media_rw
|
||||
mkdir /mnt/media_rw/uicc0 0700 media_rw media_rw
|
||||
mkdir /storage/sdcard1 0700 root root
|
||||
mkdir /storage/uicc0 0700 root root
|
||||
mkdir /storage/usbdisk 0700 root root
|
||||
|
||||
export EXTERNAL_STORAGE /storage/emulated/legacy
|
||||
export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
|
||||
export EMULATED_STORAGE_TARGET /storage/emulated
|
||||
export SECONDARY_STORAGE /storage/sdcard1
|
||||
|
||||
# Support legacy paths
|
||||
symlink /storage/emulated/legacy /sdcard
|
||||
symlink /storage/emulated/legacy /mnt/sdcard
|
||||
symlink /storage/emulated/legacy /storage/sdcard0
|
||||
symlink /mnt/shell/emulated/0 /storage/emulated/legacy
|
||||
symlink /storage/usbdisk /usbdisk
|
||||
symlink /storage/usbdisk /mnt/usbdisk
|
||||
|
||||
on fs
|
||||
mount_all fstab.qcom
|
||||
mkdir /persist/data 0700 system system
|
||||
restorecon_recursive /persist
|
||||
setprop ro.crypto.fuse_sdcard true
|
||||
|
||||
on post-fs
|
||||
export_rc /system/etc/init.cne.rc
|
||||
|
||||
# msm specific files that need to be created on /data
|
||||
on post-fs-data
|
||||
|
||||
mkdir /data/misc/camera 0770 camera camera
|
||||
|
||||
#Create PERFD deamon related dirs
|
||||
mkdir /data/misc/perfd 0770 root system
|
||||
chmod 2770 /data/misc/perfd
|
||||
mkdir /data/misc/perfd 0755 root system
|
||||
chmod 2755 /data/misc/perfd
|
||||
mkdir /data/system/perfd 0770 root system
|
||||
chmod 2770 /data/system/perfd
|
||||
|
||||
mkdir /data/media 0770 media_rw media_rw
|
||||
restorecon_recursive /data/media
|
||||
|
||||
mkdir /data/tombstones 0771 system system
|
||||
mkdir /tombstones/modem 0771 system system
|
||||
mkdir /tombstones/lpass 0771 system system
|
||||
mkdir /tombstones/wcnss 0771 system system
|
||||
mkdir /tombstones/dsps 0771 system system
|
||||
|
||||
mkdir /persist/data/sfs 0700 system system
|
||||
mkdir /persist/data/tz 0700 system system
|
||||
|
||||
mkdir /data/misc/bluetooth 0770 bluetooth bluetooth
|
||||
|
||||
# Create the directories used by the Wireless subsystem
|
||||
mkdir /data/misc/wifi 0770 wifi wifi
|
||||
mkdir /data/misc/wifi/sockets 0770 wifi wifi
|
||||
mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi
|
||||
mkdir /data/misc/dhcp 0770 dhcp dhcp
|
||||
chown dhcp dhcp /data/misc/dhcp
|
||||
|
||||
# Create the directories used by CnE subsystem
|
||||
mkdir /data/connectivity 0771 system system
|
||||
chown system system /data/connectivity
|
||||
|
||||
mkdir /data/connectivity/nsrm 0771 system system
|
||||
chown system system /data/connectivity/nsrm
|
||||
|
||||
# Create the directories used by DPM subsystem
|
||||
mkdir /data/dpm 0771 system system
|
||||
chown system system /data/dpm
|
||||
|
||||
mkdir /data/dpm/fdMgr 0771 system system
|
||||
chown system system /data/dpm/fdMgr
|
||||
|
||||
# Create directory used by audio subsystem
|
||||
mkdir /data/misc/audio 0770 audio audio
|
||||
restorecon_recursive /data/misc/audio
|
||||
|
||||
# Create directory used by the DASH client
|
||||
mkdir /data/misc/dash 0770 media audio
|
||||
|
||||
# Mounting of persist is moved to 'on emmc-fs' and 'on fs' sections
|
||||
# We chown/chmod /persist again so because mount is run as root + defaults
|
||||
chown system system /persist
|
||||
chmod 0771 /persist
|
||||
chmod 0664 /sys/devices/platform/msm_sdcc.1/polling
|
||||
chmod 0664 /sys/devices/platform/msm_sdcc.2/polling
|
||||
chmod 0664 /sys/devices/platform/msm_sdcc.3/polling
|
||||
chmod 0664 /sys/devices/platform/msm_sdcc.4/polling
|
||||
|
||||
# Chown polling nodes as needed from UI running on system server
|
||||
chown system system /sys/devices/platform/msm_sdcc.1/polling
|
||||
chown system system /sys/devices/platform/msm_sdcc.2/polling
|
||||
chown system system /sys/devices/platform/msm_sdcc.3/polling
|
||||
chown system system /sys/devices/platform/msm_sdcc.4/polling
|
||||
|
||||
#Create the symlink to qcn wpa_supplicant folder for ar6000 wpa_supplicant
|
||||
mkdir /data/system 0775 system system
|
||||
#symlink /data/misc/wifi/wpa_supplicant /data/system/wpa_supplicant
|
||||
|
||||
#Create directories for Location services
|
||||
mkdir /data/misc/location 0770 gps gps
|
||||
mkdir /data/misc/location/mq 0770 gps gps
|
||||
mkdir /data/misc/location/xtwifi 0770 gps gps
|
||||
mkdir /data/misc/location/gpsone_d 0770 system gps
|
||||
mkdir /data/misc/location/quipc 0770 gps system
|
||||
mkdir /data/misc/location/gsiff 0770 gps gps
|
||||
|
||||
#Create directory from IMS services
|
||||
mkdir /data/shared 0755
|
||||
chown system system /data/shared
|
||||
|
||||
#Create directory for FOTA
|
||||
mkdir /data/fota 0771
|
||||
chown system system /data/fota
|
||||
|
||||
#Create directory for hostapd
|
||||
mkdir /data/hostapd 0770 system wifi
|
||||
|
||||
# Create /data/time folder for time-services
|
||||
mkdir /data/time/ 0700 system system
|
||||
restorecon_recursive /data/time
|
||||
|
||||
mkdir /data/audio/ 0770 media audio
|
||||
|
||||
setprop vold.post_fs_data_done 1
|
||||
|
||||
#Create a folder for SRS to be able to create a usercfg file
|
||||
mkdir /data/data/media 0770 media media
|
||||
|
||||
on early-boot
|
||||
# set RLIMIT_MEMLOCK to 64MB
|
||||
setrlimit 8 67108864 67108864
|
||||
# Allow subsystem (modem etc) debugging
|
||||
write /sys/module/subsystem_restart/parameters/enable_debug ${persist.sys.ssr.enable_debug}
|
||||
write /sys/module/pil_msa/parameters/pbl_mba_boot_timeout_ms ${persist.sys.mba_boot_timeout}
|
||||
write /sys/module/pil_msa/parameters/modem_auth_timeout_ms ${persist.sys.modem_auth_timeout}
|
||||
write /sys/module/peripheral_loader/parameters/proxy_timeout_ms ${persist.sys.pil_proxy_timeout}
|
||||
write /sys/kernel/boot_adsp/boot 1
|
||||
|
||||
on boot
|
||||
chown bluetooth bluetooth /sys/module/bluetooth_power/parameters/power
|
||||
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
|
||||
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
|
||||
chown bluetooth bluetooth /proc/bluetooth/sleep/proto
|
||||
chown bluetooth bluetooth /sys/module/hci_uart/parameters/ath_lpm
|
||||
chown bluetooth bluetooth /sys/module/hci_uart/parameters/ath_btwrite
|
||||
chown system system /sys/module/sco/parameters/disable_esco
|
||||
chown bluetooth bluetooth /sys/module/hci_smd/parameters/hcismd_set
|
||||
chmod 0660 /sys/module/bluetooth_power/parameters/power
|
||||
chmod 0660 /sys/module/hci_smd/parameters/hcismd_set
|
||||
chmod 0660 /sys/class/rfkill/rfkill0/state
|
||||
chmod 0660 /proc/bluetooth/sleep/proto
|
||||
chown bluetooth bluetooth /dev/ttyHS0
|
||||
chmod 0660 /sys/module/hci_uart/parameters/ath_lpm
|
||||
chmod 0660 /sys/module/hci_uart/parameters/ath_btwrite
|
||||
chmod 0660 /dev/ttyHS0
|
||||
chown bluetooth bluetooth /sys/devices/platform/msm_serial_hs.0/clock
|
||||
chmod 0660 /sys/devices/platform/msm_serial_hs.0/clock
|
||||
|
||||
chmod 0660 /dev/ttyHS2
|
||||
chown bluetooth bluetooth /dev/ttyHS2
|
||||
|
||||
#Create QMUX deamon socket area
|
||||
mkdir /dev/socket/qmux_radio 0770 radio radio
|
||||
chmod 2770 /dev/socket/qmux_radio
|
||||
mkdir /dev/socket/qmux_audio 0770 media audio
|
||||
chmod 2770 /dev/socket/qmux_audio
|
||||
mkdir /dev/socket/qmux_bluetooth 0770 bluetooth bluetooth
|
||||
chmod 2770 /dev/socket/qmux_bluetooth
|
||||
mkdir /dev/socket/qmux_gps 0770 gps gps
|
||||
chmod 2770 /dev/socket/qmux_gps
|
||||
|
||||
setprop wifi.interface wlan0
|
||||
|
||||
# Define TCP buffer sizes for various networks
|
||||
# ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
|
||||
setprop net.tcp.buffersize.wifi 524288,2097152,4194304,262144,524288,1048576
|
||||
|
||||
|
||||
setprop ro.telephony.call_ring.multiple false
|
||||
|
||||
#Set SUID bit for usbhub
|
||||
chmod 4755 /system/bin/usbhub
|
||||
chmod 755 /system/bin/usbhub_init
|
||||
|
||||
#Remove SUID bit for iproute2 ip tool
|
||||
chmod 0755 /system/bin/ip
|
||||
|
||||
|
||||
chmod 0444 /sys/devices/platform/msm_hsusb/gadget/usb_state
|
||||
|
||||
#For bridgemgr daemon to inform the USB driver of the correct transport
|
||||
chown radio radio /sys/class/android_usb/f_rmnet_smd_sdio/transport
|
||||
|
||||
# yulong add tw 20140822
|
||||
# change file owner for factory test
|
||||
chown system system /sys/devices/virtual/touchscreen/touchscreen_dev/firmware_version
|
||||
chown system system /sys/devices/virtual/touchscreen/touchscreen_dev/firmware_update
|
||||
chown system system /sys/devices/virtual/touchscreen/touchscreen_dev/calibrate
|
||||
|
||||
# Define TCP buffer sizes for various networks
|
||||
# ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
|
||||
setprop net.tcp.buffersize.default 4096,87380,110208,4096,16384,110208
|
||||
setprop net.tcp.buffersize.lte 524288,1048576,2097152,262144,524288,1048576
|
||||
setprop net.tcp.buffersize.umts 4094,87380,110208,4096,16384,110208
|
||||
setprop net.tcp.buffersize.hspa 4094,87380,1220608,4096,16384,1220608
|
||||
setprop net.tcp.buffersize.hsupa 4094,87380,1220608,4096,16384,1220608
|
||||
setprop net.tcp.buffersize.hsdpa 4094,87380,1220608,4096,16384,1220608
|
||||
setprop net.tcp.buffersize.hspap 4094,87380,1220608,4096,16384,1220608
|
||||
setprop net.tcp.buffersize.edge 4093,26280,35040,4096,16384,35040
|
||||
setprop net.tcp.buffersize.gprs 4092,8760,11680,4096,8760,11680
|
||||
setprop net.tcp.buffersize.evdo 4094,87380,262144,4096,16384,262144
|
||||
|
||||
# Assign TCP buffer thresholds to be ceiling value of technology maximums
|
||||
# Increased technology maximums should be reflected here.
|
||||
write /proc/sys/net/core/rmem_max 2097152
|
||||
write /proc/sys/net/core/wmem_max 2097152
|
||||
|
||||
#To allow interfaces to get v6 address when tethering is enabled
|
||||
write /proc/sys/net/ipv6/conf/rmnet0/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet1/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet2/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet3/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet4/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet5/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet6/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet7/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet_sdio0/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet_sdio1/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet_sdio2/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet_sdio3/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet_sdio4/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet_sdio5/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet_sdio6/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet_sdio7/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet_usb0/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet_usb1/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet_usb2/accept_ra 2
|
||||
write /proc/sys/net/ipv6/conf/rmnet_usb3/accept_ra 2
|
||||
|
||||
# To prevent out of order acknowledgements from making
|
||||
# connection tracking to treat them as not belonging to
|
||||
# the connection they belong to.
|
||||
# Otherwise, a weird issue happens in which some long
|
||||
# connections on high-throughput links get dropped when
|
||||
# an ack packet comes out of order
|
||||
write /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal 1
|
||||
|
||||
# Set the console loglevel to < KERN_INFO
|
||||
# Set the default message loglevel to KERN_INFO
|
||||
write /proc/sys/kernel/printk "6 6 1 7"
|
||||
|
||||
# Allow access for CCID command/response timeout configuration
|
||||
chown system system /sys/module/ccid_bridge/parameters/bulk_msg_timeout
|
||||
|
||||
# Torch
|
||||
chown system camera /sys/class/leds/torch-light/brightness
|
||||
chmod 0660 /sys/class/leds/torch-light/brightness
|
||||
|
||||
# Touchscreen
|
||||
chown root system /sys/devices/virtual/touchscreen/touchscreen_dev/gesture_ctrl
|
||||
chmod 0660 /sys/devices/virtual/touchscreen/touchscreen_dev/gesture_ctrl
|
||||
|
||||
# charger
|
||||
chown system system /sys/bus/i2c/drivers/lc709203/batt_capacity
|
||||
chmod 0660 /sys/bus/i2c/drivers/lc709203/batt_capacity
|
||||
chown root system /sys/class/power_supply/bms/current_now
|
||||
chown root system /sys/class/power_supply/bms/voltage_ocv
|
||||
chmod 0664 /sys/class/power_supply/bms/current_now
|
||||
chmod 0664 /sys/class/power_supply/bms/voltage_ocv
|
||||
|
||||
chown root system /sys/devices/soc.0/78b9000.i2c/i2c-5/5-005d/keypad_enable
|
||||
chmod 0660 /sys/devices/soc.0/78b9000.i2c/i2c-5/5-005d/keypad_enable
|
||||
|
||||
# camera sockets
|
||||
mkdir /data/misc/camera 0770 camera camera
|
||||
|
||||
|
||||
on property:service.bootanim.exit=1
|
||||
write /sys/module/lpm_levels/system/cpu0/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu0/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu0/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu0/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/l2-pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/l2-cache-active/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/l2-pc/suspend_enabled Y
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ondemand
|
||||
|
||||
write /sys/module/lpm_levels/parameters/sleep_disabled 0
|
||||
|
||||
# KSM options
|
||||
write /sys/kernel/mm/ksm/pages_to_scan 100
|
||||
write /sys/kernel/mm/ksm/sleep_millisecs 100
|
||||
write /sys/kernel/mm/ksm/deferred_timer 1
|
||||
write /sys/kernel/mm/ksm/run 1
|
||||
|
||||
on property:init.svc.bootanim=stopped
|
||||
# Apply HMP task packing
|
||||
write /proc/sys/kernel/sched_small_task 20
|
||||
write /proc/sys/kernel/sched_mostly_idle_load 30
|
||||
write /proc/sys/kernel/sched_mostly_idle_nr_run 3
|
||||
|
||||
# enable governor
|
||||
write /sys/module/msm_thermal/core_control/enabled 0
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "interactive"
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 800000
|
||||
write /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay "20000 1094400:50000"
|
||||
write /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load 85
|
||||
write /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq 1094400
|
||||
write /sys/devices/system/cpu/cpufreq/interactive/io_is_busy 0
|
||||
write /sys/devices/system/cpu/cpufreq/interactive/min_sample_time 50000
|
||||
write /sys/devices/system/cpu/cpufreq/interactive/max_freq_hysteresis 50000
|
||||
write /sys/devices/system/cpu/cpufreq/interactive/target_loads "1 1094400:85 1152000:90 1209600:80"
|
||||
write /sys/devices/system/cpu/cpufreq/interactive/timer_rate 20000
|
||||
write /sys/module/msm_thermal/core_control/enabled 1
|
||||
|
||||
# bring all CPUs online
|
||||
write /sys/devices/system/cpu/cpu1/online 1
|
||||
write /sys/devices/system/cpu/cpu2/online 1
|
||||
write /sys/devices/system/cpu/cpu3/online 1
|
||||
|
||||
write /proc/sys/kernel/sched_window_stats_policy 2
|
||||
write /proc/sys/kernel/sched_ravg_hist_size 5
|
||||
|
||||
write /sys/module/cpu_boost/parameters/boost_ms 20
|
||||
write /sys/module/cpu_boost/parameters/input_boost_freq "0:1094400 1:1094400 2:1094400 3:1094400"
|
||||
write /sys/module/cpu_boost/parameters/sched_boost_on_input 1
|
||||
|
||||
write /sys/block/mmcblk0/queue/scheduler row
|
||||
|
||||
on property:init.svc.wpa_supplicant=stopped
|
||||
stop dhcpcd
|
||||
|
||||
on property:bluetooth.isEnabled=true
|
||||
start btwlancoex
|
||||
write /sys/class/bluetooth/hci0/idle_timeout 7000
|
||||
|
||||
on property:vold.decrypt=trigger_restart_framework
|
||||
start config_bluetooth
|
||||
|
||||
on property:persist.env.fastdorm.enabled=true
|
||||
setprop persist.radio.data_no_toggle 1
|
||||
|
||||
service irsc_util /system/bin/logwrapper /system/bin/irsc_util "/etc/sec_config"
|
||||
class main
|
||||
user root
|
||||
oneshot
|
||||
|
||||
service rmt_storage /system/bin/rmt_storage
|
||||
class core
|
||||
user root
|
||||
|
||||
service rfs_access /system/bin/rfs_access
|
||||
class core
|
||||
user system
|
||||
group system net_raw
|
||||
|
||||
service config_bluetooth /system/bin/sh /system/etc/init.qcom.bt.sh "onboot"
|
||||
class core
|
||||
user root
|
||||
seclabel u:r:bluetooth_loader:s0
|
||||
oneshot
|
||||
|
||||
service hciattach /system/bin/sh /system/etc/init.qcom.bt.sh
|
||||
class late_start
|
||||
user bluetooth
|
||||
group bluetooth net_bt_admin
|
||||
disabled
|
||||
seclabel u:r:bluetooth_loader:s0
|
||||
oneshot
|
||||
|
||||
on property:bluetooth.hciattach=true
|
||||
start hciattach
|
||||
|
||||
on property:bluetooth.hciattach=false
|
||||
setprop bluetooth.status off
|
||||
|
||||
# QMUX must be in multiple groups to support external process connections
|
||||
service qmuxd /system/bin/qmuxd
|
||||
class main
|
||||
user root
|
||||
group radio audio bluetooth gps qcom_diag
|
||||
|
||||
service netmgrd /system/bin/netmgrd
|
||||
class main
|
||||
|
||||
on property:ro.use_data_netmgrd=false
|
||||
# netmgr not supported on specific target
|
||||
stop netmgrd
|
||||
|
||||
# Adjust socket buffer to enlarge TCP receive window for high bandwidth
|
||||
# but only if ro.data.large_tcp_window_size property is set.
|
||||
on property:ro.data.large_tcp_window_size=true
|
||||
write /proc/sys/net/ipv4/tcp_adv_win_scale 2
|
||||
|
||||
service btwlancoex /system/bin/sh /system/etc/init.qcom.coex.sh
|
||||
class late_start
|
||||
user bluetooth
|
||||
group bluetooth net_bt_admin inet net_admin net_raw
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service p2p_supplicant /system/bin/wpa_supplicant \
|
||||
-ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf \
|
||||
-I/system/etc/wifi/p2p_supplicant_overlay.conf -N \
|
||||
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
|
||||
-I/system/etc/wifi/wpa_supplicant_overlay.conf \
|
||||
-O/data/misc/wifi/sockets -puse_p2p_group_interface=1 \
|
||||
-e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
|
||||
# we will start as root and wpa_supplicant will switch to user wifi
|
||||
# after setting up the capabilities required for WEXT
|
||||
# user wifi
|
||||
# group wifi inet keystore
|
||||
class main
|
||||
socket wpa_wlan0 dgram 660 wifi wifi
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service wpa_supplicant /system/bin/wpa_supplicant \
|
||||
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf \
|
||||
-I/system/etc/wifi/wpa_supplicant_overlay.conf \
|
||||
-O/data/misc/wifi/sockets \
|
||||
-e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
|
||||
# we will start as root and wpa_supplicant will switch to user wifi
|
||||
# after setting up the capabilities required for WEXT
|
||||
# user wifi
|
||||
# group wifi inet keystore
|
||||
class main
|
||||
socket wpa_wlan0 dgram 660 wifi wifi
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcpcd_wlan0 /system/bin/dhcpcd -ABKLG
|
||||
class late_start
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcpcd_p2p /system/bin/dhcpcd -ABKLG
|
||||
class late_start
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service iprenew_wlan0 /system/bin/dhcpcd -n
|
||||
class late_start
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service iprenew_p2p /system/bin/dhcpcd -n
|
||||
class late_start
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcpcd_bt-pan /system/bin/dhcpcd -BKLG
|
||||
class late_start
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service iprenew_bt-pan /system/bin/dhcpcd -n
|
||||
class late_start
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcpcd_bnep0 /system/bin/dhcpcd -BKLG
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcpcd_bnep1 /system/bin/dhcpcd -BKLG
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcpcd_bnep2 /system/bin/dhcpcd -BKLG
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcpcd_bnep3 /system/bin/dhcpcd -BKLG
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service dhcpcd_bnep4 /system/bin/dhcpcd -BKLG
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service loc_launcher /system/bin/loc_launcher
|
||||
#loc_launcher will start as root and set its uid to gps
|
||||
class late_start
|
||||
group gps inet net_raw qcom_diag net_admin wifi
|
||||
|
||||
service wifi-crda /system/bin/sh /system/etc/init.crda.sh
|
||||
class late_start
|
||||
user root
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service hostapd /system/bin/hostapd -dd /data/hostapd/hostapd.conf
|
||||
class late_start
|
||||
user root
|
||||
group root
|
||||
oneshot
|
||||
disabled
|
||||
|
||||
on property:ro.data.large_tcp_window_size=true
|
||||
# Adjust socket buffer to enlarge TCP receive window for high bandwidth (e.g. DO-RevB)
|
||||
write /proc/sys/net/ipv4/tcp_adv_win_scale 2
|
||||
|
||||
on property:ro.product.cpu.abi=arm64-v8a
|
||||
setprop rild.libpath /system/vendor/lib64/libril-qc-qmi-1.so
|
||||
|
||||
on property:ro.product.cpu.abi=armeabi-v7a
|
||||
setprop rild.libpath /system/vendor/lib/libril-qc-qmi-1.so
|
||||
|
||||
service ril-daemon1 /system/bin/rild -c 2
|
||||
class main
|
||||
socket rild2 stream 660 root radio
|
||||
socket rild-debug2 stream 660 radio system
|
||||
user root
|
||||
group radio cache inet misc audio sdcard_r sdcard_rw diag qcom_diag log
|
||||
|
||||
service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
|
||||
class late_start
|
||||
|
||||
service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
|
||||
class late_start
|
||||
disabled
|
||||
|
||||
service fuse_usbdisk /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/usbdisk /storage/usbdisk
|
||||
class late_start
|
||||
disabled
|
||||
|
||||
service charger /charger
|
||||
class charger
|
||||
group log
|
||||
seclabel u:r:healthd:s0
|
||||
|
||||
service ssr_diag /system/bin/ssr_diag
|
||||
class late_start
|
||||
user system
|
||||
group system
|
||||
|
||||
service hvdcp /system/bin/hvdcp
|
||||
class core
|
||||
user root
|
||||
disabled
|
||||
|
||||
on property:persist.usb.hvdcp.detect=true
|
||||
start hvdcp
|
||||
|
||||
on property:persist.usb.hvdcp.detect=false
|
||||
stop hvdcp
|
||||
|
||||
service vm_bms /system/bin/vm_bms
|
||||
class core
|
||||
user root
|
||||
group root
|
||||
|
||||
#start camera server as daemon
|
||||
service qcamerasvr /system/bin/mm-qcamera-daemon
|
||||
class main
|
||||
user camera
|
||||
group camera system inet input graphics
|
||||
|
||||
# Allow usb charging to be disabled peristently
|
||||
on property:persist.usb.chgdisabled=1
|
||||
write /sys/class/power_supply/battery/charging_enabled 0
|
||||
|
||||
on property:persist.usb.chgdisabled=0
|
||||
write /sys/class/power_supply/battery/charging_enabled 1
|
||||
|
||||
service qseecomd /system/bin/qseecomd
|
||||
class core
|
||||
user root
|
||||
group root
|
||||
|
||||
service perfd /system/bin/perfd
|
||||
class main
|
||||
user root
|
||||
group root
|
||||
|
||||
service thermal-engine /system/bin/thermal-engine
|
||||
class main
|
||||
user root
|
||||
group root
|
||||
|
||||
service time_daemon /system/bin/time_daemon
|
||||
class late_start
|
||||
user root
|
||||
group root
|
||||
|
||||
service audiod /system/bin/audiod
|
||||
class late_start
|
||||
user system
|
||||
group system
|
||||
|
||||
on charger
|
||||
wait /dev/block/bootdevice/by-name/system
|
||||
mount ext4 /dev/block/bootdevice/by-name/system /system ro barrier=1
|
||||
chown root system /sys/class/power_supply/bms/current_now
|
||||
chown root system /sys/class/power_supply/bms/voltage_ocv
|
||||
chmod 0664 /sys/class/power_supply/bms/current_now
|
||||
chmod 0664 /sys/class/power_supply/bms/voltage_ocv
|
||||
write /sys/module/lpm_levels/system/cpu0/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu0/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu0/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu0/pc/suspend_enabled N
|
||||
write /sys/module/lpm_levels/system/cpu1/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/l2-pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/l2-cache-active/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/l2-pc/suspend_enabled Y
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ondemand
|
||||
start vm_bms
|
||||
|
||||
service ppd /system/bin/mm-pp-daemon
|
||||
class late_start
|
||||
disabled
|
||||
user system
|
||||
socket pps stream 0660 system system
|
||||
group system graphics
|
||||
|
||||
on property:init.svc.surfaceflinger=stopped
|
||||
stop ppd
|
||||
|
||||
on property:init.svc.surfaceflinger=running
|
||||
start ppd
|
||||
|
||||
service wcnss-service /system/bin/wcnss_service
|
||||
class main
|
||||
user system
|
||||
group system wifi radio
|
||||
|
||||
service sensord /system/bin/sensord
|
||||
class main
|
||||
user root
|
||||
|
||||
on property:init.svc.zygote=restarting
|
||||
restart sensord
|
||||
|
||||
service setup_fs /system/bin/setup_fs /dev/block/platform/7824900.sdhci/by-name/userdata
|
||||
class core
|
||||
user root
|
||||
group root
|
||||
oneshot
|
||||
|
||||
# bugreport is triggered by holding down volume down, volume up and power
|
||||
service bugreport /system/bin/dumpstate -d -p -B \
|
||||
-o /data/data/com.android.shell/files/bugreports/bugreport
|
||||
class main
|
||||
disabled
|
||||
oneshot
|
||||
keycodes 114 115 116
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
on boot
|
||||
write /sys/module/lpm_levels/system/cpu0/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu0/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu0/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu0/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/l2-pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/l2-cache-active/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/l2-pc/suspend_enabled Y
|
||||
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "ondemand"
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
# Copyright (c) 2009-2012, 2014, The Linux Foundation. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of The Linux Foundation nor
|
||||
# the names of its contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
on boot
|
||||
# charger
|
||||
chown system system /sys/bus/i2c/drivers/lc709203/batt_capacity
|
||||
chmod 0660 /sys/bus/i2c/drivers/lc709203/batt_capacity
|
||||
chown root system /sys/class/power_supply/bms/current_now
|
||||
chown root system /sys/class/power_supply/bms/voltage_ocv
|
||||
chmod 0664 /sys/class/power_supply/bms/current_now
|
||||
chmod 0664 /sys/class/power_supply/bms/voltage_ocv
|
||||
|
||||
service sdcard /system/bin/sdcard -u 1023 -g 1023 -l /data/media /mnt/shell/emulated
|
||||
class late_start
|
||||
|
||||
service fuse_sdcard1 /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1
|
||||
class late_start
|
||||
disabled
|
||||
|
||||
service fuse_usbdisk /system/bin/sdcard -u 1023 -g 1023 -w 1023 -d /mnt/media_rw/usbdisk /storage/usbdisk
|
||||
class late_start
|
||||
disabled
|
||||
|
||||
service charger /charger
|
||||
class charger
|
||||
group log
|
||||
seclabel u:r:healthd:s0
|
||||
|
||||
service vm_bms /system/bin/vm_bms
|
||||
class core
|
||||
user root
|
||||
group root
|
||||
|
||||
on charger
|
||||
wait /dev/block/bootdevice/by-name/system
|
||||
mount ext4 /dev/block/bootdevice/by-name/system /system ro barrier=1
|
||||
chown root system /sys/class/power_supply/bms/current_now
|
||||
chown root system /sys/class/power_supply/bms/voltage_ocv
|
||||
chmod 0664 /sys/class/power_supply/bms/current_now
|
||||
chmod 0664 /sys/class/power_supply/bms/voltage_ocv
|
||||
write /sys/module/lpm_levels/system/cpu0/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/wfi/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu0/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/standalone_pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu0/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu1/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu0/pc/suspend_enabled N
|
||||
write /sys/module/lpm_levels/system/cpu1/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu2/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/cpu3/pc/suspend_enabled Y
|
||||
write /sys/module/lpm_levels/system/l2-pc/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/l2-cache-active/idle_enabled Y
|
||||
write /sys/module/lpm_levels/system/l2-pc/suspend_enabled Y
|
||||
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ondemand
|
||||
start vm_bms
|
||||
|
||||
service sensord /system/bin/sensord
|
||||
class main
|
||||
user root
|
||||
|
||||
on property:init.svc.zygote=restarting
|
||||
restart sensord
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
# Bluetooth executables and scripts
|
||||
type bluetooth_loader, domain;
|
||||
type bluetooth_loader_exec, exec_type, file_type;
|
||||
|
||||
# Start bdAddrLoader from init
|
||||
init_daemon_domain(bluetooth_loader)
|
||||
|
||||
# Run init.qcom.bt.sh
|
||||
allow bluetooth_loader shell_exec:file { entrypoint read };
|
||||
allow bluetooth_loader bluetooth_loader_exec:file { getattr open execute_no_trans };
|
||||
|
||||
# init.qcom.bt.sh needs /system/bin/log access
|
||||
allow bluetooth_loader devpts:chr_file rw_file_perms;
|
||||
|
||||
# Run hci_qcomm_init from init.qcom.bt.sh
|
||||
domain_auto_trans(bluetooth_loader, hci_attach_exec, hci_attach)
|
||||
allow hci_attach bluetooth_loader:fd use;
|
||||
|
||||
# Read mac address from persist partition
|
||||
allow bluetooth_loader persist_file:dir search;
|
||||
r_dir_file(bluetooth_loader, bluetooth_data_file)
|
||||
allow bluetooth_loader self:capability { dac_override dac_read_search };
|
||||
|
||||
# It may write a random mac here
|
||||
allow bluetooth_loader persist_file:dir { add_name write };
|
||||
allow bluetooth_loader persist_file:file { create_file_perms };
|
||||
allow bluetooth_loader bluetooth_data_file:file create_file_perms;
|
||||
|
||||
# Talk to init over the property socket
|
||||
unix_socket_connect(bluetooth_loader, property, init)
|
||||
# Set persist.service.bdroid.* and bluetooth.* property values
|
||||
allow bluetooth_loader bluetooth_prop:property_service set;
|
||||
|
||||
# Allow getprop/setprop for init.qcom.bt.sh
|
||||
allow bluetooth_loader system_file:file execute_no_trans;
|
||||
|
||||
# Access the smd device
|
||||
allow bluetooth_loader hci_attach_dev:chr_file rw_file_perms;
|
||||
|
||||
# And qmuxd
|
||||
allow bluetooth_loader qmuxd_socket:dir { write add_name remove_name search };
|
||||
allow bluetooth_loader qmuxd_socket:sock_file { create setattr getattr write unlink };
|
||||
allow bluetooth_loader qmuxd:unix_stream_socket { connectto };
|
||||
#
|
||||
@ -1,7 +0,0 @@
|
||||
/persist/.genmac u:object_r:wifi_data_file:s0
|
||||
/persist/.bt_nv.bin u:object_r:bluetooth_data_file:s0
|
||||
|
||||
/system/bin/btnvtool u:object_r:bluetooth_loader_exec:s0
|
||||
/system/etc/init\.qcom\.bt\.sh u:object_r:bluetooth_loader_exec:s0
|
||||
|
||||
/dev/smd3 u:object_r:hci_attach_dev:s0
|
||||
@ -1,2 +0,0 @@
|
||||
qualcomm.bluetooth. u:object_r:bluetooth_prop:s0
|
||||
qualcomm.bt. u:object_r:bluetooth_prop:s0
|
||||
@ -1 +0,0 @@
|
||||
allow tee system_prop:property_service set;
|
||||
@ -1,2 +0,0 @@
|
||||
# secure display
|
||||
allow surfaceflinger persist_file:dir r_dir_perms;
|
||||
@ -1 +0,0 @@
|
||||
allow wcnss_service persist_file:dir search;
|
||||
Loading…
Reference in New Issue