Bug 115003 - use libpmud instead of accessing /dev/pmu directly?
Summary: use libpmud instead of accessing /dev/pmu directly?
Status: RESOLVED INVALID
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: GNOME (show other bugs)
Version: unspecified
Hardware: PowerPC All
: P5 - None : Enhancement (vote)
Target Milestone: ---
Assignee: Kay Sievers
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-02 16:22 UTC by Leah Cunningham
Modified: 2006-09-28 13:26 UTC (History)
1 user (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Screenshot of error (302.38 KB, image/png)
2005-09-02 16:23 UTC, Leah Cunningham
Details
y2log, if useful (750.98 KB, text/plain)
2005-09-02 16:25 UTC, Leah Cunningham
Details
cropped version (11.09 KB, image/png)
2005-09-02 16:34 UTC, Leah Cunningham
Details
bug115003.tar.bz2 (110.05 KB, application/x-bzip2)
2005-10-11 09:49 UTC, Olaf Hering
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Leah Cunningham 2005-09-02 16:22:39 UTC
I receive an error about permissions on /dev/pmu upon logging in to Gnome.  I
will attach a screenshot.
Comment 1 Leah Cunningham 2005-09-02 16:23:29 UTC
Created attachment 48619 [details]
Screenshot of error
Comment 2 Leah Cunningham 2005-09-02 16:25:53 UTC
Created attachment 48621 [details]
y2log, if useful
Comment 3 Leah Cunningham 2005-09-02 16:34:58 UTC
Created attachment 48623 [details]
cropped version
Comment 4 JP Rosevear 2005-09-04 21:11:43 UTC
What permissions do you have on /dev/pmu?

GNOME is attempting to use the device to notice when the brightness keys are
hit.  Perhaps resmgr can give perms for the desktop user here?

Comment 5 Leah Cunningham 2005-09-04 22:57:24 UTC
crw-rw----  1 root root 10, 154 2005-08-19 19:42 /dev/pmu
Comment 6 Ludwig Nussel 2005-09-05 08:57:57 UTC
I've never heard of this device before. I cannot judge whether it's safe to   
grant users access to /dev/pmu, someone would need to check the kernel code.  
  
Things in /usr/src/linux/include/linux/pmu.h sound like it's a quite low level   
device and users should better not get access:  
     20 #define PMU_WRITE_NVRAM         0x33    /* write non-volatile RAM */   
     22 #define PMU_SET_RTC             0x30    /* set real-time clock */   
     32 #define PMU_SHUTDOWN            0x7e    /* turn power off */   
     37 #define PMU_RESET               0xd0    /* reset CPU */   
   
Powersaving features should be handled by powersaved. For key like events the   
kernel driver should provide an event interface. Access to that one could be   
granted then. 
Comment 7 Olaf Hering 2005-09-05 09:27:31 UTC
it is safe to use 666 or whatever.
Comment 8 Olaf Hering 2005-09-05 09:28:40 UTC
on the other hand, link against libpmud and ask the running pbbuttonsd. it
likely has code to notify userland.
Comment 9 Leah Cunningham 2005-09-06 23:01:14 UTC
still present in beta4
Comment 10 Ludwig Nussel 2005-09-07 08:47:58 UTC
Well, AFAICS there are now three possible ways to solve the problem. Someone  
needs to decide which one to use. To me the libpmud way sounds like the best.  
  
[ ] use libpmud -> gnome-maintainers  
[ ] make device 666 or 660 root:video -> udev  
[ ] use resmgr -> /dev/pmu needs to be in hal, then -> hal-resmgr 
Comment 11 JP Rosevear 2005-09-07 13:20:35 UTC
Well, my opinion is that [ ] make device 666 or 660 root:video -> udev is best
(at least for SL 10.0) because it requires no code changes and 1 and 3 do.
Comment 12 Ludwig Nussel 2005-09-07 13:45:54 UTC
Ok, lets have it 660 root:video then. So at least random daemons don't have 
access. 
Comment 13 Kay Sievers 2005-09-07 14:02:20 UTC
660 is the default. I've added:
  KERNEL=="pmu", GROUP="video"

Will someone take over the bug for the remaining issues? Otherwise I will close it.
Comment 14 Olaf Hering 2005-09-07 14:20:57 UTC
fig.suse.de has rc1 installed. how would the resmgr fix look like?
Comment 15 Kay Sievers 2005-09-07 14:26:32 UTC
/proc/pmu is already read by HAL. Maybe there is not much missing to make it
work using HAL. LCDBrightness Methods made it into the latest HAL version, so
this may be the rigth solution for this?
Comment 16 Ludwig Nussel 2005-09-07 14:27:57 UTC
the device needs to be known to hald, see output of lshal. Then you can add 
rules that match for the device 
to /usr/share/hal/fdi/policy/10osvendor/80-resmgr.fdi, just like it's done for 
e.g. joysticks. resmgr will then install ACLs on the file when you log in (and 
give you a fd if you use libresmgr to open the device). 
Comment 17 Olaf Hering 2005-09-07 14:42:10 UTC
lshal doesnt know about /dev/pmu
Comment 18 Danny Al-Gaaf 2005-10-11 09:09:10 UTC
@olaf: Could you do this?:

- stop hal (with 'rchal stop')
- hald --verbose=yes --daemon=no --retain-privileges > /tmp/hal_log 2>&1
- wait 20 seconds
- stop hal and attach the file to the bug

could you also attach a 'ls -lha *' of the related dir in /sys and maybe a 
archive with copy of the dir with all files?
Comment 19 Olaf Hering 2005-10-11 09:49:55 UTC
Created attachment 53610 [details]
bug115003.tar.bz2
Comment 20 Danny Al-Gaaf 2005-10-11 11:06:32 UTC
@kay: any ideas how to add /dev/pmu to hal? I have currently no plan how and as 
which kind of device we can add it. Please take a look at this.
Comment 21 Kay Sievers 2005-10-11 12:53:30 UTC
@danny: I have absolutely no idea about that architecture. Someone else should
look at this.
Comment 22 Olaf Hering 2005-10-11 13:43:45 UTC
erm, imagine you want to provide info for /dev/rtc or other misc devices.
Comment 23 Kay Sievers 2005-10-11 14:15:20 UTC
What are you talking about?
Comment 24 Olaf Hering 2005-10-11 15:16:07 UTC
yes, how do you provide /sys/class/misc/*? this is what we are talking about.
Comment 25 Kay Sievers 2005-10-11 15:19:37 UTC
You mean HAL? HAL is not involved in misc devices.
Comment 26 Olaf Hering 2005-10-11 16:18:38 UTC
ok, then its not fixable.