[UNOFFICIAL][ROM] BETA LineageOS 16.0 for Galaxy Tab A 9.7 S-pen [SM-P550]

retiredtab

Senior Member
Nov 16, 2017
345
86
28
For 17.1 or Android 10, the msm8916 team changed the path as per

https://github.com/Galaxy-MSM8916/a...mmit/c5cef5644e014e0e70c825cbf99bcaea795dc4e3

# Audio
- AUDIO_CONFIG_PATH := hardware/qcom/audio-caf/msm8916/configs
+ AUDIO_CONFIG_PATH := hardware/qcom-caf/msm8916/audio/configs

Just make sure your roomservice.xml matches correct path. I made that mistake in SM-T560NU and didn't have external audio until I switched it over. The SM-T560NU shares same msm8916 common/kernel code as the SM-T550/SM-P550.

You can see my repo diff and roomservice.xml for the SM-T560NU (post #3) at

https://forum.xda-developers.com/ga...official-lineageos-17-1-galaxy-tab-e-t4150709
 

aala27

Member
Nov 12, 2015
31
8
8
It says I need a google account to get RR 10. I was able to download RR 9 without one. Can you please change the permissions so I can download 10 without a login? Once I download 10, I will see if I can help you by looking at the logcat.

BTW, I downloaded RR 9 and get the same results as you. The spen only works in portrait mode. 90, 180 and 270 have incorrect mouse pointer display.

Also, when I asked about which module or procedure, I wasn't asking about the driver (Wacom). As soon as I saw your P550_defconfig, I knew it was the wacom driver. What I'm asking is what module or program actually draws the mouse pointer that shows up the lcd.

When I look at getevent -l | grep event3, I think the wacom driver is properly reporting the X and Y coordinates where the pen is hovering or touching with 0,0 at top left corner and 768, 1024 at bottom right corner. I want to see the code where it actually takes the X and Y coordinates from the wacom driver and use them to draw the mouse pointer on the lcd.

Clearly, something in the code doesn't take into account of the screen rotation.

PS. I did a make clean so I can build an eng build so I can get some logcat messages. It will take 8 hours to compile. I'm also looking at the wacom driver code to see where I can put in some print statements with respect to the screen orientation.
The link should be OK now. With regards to the module/program for the S Pen, I have not installed anything in addition to get this to work, just the changes made to the kernel so I am not sure which application actually draws the mouse pointer on the screen. Apologies I can't be much help on this one.
 

retiredtab

Senior Member
Nov 16, 2017
345
86
28
@aala27, can you post your code on github for Android 10? I would like to try your build since the virsys build ends up in a boot loop. Your RR build boots fine on my tablet.

That way, with the source code, I can examine your code for the external audio to help you fix it. No rush. I'm still woking on 16.0 (Pie). For some reason, my build is boot looping after a make clean. I must have done something wrong?

Thanks.
 

retiredtab

Senior Member
Nov 16, 2017
345
86
28
And provide the roomservice.xml as well so I can try to replicate your build using the same repos.

Thank you so much so far for contributions. I may not be able to solve this spen problem, but I will give it a try as time permits.
 

retiredtab

Senior Member
Nov 16, 2017
345
86
28
For those wondering about the Oct security patch, I have been trying to make a build for the last 36 hours with no success. The resulting build ends up with a boot loop.

I have tried everything including formatting my drive in case there was some corruption, but a fresh repo sync and the exact same roomservice.xml, I end up with a bootloop.

I will try again in the next couple of weeks. Maybe one of the changes made to 16.0 causing the boot loop will get reverted?

I will research the spen code as time permits, but right now, I can't do much testing as even the spen kernel that aala27 posted results in a bootloop. It's likely a 16.0 code change somewhere causing the problem as I started from fresh with a disk format.

In case anyone is wondering, I'm looking at

frameworks/native/services/inputflinger/inputreader.cpp

for clues about the spen functionality and where possibly the code does the rotation.

So just a reminder that the SM-T550 and most of the Samsung A family from 2016 has no maintainer so the code is in rough shape. The "stock" code from the msm8916 repo, while it compiles, results in a bootloop. Virsys made changes so he could boot 9.0 and 10.0. This rom is based on his 9.0 code. I tried his 10.0 code, but it ends up in a bootloop.

That's the latest update.
 

aala27

Member
Nov 12, 2015
31
8
8
@aala27, can you post your code on github for Android 10? I would like to try your build since the virsys build ends up in a boot loop. Your RR build boots fine on my tablet.

That way, with the source code, I can examine your code for the external audio to help you fix it. No rush. I'm still woking on 16.0 (Pie). For some reason, my build is boot looping after a make clean. I must have done something wrong?

Thanks.
@retiredtab, I have upload my code to my github. It is mainly the Galaxy-MSM8916 code with some minor changes which made it boot. I commented out everything associated with the vibrator in the msm8916-common repo and commented out a couple of vendor files. I am very new to github so I hope what I have uploaded is sufficient.

https://github.com/aala27

I will upload my RR pie code soon, hopefully this helps you in your Lineage build as RR is a Lineage based rom.
 

retiredtab

Senior Member
Nov 16, 2017
345
86
28
@aala27, Thank you for uploading 10.0! Can you upload your kernel for 10.0 as well. Your github has the kernel for 9.0 code only right now.

Again, no rush, I'm going to be out of town for about a week. I'm back on Oct 20th.
 
Last edited:

retiredtab

Senior Member
Nov 16, 2017
345
86
28
See link to RR 10 rom. It seems as through everything works ok except for the audio coming from the loudspeakers.
I found the problem of your external audio in RR 10. I noticed this right away because I spent a lot of weeks troubleshooting the SM-T350 external audio problems so I recognized the traces and knew what was likely wrong.

In the non working audio, I saw acdb_dev_id 14. I knew from troubleshooting the SM-T350 that the speaker is id 15, not 14.

It's a simple fix and I implemented by placing the files into the correct directory using twrp. I have sound with your RR 10 rom without rebuilding from source code.

You need these 2 files audio_platform_info.xml and mixer_paths.xml from

https://github.com/VirsysElectron/a...mmit/03a37d13085f7109bd80263b759c3e7aa69fdde0

Then copy them into the /vendor/etc directory using code like below

Code:
PRODUCT_COPY_FILES += \
	$(LOCAL_PATH)/configs/audio/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml \
	$(LOCAL_PATH)/configs/audio/mixer_paths.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths.xml
The audio_platform_info.xml is missing in your RR 10 build so it defaults to 14 instead of 15. The audio_platform_info.xml defines it as 15 as you can see in the working external audio logcat.

You also need to change your mixer_paths.xml file. It has a definition for speaker-amp which is only applicable to the SM-T350 because of its proprietary amplifier which the 550 doesn't have. The definition should just be "speaker". You can see this in the logcats below.

=== logcat not working external audio ===

10-10 08:31:12.851 357 1829 D hardware_info: hw_info_append_hw_type : device_name = speaker
10-10 08:31:12.851 357 1829 D audio_hw_primary: enable_snd_device: snd_device(2: speaker)
10-10 08:31:12.851 357 1829 D audio_route: Apply path: speaker
10-10 08:31:12.852 357 1829 W audio_hw_utils: audio_extn_utils_update_stream_app_type_cfg: App type could not be selected. Falling back to default
10-10 08:31:12.852 357 1829 I audio_hw_primary: select_devices Selected apptype: 69936
10-10 08:31:12.852 357 1829 I audio_hw_utils: audio_extn_utils_send_app_type_cfg app_type 69936, acdb_dev_id 14, sample_rate 48000
10-10 08:31:12.852 357 1829 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 14, path = 0

=== logcat working external audio ===

10-13 15:18:28.739 308 4250 D hardware_info: hw_info_append_hw_type : device_name = speaker
10-13 15:18:28.739 308 4250 D audio_hw_primary: enable_snd_device: snd_device(2: speaker)
10-13 15:18:28.765 308 4250 D audio_route: Apply path: speaker
10-13 15:18:28.769 308 4250 W audio_hw_utils: audio_extn_utils_update_stream_app_type_cfg: App type could not be selected. Falling back to default
10-13 15:18:28.769 308 4250 I audio_hw_primary: select_devices Selected apptype: 69936
10-13 15:18:28.769 308 4250 V audio_hw_primary: enable_audio_route: enter: usecase(0)
10-13 15:18:28.769 308 4250 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 15, path = 0
 
Last edited:

aala27

Member
Nov 12, 2015
31
8
8
I found the problem of your external audio in RR 10. I noticed this right away because I spent a lot of weeks troubleshooting the SM-T350 external audio problems so I recognized the traces and knew what was likely wrong.

In the non working audio, I saw acdb_dev_id 14. I knew from troubleshooting the SM-T350 that the speaker is id 15, not 14.

It's a simple fix and I implemented by placing the files into the correct directory using twrp. I have sound with your RR 10 rom without rebuilding from source code.

You need these 2 files audio_platform_info.xml and mixer_paths.xml from

https://github.com/VirsysElectron/a...mmit/03a37d13085f7109bd80263b759c3e7aa69fdde0

Then copy them into the /vendor/etc directory using code like below

Code:
PRODUCT_COPY_FILES += \
	$(LOCAL_PATH)/configs/audio/audio_platform_info.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_platform_info.xml \
	$(LOCAL_PATH)/configs/audio/mixer_paths.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths.xml
The audio_platform_info.xml is missing in your RR 10 build so it defaults to 14 instead of 15. The audio_platform_info.xml defines it as 15 as you can see in the working external audio logcat.

You also need to change your mixer_paths.xml file. It has a definition for speaker-amp which is only applicable to the SM-T350 because of its proprietary amplifier which the 550 doesn't have. The definition should just be "speaker". You can see this in the logcats below.

=== logcat not working external audio ===

10-10 08:31:12.851 357 1829 D hardware_info: hw_info_append_hw_type : device_name = speaker
10-10 08:31:12.851 357 1829 D audio_hw_primary: enable_snd_device: snd_device(2: speaker)
10-10 08:31:12.851 357 1829 D audio_route: Apply path: speaker
10-10 08:31:12.852 357 1829 W audio_hw_utils: audio_extn_utils_update_stream_app_type_cfg: App type could not be selected. Falling back to default
10-10 08:31:12.852 357 1829 I audio_hw_primary: select_devices Selected apptype: 69936
10-10 08:31:12.852 357 1829 I audio_hw_utils: audio_extn_utils_send_app_type_cfg app_type 69936, acdb_dev_id 14, sample_rate 48000
10-10 08:31:12.852 357 1829 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 14, path = 0

=== logcat working external audio ===

10-13 15:18:28.739 308 4250 D hardware_info: hw_info_append_hw_type : device_name = speaker
10-13 15:18:28.739 308 4250 D audio_hw_primary: enable_snd_device: snd_device(2: speaker)
10-13 15:18:28.765 308 4250 D audio_route: Apply path: speaker
10-13 15:18:28.769 308 4250 W audio_hw_utils: audio_extn_utils_update_stream_app_type_cfg: App type could not be selected. Falling back to default
10-13 15:18:28.769 308 4250 I audio_hw_primary: select_devices Selected apptype: 69936
10-13 15:18:28.769 308 4250 V audio_hw_primary: enable_audio_route: enter: usecase(0)
10-13 15:18:28.769 308 4250 D ACDB-LOADER: ACDB -> send_audio_cal, acdb_id = 15, path = 0


Thank you very much for the fix. Have tried it and can confirm that this works.

I have uploaded the Android 10 kernel code for this device. The RR 9 code is also up on my github as requested.Like the Android 10 code, this is mainly based on the Galaxy MSM8916 code with fixes found from Virsys' T550 code. Be aware that I have not implemented the DRM fix found in the following link to my code.

https://forum.xda-developers.com/showpost.php?p=82393631&postcount=268

The files I used for the fix are found on this post:

https://forum.xda-developers.com/showpost.php?p=82519161&postcount=270

Hope this helps.
 

retiredtab

Senior Member
Nov 16, 2017
345
86
28
Like the Android 10 code, this is mainly based on the Galaxy MSM8916 code with fixes found from Virsys' T550 code.

@aala27, for getting the spen to work, was it really just one line to add to the p550_defconfig?

Namely,

#Wacom
CONFIG_INPUT_WACOM=y

Or are there changes in the common_defconfig that I need to pickup?

I'm just trying to see what changes were made to get the spen to appear because it will help troubleshooting the 90, 180, 270 problem. Thanks.
 

retiredtab

Senior Member
Nov 16, 2017
345
86
28
logcat below of tablet in portrait mode, then rotate to 90, orientation - 0 (0), 1 (90), 2 (180), 3 (270)
Line 3681 of InputReader.cpp outputs the log below so I'm in the right module/program.

I InputReader: Reconfiguring input devices. changes=0x00000004
I InputReader: Device reconfigured: id=6, name='input_mt_wrapper', size 768x1024, orientation 0, mode 4, display id 0
I InputReader: Device reconfigured: id=7, name='sec_touchscreen', size 768x1024, orientation 1, mode 1, display id 0
I InputReader: Device reconfigured: id=10, name='sec_e-pen', size 768x1024, orientation 0, mode 4, display id 0

As you can see, sec_touchscreen knows about the 90 rotation (orientation 1) and touchscreen works properly, but not the sec_e-pen driver. A simple hack would be to make the orientation of sec_e-pen = sec_touchscreen everytime there is a rotation change, but where in the code? However, I don't know if that's enough to make the spen work properly in 90, 180 and 270 mode.

Need to look around the code some more and see if the above hack is the correct way to do it or not.
 
Last edited:

retiredtab

Senior Member
Nov 16, 2017
345
86
28
Spen working in 0, 90, 180, 270 now

I figured it out the s-pen 90, 180, 270 problem!!! :)

After reading

https://source.android.com/devices/input/input-device-configuration-files

and looking at the example, I remembered seeing the wacom driver file, table_msm8974.h, had code that said

char *tuning_model = "N7100";

The N7100 is the Samsung Galaxy Note II which has a spen.

The driver name for the spen is sec_e-pen as shown previously in the logcat.

So I searched github for n7100 sec_e-pen.idc and found

https://raw.githubusercontent.com/i...7100/proprietary/system/usr/idc/sec_e-pen.idc

I copied that file onto the tablet

/system/vendor/usr/idc/sec_e-pen.idc

using twrp to mount system as rw.

So for code, I suggest something like

Code:
# sec_e-pen.idc driver needed so tablet knows its orientation aware and can work in 90, 180 and 270 mode.
PRODUCT_COPY_FILES += \
    vendor/samsung/gt5note10wifi/proprietary/sec_e-pen.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/sec_e-pen.idc
in device/samsung/gt5note10wifi/device.mk

The contents of sec_e-pen.idc are two lines

Code:
touch.deviceType = pointer
touch.orientationAware = 1
Without this sec_e-pen.idc, the code defaults to touch.orientationAware=0 which is why the spen didn't understand the 90, 180 and 270 rotation change.

So again, without recompiling your RR 10 code, I put sec_e-pen.idc into /system/vendor/usr/idc directory and RR 10 works properly at 0, 90, 180 and 270 with spen.

I didn't test your RR 9.0 build with the above sec_e-pen.idc, but it should work.

So you should have a fully working RR 10 build with external audio and spen fixed now for people to try after making the suggested changes.

I will make a lineageos 17.1 build sometime after I get back on Oct 20 and test it for functionality, reliability and stability. If it's stable and functional, I will release that build.

=== logcat of it working with sec_e-pen.idc. Note orientation of sec_e-pen now matches sec_touchscreen ===
=== rotate 90 ===

InputReader: Reconfiguring input devices. changes=0x00000004
InputReader: Device reconfigured: id=3, name='input_mt_wrapper', size 768x1024, orientation 0, mode 4, display id 0
I InputReader: Device reconfigured: id=8, name='sec_touchscreen', size 768x1024, orientation 1, mode 1, display id 0
I InputReader: Device reconfigured: id=10, name='sec_e-pen', size 768x1024, orientation 1, mode 4, display id 0

=== rotate 180 ===

InputReader: Reconfiguring input devices. changes=0x00000004
InputReader: Device reconfigured: id=3, name='input_mt_wrapper', size 768x1024, orientation 0, mode 4, display id 0
InputReader: Device reconfigured: id=8, name='sec_touchscreen', size 768x1024, orientation 2, mode 1, display id 0
InputReader: Device reconfigured: id=10, name='sec_e-pen', size 768x1024, orientation 2, mode 4, display id 0

=== rotate 270 ===

InputReader: Reconfiguring input devices. changes=0x00000004
InputReader: Device reconfigured: id=3, name='input_mt_wrapper', size 768x1024, orientation 0, mode 4, display id 0
InputReader: Device reconfigured: id=8, name='sec_touchscreen', size 768x1024, orientation 3, mode 1, display id 0
InputReader: Device reconfigured: id=10, name='sec_e-pen', size 768x1024, orientation 3, mode 4, display id 0

BTW, input_mt_wrapper, which I'm not sure what it does, would probably require a similar idc file created if we needed that to work in 90, 180 and 270.
 

retiredtab

Senior Member
Nov 16, 2017
345
86
28
I built a 17.1 image, but it's randomly reboots anywhere from 5 to 35 minutes of usage. And this isn't even using the s-pen, all it is doing is playing a youtube video using newpipe and youtube vanced. I'm not even touching the tablet. Unfortunately, when it crashes, there are no logcat messages. With the exact same 2 apps, they run fine on other non P550 tablets.

I tried building a rom with the s-pen driver and without. The s-pen driver works in 0, 90, 180, 270, but the builds are unstable. The no s-pen driver is also unstable. I also seen the tablet reboot when connected via usb so it is just not playing videos.

I also tried aala27's RR 10 build and it also randomly reboots playing videos.

I don't know where the problem lies without a logcat. I suspect it's in the kernel changes with possibly one of the parameters in common_defconfig?

I don't know what changes aala27 did so I will have to wait until he responds.

PS. I also tried building 16.0 today, but again the build boot loops as before. So right now, I have no stable working image with s-pen support. I'm not releasing these builds until the random reboots are fixed, which may be never.
 

aala27

Member
Nov 12, 2015
31
8
8
I built a 17.1 image, but it's randomly reboots anywhere from 5 to 35 minutes of usage. And this isn't even using the s-pen, all it is doing is playing a youtube video using newpipe and youtube vanced. I'm not even touching the tablet. Unfortunately, when it crashes, there are no logcat messages. With the exact same 2 apps, they run fine on other non P550 tablets.

I tried building a rom with the s-pen driver and without. The s-pen driver works in 0, 90, 180, 270, but the builds are unstable. The no s-pen driver is also unstable. I also seen the tablet reboot when connected via usb so it is just not playing videos.

I also tried aala27's RR 10 build and it also randomly reboots playing videos.

I don't know where the problem lies without a logcat. I suspect it's in the kernel changes with possibly one of the parameters in common_defconfig?

I don't know what changes aala27 did so I will have to wait until he responds.

PS. I also tried building 16.0 today, but again the build boot loops as before. So right now, I have no stable working image with s-pen support. I'm not releasing these builds until the random reboots are fixed, which may be never.
Hey @retiredtab,

My apologies for taking so long to respond. I do not experience reboots on the roms that I have created. Not sure what the issue seems to be there. Are you also experiencing reboots on the RR 9.0 rom as well?
 

retiredtab

Senior Member
Nov 16, 2017
345
86
28
Hey [MENTION=8726605]My apologies for taking so long to respond. I do not experience reboots on the roms that I have created.
With the exact same P550, same newpipe and youtube vanced, same videos, on my 16.0 build, I get no random reboots at all.

I will await your new RR 10 build with all the bug fixes I suggested for s-pen, external audio and GPS as per my PM to you.

I'll keep trying to troubleshoot my 17.1 build, but if your new RR 10 works fine, then I won't bother with a 17.1 build. I don't care which rom as long as one of them works.
 

retiredtab

Senior Member
Nov 16, 2017
345
86
28
Hi.
I'm using
twrp-3.4.0-0-gt510wifi.img.tar mentioned on original post.
Yes, i have sm-p550
If you can wait, aala27 might have a working RR 10 build with s-pen.

The twrp 7 message can be removed by editing the zip file to remove the asserts. However, I suggest waiting for the RR 10 build.

Personally, I'm still having problems with RR 10, but aala27 says it's rock solid for him so it could be just my tablet?
 

damismtz

New member
Sep 16, 2020
1
0
1
It is an excellent ROM for tab A sm_p550 I could finally prove it the truth has no bugs.
The only disadvantage is vantages for people who occupy the functionalities of the S pen.