[How-to] auto-switch to 1080p on slimport, using tasker

Search This thread

cpanos

Senior Member
Nov 17, 2012
406
324
Athens
cgi.di.uoa.gr
Both the nexus 4 and the nexus 7 (2013) support slimport, which is very useful for mirroring the device to a big screen. However, neither device uses the standard 16:9 (1080p) aspect ratio. As a result, you end up with some cropping on a 1080p TV. For the nexus 4 it is even worse, since it outputs 768p upscaled to the TV's resolution.

However, the flexibility of android allows us to manually change the native resolution. In a console, we can type the command:

wm size 1080x1920

and the resolution will change. In the device screen the new resolution will look odd, however you now have true 1080p on the TV. To get back to the default resolution you type:

wm size reset

This solution works, but it is not very convenient. So I made two profiles for tasker, that automatically change the device resolution upon the connection of an HDMI cable and reset it when the cable is disconnected, thus automating the whole process.

I 'm attaching a screenshot of the two profiles, as well as a zip file so you can extract and import them in tasker.

In summary,
- you need root
- you need a ppi setting lower than 288 otherwise the navbar disappears

the HDMI plugged profile
- reduces the device brightness to minimize battery consumption
- increases volume
- sets resolution to 1080p
- enables WiFi
- sets display timeout to 10 hours
- activates display rotation

the HDMI un-plugged profile
- sets auto brightness back on
- resets screen resolution
- sets display timeout to 1min

These are optional settings that I found useful to automate, but they are all optional, and you can tweak them once you imported the profile to tasker.

I hope you find this useful!!! :good:

UPDATE: Your device must be set to a ppi lower than 288. I am using 286 myself. To change your ppi:
Open the build.prop file from /system/build.prop
using a text editor/buildprop editor app, change the value of ro.sf.lcd_density=286
save the file, reboot
 

Attachments

  • HDMI_plugged.png
    HDMI_plugged.png
    42.5 KB · Views: 2,783
  • HDMI_unplugged.png
    HDMI_unplugged.png
    28.4 KB · Views: 2,625
  • auto_slimport_tasker.zip
    1.1 KB · Views: 984
Last edited:

petanque

Member
Sep 2, 2012
22
8
dont work anymore

Thanks for sharing.. It worked for me in a long time but not it wont change anymore..

Do you know what i could get a conflict? have just installed apps and then last night i wont change resolution when i connect slimport and i cant seem to fix it
 

Q8-V08

Senior Member
Oct 30, 2013
143
21
Thanks for this, I tried testing the wm size reset command in terminal emulator but for some reason the navbar icons disappear and only come back when I Power Off and restart the device again, I'm on 4.4.4 if it makes any difference.
 

cpanos

Senior Member
Nov 17, 2012
406
324
Athens
cgi.di.uoa.gr
Thanks for sharing.. It worked for me in a long time but not it wont change anymore..

Do you know what i could get a conflict? have just installed apps and then last night i wont change resolution when i connect slimport and i cant seem to fix it

Make sure tasker is still active and root is working fine.




Thanks for this, I tried testing the wm size reset command in terminal emulator but for some reason the navbar icons disappear and only come back when I Power Off and restart the device again, I'm on 4.4.4 if it makes any difference.

I don't have that issue, however I'm also running at a lower PPI than the default. I'll try it out at stock PPI and see if I have any issues with the navbar. What is your setup? ROM, xposed, etc.

Sent from my Nexus 4 using Tapatalk
 

Q8-V08

Senior Member
Oct 30, 2013
143
21
Make sure tasker is still active and root is working fine.






I don't have that issue, however I'm also running at a lower PPI than the default. I'll try it out at stock PPI and see if I have any issues with the navbar. What is your setup? ROM, xposed, etc.

Sent from my Nexus 4 using Tapatalk

Stock rooted, qc optimized bionic+dalvik, latest dev preview gpu driver.
For the navbar to showup on my 40" tv in 1920x1080 I have to set the ppi to 288, 289+ it's hidden.
Using
https://www.sven.de/dpi/
http://pixeldensitycalculator.com
http://isthisretina.com
all say my ppi should be 55.07 though.
 

cpanos

Senior Member
Nov 17, 2012
406
324
Athens
cgi.di.uoa.gr
Stock rooted, qc optimized bionic+dalvik, latest dev preview gpu driver.
For the navbar to showup on my 40" tv in 1920x1080 I have to set the ppi to 288, 289+ it's hidden.
Using
https://www.sven.de/dpi/
http://pixeldensitycalculator.com
http://isthisretina.com
all say my ppi should be 55.07 though.

Thanks, I'm running on a ppi of 286 and everything works fine here as well. I will update the op to let people know that their ppi must be lower than 288 and add instructions on how to set that.

Im not sure if I can have the ppi change with tasker, however, people might be using a lower ppi permanently so having tasker switch it back to the default would suck.
 
  • Like
Reactions: Nostrodamus
Bump, I would like to know this as well!! Tia.

Sent from my Nexus 7 using Tapatalk
I tested it yesterday. I changed size with command from OP, but there was problem with navbar, I lost navbar in landscape mode, it appears only in portrait mode. When I played video in MX Player I could not go back...
This is maybe because of ppi, which I did not change.

Sent from my tablet./Odoslané z môjho tabletu.
 

cpanos

Senior Member
Nov 17, 2012
406
324
Athens
cgi.di.uoa.gr
Hi, thanks for this profiles... I don't have HDMI, but will this wm command work also with ChromeCast?

Bump, I would like to know this as well!! Tia.

Sent from my Nexus 7 using Tapatalk

Interesting. You mean when mirroring the device to a chromecast? I dont see why this should not work, I will test it and report back, on vacations now :cowboy:

I tested it yesterday. I changed size with command from OP, but there was problem with navbar, I lost navbar in landscape mode, it appears only in portrait mode. When I played video in MX Player I could not go back...
This is maybe because of ppi, which I did not change.

Sent from my tablet./Odoslané z môjho tabletu.
Yes, you lost the navbar because of your ppi setting. Either change your ppi to anything lower than 288 or use a pie navbar app like LMT (havent tried that though).

I havent found a way to change ppi without the need to reboot the device so I can add it to the tasker profile.
 

cpanos

Senior Member
Nov 17, 2012
406
324
Athens
cgi.di.uoa.gr
Hi, thanks for this profiles... I don't have HDMI, but will this wm command work also with ChromeCast?
Bump, I would like to know this as well!! Tia.

The wm command works perfectly with a Chromecast and you get the right resolution when mirroring. However, tasker cannot pick up when you do a screen cast (for now) so there is no way to automate the process (as far as I can tell).

Sent from my Nexus 4 using Tapatalk
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 10
    Both the nexus 4 and the nexus 7 (2013) support slimport, which is very useful for mirroring the device to a big screen. However, neither device uses the standard 16:9 (1080p) aspect ratio. As a result, you end up with some cropping on a 1080p TV. For the nexus 4 it is even worse, since it outputs 768p upscaled to the TV's resolution.

    However, the flexibility of android allows us to manually change the native resolution. In a console, we can type the command:

    wm size 1080x1920

    and the resolution will change. In the device screen the new resolution will look odd, however you now have true 1080p on the TV. To get back to the default resolution you type:

    wm size reset

    This solution works, but it is not very convenient. So I made two profiles for tasker, that automatically change the device resolution upon the connection of an HDMI cable and reset it when the cable is disconnected, thus automating the whole process.

    I 'm attaching a screenshot of the two profiles, as well as a zip file so you can extract and import them in tasker.

    In summary,
    - you need root
    - you need a ppi setting lower than 288 otherwise the navbar disappears

    the HDMI plugged profile
    - reduces the device brightness to minimize battery consumption
    - increases volume
    - sets resolution to 1080p
    - enables WiFi
    - sets display timeout to 10 hours
    - activates display rotation

    the HDMI un-plugged profile
    - sets auto brightness back on
    - resets screen resolution
    - sets display timeout to 1min

    These are optional settings that I found useful to automate, but they are all optional, and you can tweak them once you imported the profile to tasker.

    I hope you find this useful!!! :good:

    UPDATE: Your device must be set to a ppi lower than 288. I am using 286 myself. To change your ppi:
    Open the build.prop file from /system/build.prop
    using a text editor/buildprop editor app, change the value of ro.sf.lcd_density=286
    save the file, reboot
    2
    Make sure tasker is still active and root is working fine.






    I don't have that issue, however I'm also running at a lower PPI than the default. I'll try it out at stock PPI and see if I have any issues with the navbar. What is your setup? ROM, xposed, etc.

    Sent from my Nexus 4 using Tapatalk

    Stock rooted, qc optimized bionic+dalvik, latest dev preview gpu driver.
    For the navbar to showup on my 40" tv in 1920x1080 I have to set the ppi to 288, 289+ it's hidden.
    Using
    https://www.sven.de/dpi/
    http://pixeldensitycalculator.com
    http://isthisretina.com
    all say my ppi should be 55.07 though.
    1
    Stock rooted, qc optimized bionic+dalvik, latest dev preview gpu driver.
    For the navbar to showup on my 40" tv in 1920x1080 I have to set the ppi to 288, 289+ it's hidden.
    Using
    https://www.sven.de/dpi/
    http://pixeldensitycalculator.com
    http://isthisretina.com
    all say my ppi should be 55.07 though.

    Thanks, I'm running on a ppi of 286 and everything works fine here as well. I will update the op to let people know that their ppi must be lower than 288 and add instructions on how to set that.

    Im not sure if I can have the ppi change with tasker, however, people might be using a lower ppi permanently so having tasker switch it back to the default would suck.
    1
    Hi, thanks for this profiles... I don't have HDMI, but will this wm command work also with ChromeCast?