Power Event Driver

I was wondering if someone can help me make a driver, that monitors power events in a linux os. I found some code on the net, that claims to do this, and I started a project with this, but I'm missing some classes that I can't find.
This is the code I found:
http://lxr.free-electrons.com/source/include/linux/pm.h
and the class I can't find, is this one: disabled features.h
I also don't know how to send something back, when a power event occurs, such as shutdown, hibernate, sleep, restart or logoff.
I tried to read the code, but I couldn't understand it, so I would really appreciate it , if someone could tell me where can I add some return statement, so that when one of these events occur, the user knows.
Any help will be greatly appreciated.
Thanks.


Similar Content



Stuck Loading Nvidia Driver

new computer from boxes, does not install nvidia driver
Booted from USB then ran YaST, I am new with OpenSuse but have two times before installed OpenSuse on fresh HDD's and Nvidia cards with ease.

The symptoms are like when I switched from a GTX 640 that only has mother board power to the GTX 750 Ti and needed power that I did not connect at first. Until I added extra power to the graphics card I only got a single low res VGA output. This 750 card definitely has power but still can only provide single low res to VGA output.

Terminal (dmesg) ......The NVIDIA GPU 0000:01:00.0 (PCI ID: 10de:1380)installed in this system is not supported by the 304.125 NVIDIA Linux driver release. Please see 'Appendix A - supported NVIDIA GPU Products' in this release's README, available on the Linux driver download page at www.nvidia.com. .... None of the VVIDIA graphics adapters were initialized!

Terminal (uname -r) 3.16.7-21 -default [OpenSuse version]

Terminal (/sbin/lspci) VGA Compatible controller: Nvidia Corporation GM107 [GeForce GTX 750 Ti] (rev 02)

have tried:
1. different power cables to graphic card
2. two GTX 750 Ti cards, neither work.
3. re-installed OpenSuse
4. removed card and mother board can run two monitors in high res. DVI cables are new and work. Monitors (4) are all AOC i2367 and working.

5. added to repository 'bumblebee' which contains NVIDIA drivers and tried rebooting. I am not good at repositories yet. However, I didn't need to do this twice before on new installs with NVIDIA cards.

6. downloaded from www.geforce.com file:///home/shark/Downloads/NVIDIA-Linux-x86_64-346.72(1).run but when I run it error, "The file /home/shark/Downloads/NVIDIA-Linux-x86_64-346.72(3).run was opened with UTF-8 encoding but contained invalid characters."It is set to read-only mode, as saving might destroy its content.
Either reopen the file with the correct encoding chosen or enable the read-write mode again in the menu to be able to edit it."

Hardware list: Asus H81M-E motherboard, i5 4460 CPU, 550W power, Asus GeForce GTX 750 Ti graphic card,

Note: two graphic cards on hand, both work in another OpenSuse computer.

I am just learning Linux so I need simple step by step instructions.

Thank you in advance.

How Can I Get Shell To Read Special Characters As Strings? Such As $ Or !

How can I get shell to read special characters as strings? Such as $ or !

Code:
$ ./test.sh "!hooray!"
bash: !hooray!: event not found
$ ./test.sh !hooray!
bash: !hooray!: event not found

If I escape it, the \ prints in the output:
Code:
$ ./test.sh "\!hooray\!"
\!hooray\!

The code of test.sh is as follows:
Code:
$ cat test.sh 
#!/bin/bash
str="$1"
echo "$str"

TIA

Problem With (instalation Of?) Mysql.h On C

Hi, I've just recently installed MySQL connector/c from source code on my Slackware 14.1 x64

I read the official instructions of the connector but I felt a bit disorientated when I read:
Code:
1 -Change location to the top-level directory of the source distribution.

I interpreted that I have to go to the "highest" directory Code:
/

So I wrote: Code:
 
        #                            cd /

root@- /#                            tar xzvf /home/normal/Downloads/mysql-connector-c-6.1.6-src.tar.gz 

root@- /#                            cd /mysql-connector-c-6.1.6-src/

root@- /mysql-connector-c-6.1.6-src# cmake -G "Unix Makefiles"

root@- /mysql-connector-c-6.1.6-src# make 

root@- /mysql-connector-c-6.1.6-src# make install

Then I did:
Code:
ln -s /usr/local/mysql-5.6.25/include /usr/include

But when I try to compile a program in c with #include <mysql.h> i get this error:
Code:
# gcc ctemp.c 
In file included from ctemp.c:2:0:
/usr/include/mysql.h:57:27: fatal error: mysql_version.h: No such file or directory
 #include "mysql_version.h"
                           ^

What can I do? Thanks a lot and sorry for poor english

PD: If you need the official instructions I paste here the link: https://dev.mysql.com/doc/connector-...on-source.html

New Debian 7.7 Non-free Install - Sound Not Working.

Hello everyone.
I have just installed debian stable non-free onto my hard drive but the sound isn't working.

I've been to the debian site https://wiki.debian.org/SoundConfiguration and found that 'users' don't automatically have access to audio (for security reasons).
So I did the following command as root (sudo):
Code:
adduser USER_NAME audio

Now when I am 'user', I can get sound.

I also did:
Code:
chgrp cdrom /dev/sr0
adduser USER_ID cdrom

This allows 'user' to get sound from the cdrom.

I then went onto the debian soundfaq https://wiki.debian.org/SoundFAQ

From the 'lspci -v' command, I get these 2 outputs which have the word 'audio' in it:
Code:
01:05.1 Audio device: Advanced Micro Devices [AMD] nee ATI RS880 HDMI Audio [Radeon HD 4200 Series]
	Subsystem: Giga-byte Technology Device 960f
	Flags: bus master, fast devsel, latency 0, IRQ 19
	Memory at fdefc000 (32-bit, non-prefetchable) [size=16K]
	Capabilities: [50] Power Management version 3
	Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit+
	Kernel driver in use: snd_hda_intel

00:14.2 Audio device: Advanced Micro Devices [AMD] nee ATI SBx00 Azalia (Intel HDA) (rev 40)
	Subsystem: Giga-byte Technology Device a102
	Flags: bus master, slow devsel, latency 32, IRQ 16
	Memory at fe024000 (64-bit, non-prefetchable) [size=16K]
	Capabilities: [50] Power Management version 2
	Kernel driver in use: snd_hda_intel

So I have 2 sound cards.

The debian website says: 'If sound does not work for root account as well, then that means that either your sound card is not supported by Debian or it was not configured properly'.

Ok, so the first part of the statement is worrying.
So I went to the debian device driver check page http://kmuto.jp/debian/hcl/ and did 'lspci -n'.
The output can be pasted onto their web page and debian will say if the sound cards are supported.
The web page shows that the sound cards are supported:

Quote:
10024383 Yes Advanced Micro Devices [AMD] nee ATI SBx00 Azalia (Intel HDA) snd-hda-intel v2.6.25
10029715 Yes Advanced Micro Devices [AMD] nee ATI RS880 [Radeon HD 4250] radeon v2.6.35-
1002970f Yes Advanced Micro Devices [AMD] nee ATI RS880 HDMI Audio [Radeon HD 4200 Series] snd-hda-intel v2.6.27-
So now I'm guessing that my sound cards are 'not configured properly'. But I've run a Youtube video and then changed the sound cards under alsamixer and I still don't get sound.
Is there is a simple solution to this please? Thank you in advance.

What's Wrong With My /etc/apt/sources.list - Jessie.

Hi all,
This is my /etc/apt/sources.list of jessie, what's wrong as I am getting the following error output .

error :-

Code:
Err http://http.debian.net jesssie/main Sources
  404  Not Found [IP: 54.192.190.154 80]
Err http://http.debian.net jesssie/contrib Sources
  404  Not Found [IP: 54.192.190.154 80]
Err http://http.debian.net jesssie/non-free Sources                                                                                            
  404  Not Found [IP: 54.192.190.154 80]
Fetched 7,819 B in 25s (307 B/s)                                                                                                               
W: The repository 'http://http.debian.net jesssie Release' does not have a Release file. This is deprecated, please contact the owner of the repository.
W: Failed to fetch http://http.debian.net/debian/dists/jesssie/main/source/Sources  404  Not Found [IP: 54.192.190.154 80]

W: Failed to fetch http://http.debian.net/debian/dists/jesssie/contrib/source/Sources  404  Not Found [IP: 54.192.190.154 80]

W: Failed to fetch http://http.debian.net/debian/dists/jesssie/non-free/source/Sources  404  Not Found [IP: 54.192.190.154 80]

E: Some index files failed to download. They have been ignored, or old ones used instead.

This is my /etc/apt/sources.list :-

Code:
[$] cat /etc/apt/sources.list                                                                                                       [2:23:45]
#### testing  #########
deb http://http.debian.net/debian jessie main contrib non-free
deb-src http://http.debian.net/debian jesssie main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

# testing-updates, previously known as 'volatile'
#deb http://http.debian.net/debian jessie-updates main contrib non-free
#deb-src http://http.debian.net/debian jessie-updates main contrib non-free

Now I am guessing one or more of the entries above are wrong, as probably all of testing-updates would probably come into play once jessie is released, right ?

This was generated via http://debgen.simplylinux.ch/ for lack of better places to generate sources.list from.

Ubuntu Directories

Hi there. I have Ubuntu 14.04 installed. Actually I have been doing a lot of work in this OS for about a year. The thing I cannot still comprehend is how to find files I installed. In this particular case I need glut.h for g++ compiler. So I go here, do this command;

Code:
sudo apt-get install freeglut3-dev

And find out that I already have the newest version (which I have suspected since I recall installing it).

So, the next step is to find the glut.h file and reference it with #include command. I cannot find it anywhere. This website says it has to be he

Code:
/usr/lib/x86_64-linux-gnu/libglut*

Why's the asterisk? Is it a footnote or part of the code?

I don't seem to have /usr/ directory. I cannot find it anywhere.

How does Ubuntu directory work?

Thanks, - A.

Problem Installing Radeon Driver Packages With Second Debian Install

I have a debian OS on a partition on my hard disk (sda1).
There was no sound because the ati rs880/radeon 4200 sound card needed drivers which were only in the debian 'non-free' version'.
So I added the non-free version to my install and also had to make a change to the GRUB bootloader file.
After that, I got sound.

Now I've installed a new debian distro to my second partition - sda2.
This time I ensured I installed the debian non-free version.
But I'm having trouble installing the drivers for the sound card.

I go into Synaptic package manager to install the relevant drivers and it gives me an error message:
Code:
Configuring libfglrx - install Fglrx driver despite unsupported graphics card?

I'm not sure what that means because I want the drivers for my sound card - not graphics.
When I press the 'Help' button, it says:
Code:
This system has a graphics card which is no longer handled by the Fglrx driver...
The above card requires either the non-free legacy Fgrlx driver 
(package fgrlx-legacy-driver) or the free Radeon driver (package xserver-xorg-video-radeon).

This is fine because I can just install the 'free Radeon driver'.

But the Help message then says:
Code:
Before the Radeon driver can be used you must remove Fglrx configuration from xorg.conf 
(and xorg.conf.d/)
Note that switching to the free Radeon driver requires the fglrx-driver package to be purged (not just removed).

So now I don't know what to do. Has anyone had this error message?
I know I can enable sound and have no problems with the graphics card because that's what happened with my original install on sda1.

But with the install on sda2, I don't know how to approach this problem.
Can anyone help please?

Screen Flickering

I have a laptop with an integrated GMA3600 GPU. Every "modern" distro was unusable because the screen would flicker and black out like crazy, so I installed one of the few that didn't present this behaviour -- Crunchbang 11, based on Wheezy.

I'm trying to address this issue; I'll compare a few outputs from 1) my current setup (Crunchbang) and 2) one of the non-working alternatives (Lubuntu 14.10 on a live USB):

uname -r
1) 3.2.0-4-686-pae
2) 3.16.0-23-generic

sudo lshw -c video
1)
Code:
description: VGA compatible controller
       product: Atom Processor D2xxx/N2xxx Integrated Graphics Controller
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 0b
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi vga_controller bus_master cap_list rom
       configuration: driver=gma500 latency=0
       resources: irq:46 memory:80100000-801fffff ioport:30c0(size=8)

2)
Code:
*-display               
       description: VGA compatible controller
       product: Atom Processor D2xxx/N2xxx Integrated Graphics Controller
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 0b
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi vga_controller bus_master cap_list rom
       configuration: driver=gma500 latency=0
       resources: irq:45 memory:80100000-801fffff ioport:30c0(size=8)

The only difference is the IRQ used.

cat /proc/interrupts
1)
Code:
           CPU0       CPU1       
  0:         41          0   IO-APIC-edge      timer
  1:        517          0   IO-APIC-edge      i8042
  8:          1          0   IO-APIC-edge      rtc0
  9:       7245          0   IO-APIC-fasteoi   acpi
 12:       2597          0   IO-APIC-edge      i8042
 16:          0          0   IO-APIC-fasteoi   uhci_hcd:usb5
 18:          0          0   IO-APIC-fasteoi   uhci_hcd:usb4
 19:      13520          0   IO-APIC-fasteoi   ata_piix, uhci_hcd:usb3
 23:      26138          0   IO-APIC-fasteoi   ehci_hcd:usb1, uhci_hcd:usb2
 44:        369          0   PCI-MSI-edge      eth0
 45:        255          0   PCI-MSI-edge      snd_hda_intel
NMI:         69         47   Non-maskable interrupts
LOC:      27594      20371   Local timer interrupts
SPU:          0          0   Spurious interrupts
PMI:         69         47   Performance monitoring interrupts
IWI:          0          0   IRQ work interrupts
RES:      33502      39919   Rescheduling interrupts
CAL:        407       6719   Function call interrupts
TLB:       1138       1213   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:          1          1   Machine check polls
ERR:          0
MIS:          0

2)
Code:
           CPU0       CPU1       
  0:         46          0   IO-APIC-edge      timer
  1:       2154          0   IO-APIC-edge      i8042
  8:          1          0   IO-APIC-edge      rtc0
  9:      37131          0   IO-APIC-fasteoi   acpi
 12:      11292          0   IO-APIC-edge      i8042
 16:          0          0   IO-APIC-fasteoi   uhci_hcd:usb5
 18:          0          0   IO-APIC-fasteoi   uhci_hcd:usb4
 19:       1309         11   IO-APIC-fasteoi   ata_piix, uhci_hcd:usb3
 23:      20420       6875   IO-APIC-fasteoi   ehci_hcd:usb1, uhci_hcd:usb2
 44:      15634          0   PCI-MSI-edge      eth0
 45:          0          0   PCI-MSI-edge      gma500
 46:        194          0   PCI-MSI-edge      snd_hda_intel
NMI:        147        132   Non-maskable interrupts
LOC:      70348      59679   Local timer interrupts
SPU:          0          0   Spurious interrupts
PMI:        147        132   Performance monitoring interrupts
IWI:          1          0   IRQ work interrupts
RTR:          0          0   APIC ICR read retries
RES:      20827      27012   Rescheduling interrupts
CAL:       1802       2767   Function call interrupts
TLB:       1875       1439   TLB shootdowns
TRM:          0          0   Thermal event interrupts
THR:          0          0   Threshold APIC interrupts
MCE:          0          0   Machine check exceptions
MCP:          4          4   Machine check polls
THR:          0          0   Hypervisor callback interrupts
ERR:          0
MIS:          0

dmesg | grep -i video
1)
Code:
[    0.378029] pci 0000:00:02.0: Boot video device
[    6.579368] Linux video capture interface: v2.00
[    6.614256] uvcvideo: Found UVC 1.00 device USB 2.0 PC Cam (090c:037c)
[    6.616059] usbco  registered new interface driver uvcvideo
[    6.616064] USB Video Class driver (1.1.1)

2)
Code:
[    0.338661] pci 0000:00:02.0: Boot video device
[   11.048529] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
[   11.049314] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:00/input/input10
[   36.372066] Linux video capture interface: v2.00
[   36.908529] uvcvideo: Found UVC 1.00 device USB 2.0 PC Cam (090c:037c)
[   36.961726] usbco  registered new interface driver uvcvideo
[   36.961733] USB Video Class driver (1.1.1)
[   38.262977] systemd-logind[1547]: Watching system buttons on /dev/input/event5 (Video Bus)

dmesg | grep -i gma
1)
Code:
[    5.465696] gma500 0000:00:02.0: setting latency timer to 64
[    5.465749] gma500 0000:00:02.0: irq 46 for MSI/MSI-X
[    5.466125] gma500 0000:00:02.0: GPU: power management timed out.
[    5.958548] gma500 0000:00:02.0: allocated 1280x800 fb
[    6.402676] [drm] Initialized gma500 1.0.0 2011-06-06 for 0000:00:02.0 on minor 0

2)
Code:
[   11.030830] gma500 0000:00:02.0: irq 45 for MSI/MSI-X
[   11.030934] gma500 0000:00:02.0: GPU: power management timed out.
[   11.420011] gma500 0000:00:02.0: trying to get vblank count for disabled pipe 0
[   11.420060] gma500 0000:00:02.0: trying to get vblank count for disabled pipe 0
[   12.016034] gma500 0000:00:02.0: fb0: psbdrmfb frame buffer device
[   12.016039] gma500 0000:00:02.0: registered panic notifier
[   12.045847] [drm] Initialized gma500 1.0.0 20140314 for 0000:00:02.0 on minor 0

The last output hints that some problem is indeed detected but I don't know what to do from here.

EDIT: forgot to mention that the Lubuntu boot menu screen (this one) presents no flickering issues.

Double TtyACM Node Device From Sony Ericsson C510

Hi.


I'm using smstools3 and Sony Ericsson Phones to send SMS. My system did work well with 4 phones, now I want to connect 20.
The issue is that each phone generates two ttyACMXX devices using cdc_acm driver, and for limitations the driver supports up to 32 ACM devices

Code:
Aug 31 09:51:19 smsgw kernel: cdc_acm 2-2:1.1: ttyACM31: USB ACM device
Aug 31 09:51:19 smsgw kernel: cdc_acm 2-2:1.3: ttyACM32: USB ACM device
Aug 31 09:51:19 smsgw kernel: usbco  registered new driver cdc_acm
Aug 31 09:51:19 smsgw kernel: drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters
Aug 31 09:51:19 smsgw kernel: usbco  registered new driver cdc_ether
Aug 31 09:51:19 smsgw kernel: usb 2-2: unsupported MDLM descriptors
Aug 31 09:52:01 smsgw kernel: cdc_acm 3-1:1.0: no more free acm devices

From the ttyACM devices created by the driver I only use the first one..

So I was wondering if it is possible to remove a ttyACM from /sys/class/tty/ttyACM1

I tried unlink /dev/ttyACM1, but it persist as a device on /sys/class/tty/

The devices are removed if I disconnect the phone, So I think would be possible also that the driver only create one ttyACM device..

Please guide me...

Thanks in advance.

?? How To Auto Mount Logical Volume Before Transmission-daemon Starts At Start Up

I have been using an old computer to download my torrents and this has been my usual routine:

1. Press the power button.
2. Connect to the computer through Putty
3. Log in
4. Gain su privileges

Startup Commands:
Code:
/etc/init.d/transmission-daemon stop
apt-get update
mount -t ext4 /dev/vgTransmission/lvTransmission /mnt/transmissionVault
/etc/init.d/transmission-daemon start

Shutdown Commands:
Code:
/etc/init.d/transmission-daemon stop
umount /dev/vgTransmission/lvTransmission
shutdown -h now

I was wondering if there is a way to configure a computer to automatically mount a logical volume “before” the transmission-daemon starts at boot up (note my first Startup Command).

I think the instructions here are related to what I want to do, but I want to get some advice before I attempt to do anything dangerous:
http://tille.garrels.be/training/tld...#sect_04_02_04


My perfect scenario would be:

Startup Routine:
1. Send WakeOnLan magic packet to computer to turn it on.
2. Computer boots up, mounts the transmissionVault logical volume
3. Wait 10 seconds to ensure that the logical volume has finished mounting
4. Start transmission-daemon

Shutdown Routine:
Send WakeOnLan magic packet to turn off computer, i.e.: Execute “shutdown -h now”
The shutdown command should include:
1. Stop transmission-daemon
2. Wait 10 seconds to ensure that transmission-daemon has finished shutting down
3. Umount transmissionVault logical volume




Recently the Ethernet port of my transmission box has stopped working, so I went ahead and swapped the motherboard with another old motherboard, added a few hard drives, installed a fresh copy of Debian, and re-created the LVM logical volume for transmissionVault. I pretty much have a fairly stock system running at the moment.

Running a headless 3.2.0-4-amd64