Check if display is powered on - connection

Is there a way to check if display is powered on in linux. I tried xrandr and xset but none of these two give me if any information about monitor power. using xrandr we can identify if the vga cable is connected but not if power is connected. I need this because many of our Lab systems keep lying unused just because some one pulls out the power cable or so.
--
Jatin

Related

Comparison between USB and Mini PCIe Interfaces

I'm deciding between the MiniPCIe and USB accelerators for a home Linux CCTV project. The host has both USB3 and a MiniPCIe socket. The host's physical environment will range from an ambient 20C up to a potential 35C (during the summer).
I'm struggling to determine the pros and cons for each. I have gotten this far, although many are guesses:
USB:
Supports Windows and MacOS as well as Linux
Appears to have greater mindshare/use/community support on the Internet
External so can be placed to optimise heat dissipation
Heatsink
Two manual performance modes, highest requires ambient temp of max 25C
Can use up to 4.5W (900mA # 5V)
Mini PCie:
Cheaper (25%)
Lower power consumption (1.4W for 416 fps)
Automatic thermal throttling via driver
Relies on host system for active cooling
Will maintain max operation at 85C
There's probably many I've missed. In particular I can't determine if there's any limitations on throughput/capacity using USB vs PCIe. If there is no difference, then I suspect the USB form factor is the better option, if only for the mindshare, although the power usage/heat generated may be a concern.
To whittle this down to an actual question: in what cases would the Mini PCIe interace be a preferred option to the USB one?
If you are looking for a plug&play solution, then I definitely suggest the USB Accelerator. Overall, as long as you have the system requirements then it'll always works (maybe with some modifications to the standard linux configs like adding your user to the plugdev group, ...). Then the software for the CCTV is all up to you :)
PCIes sometimes need extra works like adding extra kernel arguments and modules to keep the pcie modules happy. If you are looking to launch a huge product where volumes are expected, then it is worth investigating it since it's cheaper and more compact. However, the power usage is a must for consideration as the USB Accelerator could uses up to 900mA, so that could play a factor.
May I know what host are you trying to attach the accelerators to?

Multiple usb cameras on Raspberry Pi using OpenCV

I would like to connect 2 usb webcams to a RaspberryPI and be able to get at least 1920 x 1080 frames at 10 fps using OpenCV. Has anyone done this and knows if this is possible? I am worried that the PI has only 1 usb bus?? (usb2) and might get a usb bandwidth problem.
Currently I am using an Odroid and it has a usb2 and usb3 bus so I can connect 1 camera to each without any problemo..
What i have found in the past with this is no matter what you select using OpenCV for bandwidth options the cameras try to take up as much bandwidth as they want.
This has led to multiple cameras on a single USB port being a no-no.
That being said, this will depend on your camera and is very likely worth testing. I regularly use HD-3000 Microsoft cameras and they do not like working on the same port, even on my beefy i7 laptop. This is because the limitation is in the USB Host Bandwidth and not processing power etc.
I have had a similar development process to you inthe past though, and selected an Odroid XU4 because it had the multiple USB hosts for the cameras. It also means you have a metric tonne more processing power available and more importantly can buy and use the on-board chip if you want to create a custom electronics design.

Get coordinates from USB 2.0 TouchScreen Monitor under ubuntu.

I have a Touchscreen Panel working under Ubuntu and I need to find out where this device is writing the coordinates when touching the panel.
Buffer? DMA REGISTER? USB REGISTER? Where can I get this information? How to get this information unter linux consol? How getting the physical memory location / buffer adress ?! ...
Anybody has an idea?
in general you can get the coordinates using the evtest tool, that reads input events i.e. in /dev/input/event see How to get Coordinates of Touchscreen Rawdata using Linux <- very good answer
Despite this other ways to get the data depend on your touchscreen (reading/writing /dev/ttySx ,...). Touch screens are in general implemented as USB HID devices or emulating a serial connection
(https://wiki.ubuntu.com/Touchscreen)
Checking for touchscreen connectivity
When encountering a new device, the first order of business is to
determine how the touchscreen is connected to your computer. If the
touchscreen produces no events out of the box, check to see if it's an
USB device or not:
lsusb
USB connection
Check the output for any reference to a touchscreen. If your
touchscreen has an USB interface, and it isn't working, then you may
need to blacklist the usbtouchscreen driver for it to work:
sudo modprobe -r usbtouchscreen
If your touchscreen begins to produce events, then you can permanently
blacklist the usbtouchscreen driver:
echo "blacklist usbtouchscreen" | sudo tee -a
/etc/modprobe.d/blacklist.conf
Some touchscreens might already have good or perfect calibrations,
otherwise you'll need to continue to the calibration section.
Serial connection
If there is no reference to a touchscreen device in your lsusb output,
the connection is most likely through one of your serial ports. The
actual IRQ mapping varies between manufacturers. In the case of
Itronix devices, the default is /dev/ttyS3. A simple way to check for
connections is to check each one for events:
screen /dev/ttyS0
Touch anywhere on your screen to check for any character output. If
nothing happens, quit screen by pressing Ctrl+A and then the \ key
to quit. Continue with /dev/ttyS1, etc. until you get a response. Once
you've determined the device, we can try a few different drivers. In
the case of Itronix (and most other devices using the Touchkit
driver), the correct driver is touchit213.
sudo inputattach --touchit213 /dev/ttyS3
Will work for most touchkit screens. The calibration or one or more
axes may be swapped, but if the calibration is approximate then it's
probably the correct driver. Press Ctrl+C to try a new mode.
inputattach supports any of the following modes, which includes
external touchscreens which may attach through a physical serial port:
--h3600ts -ipaq Ipaq h3600 touchscreend
--elotouch -elo ELO touchscreen, 10-byte mode
--elo4002 -elo6b ELO touchscreen, 6-byte mode
--elo271-140 -elo4b ELO touchscreen, 4-byte mode
--elo261-280 -elo3b ELO Touchscreen, 3-byte mode
--mtouch -mtouch MicroTouch (3M) touchscreen
--touchit213 -t213 Sahara Touch-iT213 Tablet PC
--touchright -tr Touchright serial touchscreen
--touchwin -tw Touchwindow serial touchscreen
--penmount -pm Penmount touchscreen
--fujitsu -fjt Fujitsu serial touchscreen
If your device is built into a laptop, you'll have the best luck with
the mtouch, touchright, touchwin, or touchit213 drivers. Likewise,
non-Elo external touchscreens will most likely use touchit213. If your
device is a tablet with stylus-only input, fujitsu is a popular maker
of embedded tablet devices.
To attach the touchscreen at startup, edit your /etc/rc.local to look
like the following:
/usr/bin/inputattach --daemon --always -t213 /dev/ttyS3 exit 0
Replace -t213 with your appropriate driver and /dev/ttyS3 with the
correct device.
Again, don't worry if the calibration isn't perfect, or if an axis is
inverted or reversed - this will be addressed in the calibration
section.
https://wiki.ubuntu.com/Touchscreen

What exactly determines what’s in the radiotap header when capturing on WLAN?

I’m doing a study project on wifi signal quality. What I want to do is use Raspberry Pi’s to monitor as many metrics as possible on packet level data. I want to do this by putting wifi adapters on monitor mode (using airmon-ng) and than capture the data about the packets using a wireless network protocol analyzer, like tshark.
What I understand from the wireless networks is that you mainly have three parts: a frame part that has the same information independent of what you’re capturing on, which contains things as frame number, frame length and arrival time. (Want to upload images but don't have 10 reputation yet...).
Then the IEEE 802.11 data which contains the necessary stuff for the network to work. When capturing on WLAN this contains the MAC addresses.
And than we have the radiotap header, which contains all kind of information (signal strength db and dbm, noise level, signal quality, TX value, and much more). This one is a bit different, since this information is actually filled or injected by the wifi adapter you use to capture the data with.
In the present flags you can find which values are actually being injected by the wifi adapter. Now my problem is that for my research I really need as much values as possible. I’ve been working for hours but I didn’t succeed in finding a way to capture with anything more than dmb signal strength (if even available). So this is what I tried so far:
The adapters I used so far are the Edimax EW7811UN, the AirPcap Classic, the AirPcap Tx and two similar alfa adapters with Atheros AR9271 chipset. The AR9271 adapters worked out of the box on raspbian (debian for raspberry pi) on the ath9k_htc driver. Putting them on monitor mode and capturing works fine, but only dbm singal strength is given (as in the screenshots above) in the capture. The Edimax was working out of the box on the 8192cu driver, however it clearly doesn’t support monitor mode. I could put it into monitor mode when booting it on the zd1211rw driver but that didn’t even give the dbm signal strength. Strange thing however, is that a friend tried the exact same Edimax adapter and he could capture, and the only difference we could find is that the lsmod says rtl8192cu and not 8192cu. Strangely, forums are saying that 8192cu is the newer version, however this friend had the newest arch linux kernel installed (newer than the raspbian). So I installed Arch Linux on the pi, but still wasn’t able to put the edimax on 8192cu driver in monitor mode. Then I found a package in the aur repos: dkms-8192cu which was supposed to have a patched version. However, after installing it still didn’t work. Also downloading the driver from the realtek website didn’t work. There is some stuff on patching on the aircrack-ng website, but it actually is mentioning injection of frames and doesn’t really look to be what I exactly need.
Than I bought the Airpcap Classic and the Airpcap Tx to see what they could do. First of all, they have zero linux support so that already is a big drawback since l need to use it from the Pi’s. However even in windows the airpcap’s only capture db and dbm noise and signal quality. It does receive some data at dbm noise level, but it’s worthless since it is always at -100 level. I can boot the Airpcap classic and tx have zd1211B chipset so I can boot them on zd1211rw driver but this also gives no dbm signal value or anything else.
So my question is, what exactly determines what’s in the radiotap header? I guess it would be all in the driver, but I need to be exactly sure before I write off every ath9_htc driver based adapter. I’m about to purchase another adapter which runs on carl9170 driver, however I can’t find no guarantee anywhere that it will give me those values. What I did find in the literature is that the madwifi driver gives (or was giving) noise levels, however it is acquired by Atheros so the project stopped and all websites are suggestion just to use ath9k or ath5k drivers. I tried to install it but I failed because it seems to be really outdate software since the project stopped.
It would be of really big help if someone can explain me what exactly determines what’s inside the radiotap headers, and also if someone could share any experience on when they did capture more than only dbm signal strength values from linux.

Can I use the same wifi dongle for internet uplink and as a wireless access point

I have a headless raspberry pi with a wifi dongle and I want to use wifi two ways.
1) To make the rPI a wireless access point when there is no local wifi access point so I can connect to the rPI from my iPhone.
2) When wifi is available use the wifi dongle to do normal connection to the internet.
I think I know how to do each of these individually. It wasn't easy but I now have it connecting to my local wifi at home.
I see references to using hostapd and dnsmasq with wifi to make a local access point but they mostly assume internet connection comes from ethernet.
I'll be studying these in more detail. However I don't even know if the end goal of using the same configuration to fill both needs with one wifi dongle is even possible.
Obviously I can create two sets of config files and a script to swap them as needed but that only works if I have a connection already so I can log in.
If I add a jumper or switch to the rPI GPIO interface I could run the configuration script at startup and let it read the switch.
I might try to make the script look for an existing wifi link and go to access point mode if it doesn't find one it can access.
This would probably be a steep learning curve for me but I could probably figure it out eventually.
What I am trying to figure out now is whether I can avoid these potentially complex solutions by creating a single configuration that does both. Is a single wifi dongle sharable between these functions?
Note: I don't need it to do both at the same time. I just need the decision to be automated so it happens automatically during boot.
It is possible, although tricky to get right. (For example, what happens if you boot up, don't see an existing network for a second due to interference, then wrongly create your own network?)
Take a look at the "iwlist" command. It can scan and tell you what SSIDs (base stations) it sees. Then you can use 'grep' to see if your home network is on the list, and use that as your decision.

Resources