PiTFT Capacitive Touch Screen - Remote Desktop Support

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
azrith
 
Posts: 8
Joined: Fri May 10, 2013 10:28 pm

PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by azrith »

Hi,

I recently received my PiTFT capacitive touch screen and needed some help. I don't think this should be difficult but I followed the Adafruit guide and noticed that when I run startx to output to the PiTFT I can no longer remote desktop to the device using X11VNC. SSH still works but I was hoping to continue using X11VNC for remote desktop support while displaying the desktop on the PiTFT. Any suggestions on how to support this?

Also, what's the recommended method to run startx on boot so that it automatically outputs to the PiTFT without having to run startx.

Thanks for the help and it's looking good! All going well I'll be using this in a custom thermostat project.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by adafruit_support_rick »

I use tightvnc, and I can run X on the PiTFT and via VNC at the same time. Not sure why you're having trouble.

User avatar
FlaPohl
 
Posts: 4
Joined: Wed Aug 20, 2014 8:14 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by FlaPohl »

I'm too having trouble.
Actually I've gone this far:
sudo modprobe spi-bcm2708
sudo modprobe fbtft_device name=adafruitts rotate=90 export FRAMEBUFFER=/dev/fb1
startx

As soon as I enter the startx I lose all icons on it but I can still see
the desktop and it's dock, mouse cursor moves but clicking is not possible.
I didn't want to make the module auto-loading definitive because I'm afraid
of losing my VNC connection forever.

Thank you

azrith
 
Posts: 8
Joined: Fri May 10, 2013 10:28 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by azrith »

I've been trying to find more time to troubleshoot this but am hoping I can dig in on the weekend.
I did do some tweaking and am able to connect via X11VNC showing the display but had no controls. I tried a few other things related to resolution thinking that there was some sort of conflict with X11VNC trying to run at an unsupported resolution being that X11 shares the primary 0 session. I then installed tightvncserver and removed my autostart for X11 but have apparently hosed something.

I'm no Linux expert but in the past I ran into an issue with tightvncserver where it didn't seem to allow me to share the 0 session. The issue with this for me was that I have some custom python apps that I wanted to start on boot and I couldn't figure out a way to get the app to autostart without it running in each session. That resulted in the same app running in each session which doesn't work well for automation type stuff.

If anyone else figures this out please post and I'll attempt to post anything I figure out once I have more time.
Thx

azrith
 
Posts: 8
Joined: Fri May 10, 2013 10:28 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by azrith »

Scratch the waiting till the weekend. Here's some updates:
1. Tightvncserver works jut fine. I believe the reason is that it's not sharing the 0 session but typically running on a new session 1 (or anything above that you set it to).
2. Running startx seems to "take over" the 0 session. (HDMI output goes away) I still have direct control with mouse and keyboard directly connected
3. I think the issue with X11VNC comes back to it sharing the primary 0 session and if there's a way to keep the HDMI output working the same time as the TFT then perhaps X11 will be "fixed".

I'm fine using tightvncserver to get around this so long as I can find a way to only load an application in one session on boot. Anyone have any ideas on how to do this so I don't have my python app running in each session?

Thanks and I will play more with X11VNC/Tightvnc this weekend.

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by tdicola »

Good to hear tightvncserver seems to work. For making sure something runs at start up you might look at using upstart on the Raspberry Pi. Upstart lets you configure a script / executable to run as a service so it automatically starts on boot, runs as a certain user, etc. The nice thing is it's not tied to your bash profile so it shouldn't have multiple instances running as more sessions are created.

FlaPohl, hrm it's tough to tell what the issue might be but what VNC server are you using? If you use tightvncserver does it help make things more usable?

User avatar
FlaPohl
 
Posts: 4
Joined: Wed Aug 20, 2014 8:14 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by FlaPohl »

I'm currently using x11vnc Server, haven't tried tightVNC Server yet.
I'll see what happens with tightVNC, I'll let you know

Thanks

User avatar
FlaPohl
 
Posts: 4
Joined: Wed Aug 20, 2014 8:14 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by FlaPohl »

How do I remove X11VNC autostart?
And how do I run TightVNC at startup?

Thank you

azrith
 
Posts: 8
Joined: Fri May 10, 2013 10:28 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by azrith »

Hi FlaPohl

I've discovered there's many ways to autostart stuff in Linux. You'll have to figure out how you went about setting up X11 but I used this guide from Adafruit myself.
https://learn.adafruit.com/adafruit-ras ... at-startup
I've found it works the easiest. You do need to be careful as if you use it for other stuff it will load in each session. That's part of the reason I switched to X11 as it shares the main session preventing this from happening. I'm going to try what tdicola posted regarding upstart for my python app to see if that will only load it once, keeping my fingers crossed :)

Good luck

User avatar
FlaPohl
 
Posts: 4
Joined: Wed Aug 20, 2014 8:14 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by FlaPohl »

Hi Azrith,

I've found it it's there. home/pi/.config/autostart

Thank you so much!

azrith
 
Posts: 8
Joined: Fri May 10, 2013 10:28 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by azrith »

tdicola,

Would it be possible to get an example on using upstart to autostart Midori in a specific session? I found another guide on how to get the system to boot directly to the piTFT and have TightVNCserver loading as described above. I just need to figure out how to get my python tkinter app to auto load also into the specific session that loads to the piTFT. My app needs the GUI to be up to load. My plan is to have a gui python app auto loading to the pitft screen for thermostat controls to display the temperature and provide override buttons. I need the auto load function so that if power is lost to the unit, it automatically restarts once power is restored.

Thanks!

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by tdicola »

No problem, and sorry it's actually 'systemd' that you want to use. There are two big sort of competing startup systems in the Linux world and it turns out the Pi's operating system uses systemd instead of upstart. Check out this guide for an example of configuring systemd to update time with an RTC: https://learn.adafruit.com/adding-a-rea ... t-rtc-time

The part you're interested in is creating the /lib/systemd/system/rtc-ds1307.service file, it's a simple example of running a script at boot up automatically. You can modify this .service file to run any script though, for example lets say you have a python script located at /home/pi/myapp/myscript.py. You'd want to create a .service file under /lib/systemd/system/myscript.service that looks like:

Code: Select all

[Unit]
Description=My Python Script
 
[Service]
Type=simple
WorkingDirectory=/home/pi/myapp
ExecStart=/usr/bin/python /home/pi/myapp/myscript.py
SyslogIdentifier=myapp
 
[Install]
WantedBy=multi-user.target
The important bit is the ExecStart= line, that tells systemd what application to run (/usr/bin/python, the python interpreter) and passes in as an argument the full path to your python script.

Another important and somewhat cryptic line is the WantedBy=multi-user.target line, this basically says to start this script after the boot up process has gotten to a point that a user could log in. This is more often then not what you want since by the time a user can log in a lot of other parts of the boot process have finished and scripts can start running.

After creating that file you then need to run this command to enable the script:

Code: Select all

systemctl enable myscript.service
Then try running this to start the service and test it out:

Code: Select all

systemctl start myscript.service
You can stop it by calling 'systemctl stop myscript.service' (without quotes), and you can get the current status (like if its running, if it failed, etc.) by running 'systemctl status myscript.service'. Give that example service a shot and let me know if you run into issue.

azrith
 
Posts: 8
Joined: Fri May 10, 2013 10:28 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by azrith »

Thanks tidcola,

I tried that but am getting the message "bash: systemctl: command not found". I then installed systemd "sudo apt-get install systemd". That took care of that error but here's what I got next.
Image
Any suggestions?

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by tdicola »

Oh interesting, for some reason it looks like Raspbian hasn't fully switched to systemd like other Debian-based distributions. Here's a good post with a few details of what to do: http://blog.higgsboson.tk/2012/09/19/sy ... -raspbian/

It looks like the missing step is to edit the /boot/cmdline.txt file and add the init=/bin/systemd configuration to the end of the line in the file. The blog post shows what the line should look like after its edited. Then reboot and try the systemctl command to enable again.

azrith
 
Posts: 8
Joined: Fri May 10, 2013 10:28 pm

Re: PiTFT Capacitive Touch Screen - Remote Desktop Support

Post by azrith »

Strange, that hosed things up for me. It shows systemd fail during bootup and it hangs showing me a blinking cursor and black screen.
No big deal, I'll just disable tightvncserver when things are fully functional so that I can simply use the config/autostart desktop entry method to load things without getting two versions of it running. Maybe if anyone on your end gets board you guys can figure out what's up with X11VNC.

Thanks for the help and have a good weekend.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”