Android9 , how preset UART baud rate?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Android9 , how preset UART baud rate?

691件の閲覧回数
mariosan
Contributor II

Hi, I'm running Andoid9 over imx8mm and I want to preset the baud rate of my uarts at start up.

I've not found any way to do this in Andoid , any suggestion?

Thank Mario

ラベル(2)
0 件の賞賛
1 返信

611件の閲覧回数
mariosan
Contributor II

well, I've find a way to setup serials , thanks to other topics .

just launch a script at start up, also if this is not as easy work to do :-)

1) write a script, for example serialcfg.rc like this one and place it under you device

    directory (es; device/fls/imx8m/mydevice)

#!/system/bin/sh

/system/bin/stty 460800 < /dev/ttymxc2
/system/bin/stty 115200 < /dev/ttymxc3

/system/bin/stty 115200 < /dev/ttyUSB0

2) in the device's  policy directory add the serialcfg.te file:

# test domains

type serialcfg, domain;

type serialcfg_exec, exec_type, vendor_file_type, file_type;

init_daemon_domain(serialcfg)

domain_auto_trans(init, vendor_shell_exec, serialcfg)

3) Change  policy/file_contexts

/vendor/bin/serialcfg.rc  u:object_r:serialcfg_exec:s0

4) in the device makefile add the line:

PRODUCT_COPY_FILES += \

$(IMX_DEVICE_PATH)/serialcfg.rc:/vendor/bin/serialcfg.rc

5) in the device's directory change the init.rc

service serialcfg /vendor/bin/serialcfg.rc

class late_start

user root system

group root system

oneshot

After start up I found serials configured as I want , anyway I will appreciate
suggestion for a more simple approach, if any exist

Thanks,

Mario

0 件の賞賛