[REF] How Infrared is (not) working on LePro3 - some infos for IR devs

darkobas

Senior Member
Jan 11, 2011
4,765
9,222
0
plus.google.com
Another (failed) try:
Instead of writing our own infrared HAL implementation, I thought it might be easier to just look at the implementation of other devices.

I came across the Xiaomi Mi 5 ("gemini") which also has an infrared device, the same ro.product.board (msm8996) and the same architecture.

I just replaced the HAL implementation file on the LePro3 (/system/lib64/hw/consumerir.default.so) with the one from the latest Cyanogenmod nigthly build (the file there is named: /system/lib64/hw/consumerir.msm8996.so).

First success: The .so file was loaded successfully, but the Consumer IR Service failed to start, as the Xiaomi HAL implementation uses LIRC to communicate with the infrared blaster (using the device file /dev/lirc0) which is not provided by the default kernel of the LePro 3.

As the Consumer IR Service failed to start, the device stuck in a bootloop, logging regularly this error:
Code:
11-24 16:24:02.459 I/SystemServer( 1570): Consumer IR Service
11-24 16:24:02.460 E/ConsumerIrLirc( 1570): fail to open /dev/lirc0 error -1
11-24 16:24:02.460 E/ConsumerIrService( 1570): Can't open consumer IR transmitter, error: -1
11-24 16:24:02.460 E/System  ( 1570): ******************************************
11-24 16:24:02.461 E/System  ( 1570): ************ Failure starting core service
11-24 16:24:02.461 E/System  ( 1570): java.lang.RuntimeException: FEATURE_CONSUMER_IR present, but no IR HAL loaded!
11-24 16:24:02.461 E/System  ( 1570):   at com.android.server.ConsumerIrService.<init>(ConsumerIrService.java:51)
11-24 16:24:02.461 E/System  ( 1570):   at com.android.server.SystemServer.startOtherServices(SystemServer.java:508)
11-24 16:24:02.461 E/System  ( 1570):   at com.android.server.SystemServer.run(SystemServer.java:282)
11-24 16:24:02.461 E/System  ( 1570):   at com.android.server.SystemServer.main(SystemServer.java:180)
11-24 16:24:02.461 E/System  ( 1570):   at java.lang.reflect.Method.invoke(Native Method)
11-24 16:24:02.461 E/System  ( 1570):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-24 16:24:02.461 E/System  ( 1570):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
So, if somebody could compile a kernel which provides a lirc interface (/dev/lirc0), we could just use the HAL from Xiaomi and the problem also would be solved.
I had a quick look qt this. But i think they have modified the lirc driver in kernel to work with their hardware. also their dts is different.

Sent from my LEX720 using Tapatalk
 
  • Like
Reactions: mobiusm

androcheck

Senior Member
Dec 7, 2009
235
413
63
john.zweng.at
I had a quick look qt this. But i think they have modified the lirc driver in kernel to work with their hardware. also their dts is different.
Hi @darkobas! Thanks for looking into this. :)

I also realized that lirc is very probably not an option for the IR chip used in the LEX720 device. The lirc kernel driver would need to implement the proprietary serial protocol which is currently done by the QuickSetSDK in userspace (altough it would be a beautiful and clean solution to have a working lirc driver).

Btw, I recently also switched to your OmniROM 7.1.2 build for my daily used phone. Thanks for your work! :good:
 

darkobas

Senior Member
Jan 11, 2011
4,765
9,222
0
plus.google.com
Hi @darkobas! Thanks for looking into this. :)

I also realized that lirc is very probably not an option for the IR chip used in the LEX720 device. The lirc kernel driver would need to implement the proprietary serial protocol which is currently done by the QuickSetSDK in userspace (altough it would be a beautiful and clean solution to have a working lirc driver).

Btw, I recently also switched to your OmniROM 7.1.2 build for my daily used phone. Thanks for your work! :good:
trying to make atleast the stock app work.
stuck at this at the moment
05-09 12:26:19.217 6581 6581 I UEI.SmartControl.LeTV: ### init IR Blaster...
05-09 12:26:19.220 6581 6581 E UEI.SmartControl.LeTV: no permission on read/write serial port!
05-09 12:26:19.221 6581 6581 E UEI.SmartControl.LeTV: java.io.IOException: no permission on read/write serial port!
05-09 12:26:19.221 6581 6581 E UEI.SmartControl.LeTV: at com.uei.driver.SerialDataComm.f(Unknown Source)
05-09 12:26:19.221 6581 6581 E UEI.SmartControl.LeTV: at com.uei.driver.SerialDataComm.<init>(Unknown Source)
 
  • Like
Reactions: GalaticStryder

androcheck

Senior Member
Dec 7, 2009
235
413
63
john.zweng.at
trying to make atleast the stock app work.
stuck at this at the moment
05-09 12:26:19.217 6581 6581 I UEI.SmartControl.LeTV: ### init IR Blaster...
05-09 12:26:19.220 6581 6581 E UEI.SmartControl.LeTV: no permission on read/write serial port!
05-09 12:26:19.221 6581 6581 E UEI.SmartControl.LeTV: java.io.IOException: no permission on read/write serial port!
05-09 12:26:19.221 6581 6581 E UEI.SmartControl.LeTV: at com.uei.driver.SerialDataComm.f(Unknown Source)
05-09 12:26:19.221 6581 6581 E UEI.SmartControl.LeTV: at com.uei.driver.SerialDataComm.<init>(Unknown Source)
Hi,
I've decompiled the QuickSet SDK and this log message only appears in this context (where "file" is the serial device file under /dev which is used to send commands to the IR system):

Code:
if (file != null && file.canRead() && file.canWrite()) {
    ... does some stuff here
    return;  // and RETURNS
}
this.logger.logError("no permission on read/write serial port!", new Object[0]);
throw new IOException("no permission on read/write serial port!");
So this means it cannot find the tty file or has not the permissions to read/write to it (also take care of SE linux context!).
On the original stock ROM the device file /dev/ttyHSL1 is used.

Additional info:
The information which device file should be used, normally comes from the client application (which binds the QuickSet SDK service). The QuickSet service itself only defines a fallback default within its strings.xml (<string name="SerialPort_LeTV">/dev/ttyMT3</string>).

The serial device file path to use is added to the intent sent to the service (see "Port" below):

Code:
...
intent.putExtra("Port", this.platformParams.getSerialName());  // <--- HERE the client app specifies the full path to the tty device file
intent.putExtra("Baudrate", this.platformParams.getSerialPort());
boolean result = bindService(intent, this.mSetupServiceConnection, 1);
 

trizex

Senior Member
Oct 21, 2006
233
139
0
I wrote a bit about it couple of months ago. Screenshots of 6.0 working IR logcat grabs are in this post
https://forum.xda-developers.com/showpost.php?p=71677801&postcount=117

So I've spent a few hours digging around, and here's what I have so far. The serial port to which the app is trying to bind should be /dev/ttyHSL1, but it's missing in nougat.

Furthermore following @androcheck great writeup on the matter I saw that sys/remote/enable wasnt being toggled at all.( on remote control app startup it should change its value to 1, thus powering up the IR chip). I tried toggling it manually, but nothing changed.

I restored my 6.0.1 to grab some logs, and saw some processes that werent present in nougat. Mainly "ss", " ss_ir", "ss_UEI_IRbiz", who, among other things, toggle the sys/remote/enable switch, and bind quicksetsdk to /dev/ttyHSL1.

So after returning to Nougat, I was offered to update the remote control app, and I did. Now it crashes on startup, but guess what? The processes I've mentioned that I saw on Marshmallow were now present :) the app toggles the switch to activate IR now as it should, but the serial port itself is still missing (if I presume correctly it's missing from the kernel?)

Hope I was of some use to you with this info, I'll post the grabbed logs in a min.
 

androcheck

Senior Member
Dec 7, 2009
235
413
63
john.zweng.at
I wrote a bit about it couple of months ago. Screenshots of 6.0 working IR logcat grabs are in this post
https://forum.xda-developers.com/showpost.php?p=71677801&postcount=117
@trizex Thanks for your reply. :)

@darkobas: which kernel did you test with? Did you test with your EAS kernel?

I did a quick grep over the source and the only occurrences of "ttyHSL" I found were in:
  • Documentation/devicetree/bindings/tty/serial/msm_serial.txt
  • drivers/tty/serial/msm_serial_hs_lite.c

I've checked the config in "arch/arm64/configs/zl1_defconfig" and it seems that CONFIG_SERIAL_MSM_HSL is not enabled.
Could you try again with this config enabled?

P.S.: I didn't build the kernel or ROM myself until now. Is it possible that you could provide me a local manifest to work with? :)
 
Last edited:
  • Like
Reactions: trizex

GalaticStryder

Senior Member
Nov 20, 2014
1,326
4,753
0
Porto Alegre
@trizex Thanks for your reply. :)

@darkobas: which kernel did you test with? Did you test with your EAS kernel?

I did a quick grep over the source and the only occurrences of "ttyHSL" I found where in:
  • Documentation/devicetree/bindings/tty/serial/msm_serial.txt
  • drivers/tty/serial/msm_serial_hs_lite.c

I've checked the config in "arch/arm64/configs/zl1_defconfig" and it seems that CONFIG_SERIAL_MSM_HSL is not enabled.
Could you try again with this config enabled?

P.S.: I didn't build the kernel or ROM myself until now. Is it possible that you could provide me a local manifest to work with? :)
Legacy HSL needs to be enabled not only for IR but for other OEM components.

The stock Kernel has introduced SERIAL_MSM_HSL_DYNAMIC_CONSOLE for that purpose.

Code:
config SERIAL_MSM_HSL
	tristate "MSM UART High Speed: Legacy mode Serial Driver"
	depends on (ARM || ARM64) && ARCH_MSM
	select SERIAL_CORE
	default n
	help
	  Select this module to enable MSM high speed UART driver in
	  legacy mode.

config SERIAL_MSM_HSL_CONSOLE
	bool "MSM High speed serial legacy mode console support"
	depends on SERIAL_MSM_HSL=y
	select SERIAL_CORE_CONSOLE
	select SERIAL_EARLYCON
	default n

config SERIAL_MSM_HSL_DYNAMIC_CONSOLE
	bool "Dynamic command line support for the HSL console"
	depends on SERIAL_MSM_HSL_CONSOLE
	default n
To build the Kernel only, just use the minimal repo, I updated it to 7.1.2: https://github.com/GalaticStryder/omniscience
 
Last edited:

darkobas

Senior Member
Jan 11, 2011
4,765
9,222
0
plus.google.com
@trizex Thanks for your reply. :)

@darkobas: which kernel did you test with? Did you test with your EAS kernel?

I did a quick grep over the source and the only occurrences of "ttyHSL" I found were in:
  • Documentation/devicetree/bindings/tty/serial/msm_serial.txt
  • drivers/tty/serial/msm_serial_hs_lite.c

I've checked the config in "arch/arm64/configs/zl1_defconfig" and it seems that CONFIG_SERIAL_MSM_HSL is not enabled.
Could you try again with this config enabled?

P.S.: I didn't build the kernel or ROM myself until now. Is it possible that you could provide me a local manifest to work with? :)
Yeah i have enabled hsl. just chmoding it didnt help.
also quickset doesnt seem to try enable the ir.... ill continue 2morrow.

Sent from my LEX720 using Tapatalk
 
  • Like
Reactions: CaptainHook8

darkobas

Senior Member
Jan 11, 2011
4,765
9,222
0
plus.google.com
ok startup is almost identical for me
it fails though
05-09 18:33:51.424 10652 10652 D MainControlActivity: Send IRFunction --0
05-09 18:33:51.432 10652 10790 E IRActionManager: -- Send IR: Id = 0
05-09 18:33:51.434 7276 7288 I UEI.SmartControl.LeTV: ------ IControl API: 1
05-09 18:33:51.434 7276 7288 I UEI.SmartControl.LeTV: Control.sendIR. 64028
05-09 18:33:51.434 7276 7288 E UEI.SmartControl.LeTV: Function is not found: 0
05-09 18:33:51.434 7276 7288 I UEI.SmartControl.LeTV: Control.sendIR: 2
05-09 18:33:51.435 10652 10790 E IRActionManager: Result = 2 ŔžúÚçŐ: Not found
05-09 18:33:51.501 10652 10652 D TVPanelFragment: panel--action:up
05-09 18:33:51.507 10652 10790 E IRActionManager: -- testStopIrFunction
05-09 18:33:51.508 7276 7300 I UEI.SmartControl.LeTV: ------ IControl API: 4
05-09 18:33:51.508 7276 7300 I UEI.SmartControl.LeTV: Control.stopIR.
05-09 18:33:51.508 7276 7300 I UEI.SmartControl.LeTV: stopIR...
05-09 18:33:51.508 7276 7300 I UEI.SmartControl.LeTV: stopIR done
05-09 18:33:51.508 7276 7300 I UEI.SmartControl.LeTV: Control.stopIR: 1
05-09 18:33:51.509 10652 10790 E IRActionManager: Result = 1 ŔžúÚçŐ: Error
 

androcheck

Senior Member
Dec 7, 2009
235
413
63
john.zweng.at
Regarding your logcat: I'm not totally sure, but it looks for me like this means the client (IR remote app) tries to use a deviceId/functionId combination (64028/0), which the QuickSet SDK doesn't know of. Are you testing with the original LeEco Remote app / QuickSet SDK service combination or are you using a different app or quickset sdk?

I'm also not sure yet where the configuration for QuickSet (remote devices and functions) actually is coming from (where it's loaded from). Maybe your versions are totally fine, but somehow the configuration is messed up (it's really hard to tell, the code is obfuscated and hard to follow).

And regarding this:
also quickset doesnt seem to try enable the ir....
The write to "/sys/remote/enable" is done by the LeEco Remote app (package: com.letv.android.remotecontrol) not the QuickSet SDK. On the stock ROM this file had a special SELinux type assigned (sysfs_ir_enable) and it was taken care of that the LeEco remote app was allowed to write it:
Code:
u:object_r:sysfs_ir_enable:s0
 

darkobas

Senior Member
Jan 11, 2011
4,765
9,222
0
plus.google.com
Regarding your logcat: I'm not totally sure, but it looks for me like this means the client (IR remote app) tries to use a deviceId/functionId combination (64028/0), which the QuickSet SDK doesn't know of. Are you testing with the original LeEco Remote app / QuickSet SDK service combination or are you using a different app or quickset sdk?

I'm also not sure yet where the configuration for QuickSet (remote devices and functions) actually is coming from (where it's loaded from). Maybe your versions are totally fine, but somehow the configuration is messed up (it's really hard to tell, the code is obfuscated and hard to follow).

And regarding this:

The write to "/sys/remote/enable" is done by the LeEco Remote app (package: com.letv.android.remotecontrol) not the QuickSet SDK. On the stock ROM this file had a special SELinux type assigned (sysfs_ir_enable) and it was taken care of that the LeEco remote app was allowed to write it:
Code:
u:object_r:sysfs_ir_enable:s0
Yeah original.

Ill try change the context name for remote/enable

Sent from my LEX720 using Tapatalk
 
  • Like
Reactions: CaptainHook8