How to rotate sceen from kernel/console in android ? - console

I am trying to rotate screen (whole fb) from kernel. Due to some hardware changes my phone screen is coming in inverting mode. Where can I change in kernel for changing default screen orientation

You can rotate screen from kernel/console by
"service call window XX i32 X"
Ex:
service call window 61 i32 0 //rotate to normal
service call window 61 i32 1 //rotate clockwise
The 61 is on my device only, you should find out what is yours.
You can also rotate from PC by adb
Ex:
adb shell service call window 61 i32 0

Related

Qt: Why DPI decrease on increasing Scaling from OS

I have a Qt application and I need to adapt the application (zoom-in/zoom-out) as the scaling changes from the OS in Display Settings.
I have read from Internet that:
The standard DPI settings are 100% (96 DPI), 125% (120 DPI), and 150%
(144 DPI)
But, I am getting below DPI values when logged from the Qt application:
Scale - Physical DPI X - Physical DPI Y
100% - 158, 159
125% - 158, 159
150% - 79, 79
175% - 79, 79
So, as per the above values, the application text size has no difference for the 100% and 125% scale. Same behavior applies for 150% and 175%.
Below is the Qt code that I used:
#include <QWidget>
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QWidget widget;
qInfo() << "Hello Qt";
int dpiX = widget.physicalDpiX();
int dpiY = widget.physicalDpiY();
qInfo() << dpiX;
qInfo() << dpiY;
Can anyone please guide? What I am trying to achieve is that the Qt application behaves (changes application size/ font size) depending on scaling set in Display Settings of the OS.
I initially suggested using QWindow::devicePixelRatio() in this answer. However, as of Qt 5.12, this does not actually work correctly yet. Qt will avoid fractional scaling ratios due to a bug in Qt's UI scaling implementation. So for 125%, it will still return a 1.0 scaling factor. At 175%, it will return 2.0 instead of 1.75.
So for now, you should fall back to querying the DPI. However, query the logical DPI, not the physical DPI as you are doing now. Replace calls to physicalDpi() functions with calls to logicalDpi() ones. This should give you the standard 96/120/144 DPI reported by Microsoft Windows.
The previous part of the answer below can be used once Qt fixes the bug.
Previous answer, applicable once Qt fixes their scaling bug
Query the scaling ratio directly, don't try to infer it from the DPI. You use QWindow::devicePixelRatio() for this. At 100% scaling, this will return 1.0. At 125% scaling, it will return 1.25. And so on. Since this is a scaling factor, you use it as a multiplier for your sizes.
You should call devicePixelRatio() on the window your widget is currently in. This is because different windows can be on different displays on multi-monitor setups.
The window the widget is in can be obtained with QWidget::windowHandle(). This can return null if the widget is not a window. So you should probably write a small helper function that returns the correct DPR (Device Pixel Ratio) for a widget. It should take a QWidget as argument, and if windowHandle() returns null for the widget, walk up the parent tree, calling windowHandle() on each parent until it finds the first one that doesn't return null. Then return windowHandle()->devicePixelRatio(). This will be the correct DPR to use in that widget.

Raspberry Pi as a RealTime wave plotter

I need to plot a real time signal, 140 points/sec, like an oscilloscope of sorts that traces 7 waves (20 values/sec each). It comes in as a UDP broadcast, this is the visualizer of the traffic. Ideally, this should "flow" to the side, like the output I currently get from the arduino IDE's serial monitor.
I plan to use Qt, which would give me both the networking AND the plotting. I will have an undecorated full-screen modal window (kiosk mode). Output is on an HDMI Touchscreen 1920 x 1080 (but I do not need to use the full surface for the plot, some 40% of it will be used by a GUI). I am thinking I could buffer the values and plot them out only 2-3 times/sec.
Problem is: I have a Raspberry Pi 3 for iron. Do you think a R.Pi can make it or am I just wasting my time with something too undersized for the job?.

Touchscreen calibration for Raspberry Pi in JavaFX is not working

I am using:
Raspberry Pi Model B (Rev 1.0, 256Mb); cat /proc/cpuinfo returns for Revision 0002,
Raspbian Jessie with PIXEL (Version: November 2016, Release date: 2016-11-25, Kernel version: 4.4),
Java is preinstalled with Raspbian Jessie (java -version returns java version "1.8.0_65"),
JavaFX is by Gluon (JavaFX Embedded SDK 8.60.8),
Touchscreen is WAVESHARE 4inch Resistive Touch Screen LCD, HDMI interface, IPS Screen, Designed for Raspberry Pi, link: http://www.waveshare.com/wiki/4inch_HDMI_LCD,
Driver for touchscreen is installed by instructions on link in step 5.,
Touchscreen calibration for JavaFX application is by instructions: https://wiki.openjdk.java.net/display/OpenJFX/Touch+screen+calibration+on+embedded+platforms
Important notes:
Orientation for my touchscreen is set in /boot/config.txt as display_rotate=3 (270 degrees - landscape),
I tryed different combinations for minX, maxX, minY, maxY, flipXY and nothing helped me,
My JavaFX application is simple test application, where only one button is in center: https://i.stack.imgur.com/Q3R02.jpg
Top Left corner should have coordinates 0, 0 (corner at LAN conector),
and Bottom Right corner should have coordinates 800, 480,
axis x should be horizontal, axis y should be vertical,
My problem is that y axis is horizontal (range 0 - 479) and x axis is vertical (range 0 - 799) and flipXY don't work!
Touch on button in center of touchscreen not generate touch event along the length of button!
Note: swapxy=1 in /boot/config.txt don't work also!
Please, help me.
It's an old question, but for me the following combination of JVM parameters works:
-Dmonocle.input.0/0/0/0.minX=0
-Dmonocle.input.0/0/0/0.maxX=480
-Dmonocle.input.0/0/0/0.minY=480
-Dmonocle.input.0/0/0/0.maxY=-320
-Dmonocle.input.0/0/0/0.flipXY=true
In config.txt I specified only display_rotate=3

How to change QCursor(mouse) size in embedded linux ? (don't use QPixmap or QBitmap)

I use Qt 4.8 in embedded linux. I want to change mouse cursor(QCursor) size, it's too small, but in QCursor class there is no function can change the size.
in Qt document: http://qt-project.org/doc/qt-4.8/qcursor.html#QCursor-3
it says here that:
Valid cursor sizes depend on the display hardware (or the underlying window system). We recommend using 32 x 32 cursors, because this size is supported on all platforms. Some platforms also support 16 x 16, 48 x 48, and 64 x 64 cursors.
so my question is: how to change the default cursor(QCursor) size in embedded linux ? I'm searching for answers on the Internet, almost no one mentioned this problem !?
(I know it can use QPixmap or QBitmap to change the cursor icon, but this is not the fundamental way.)
thanks.

why my iphone device and simulator has different screen resolution?

i use itouch 4G has my device and i use simulator-4.2
i will just draw a rectangle as an example. i use Quartz-2d to draw
- (void)drawRect:(CGRect)rect {
// Get a graphics context, saving its state
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);
// Reset the transformation
CGAffineTransform t0 = CGContextGetCTM(context);
t0 = CGAffineTransformInvert(t0);
CGContextConcatCTM(context,t0);
// Draw a green rectangle
CGContextBeginPath(context);
CGContextSetRGBFillColor(context, 0,1,0,1);
CGContextAddRect(context, CGRectMake(0,0,320,480));
CGContextClosePath(context);
CGContextDrawPath(context,kCGPathFill);
CGContextRestoreGState(context);
}
i run it in the simulator, the whole screen becomes green, then i run this on my device, only the quarter of the screen becomes green, in order to make the whole screen green on my device, i have to draw a larger rectangle
CGContextAddRect(context, CGRectMake(0,0,640,960));
seem like my device has twice resolution than the simulator,
how can i fix this?
The Retina display on the iPhone is twice the resolution of the previous generation of phones. Your simulator is probably running using the 'iPhone' device rather than the 'iPhone4' device. You can switch in the Hardware | Device menu.
You can get the current scale of view you're rendering to with
[self.layer contentsScale]
then scale your dimensions accordingly.

Resources