New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pwm sysfs work for non-root users #1983

Closed
gohai opened this Issue May 1, 2017 · 28 comments

Comments

Projects
None yet
7 participants
@gohai
Contributor

gohai commented May 1, 2017

I sent a one-liner patch to the linux-pwm mailing list, which makes exporting a channel (with echo 0 > /sys/class/pwm/pwmchip0/export) send a udev event.

With this patch, and the following addition to /etc/udev/rules.d/99-com.rules, it is finally possible to use the pwm functionality with the default pi user, instead of having to use sudo (which is not an option for Processing e.g.):

SUBSYSTEM=="pwm*", PROGRAM="/bin/sh -c '\
        chown -R root:gpio /sys/class/pwm && chmod -R 770 /sys/class/pwm;\
        chown -R root:gpio /sys/devices/platform/soc/*.pwm/pwm/pwmchip* && chmod -R 770 /sys/devices/platform/soc/*.pwm/pwm/pwmchip*\
'"

Would you mind giving these changes a try, and consider them for inclusion with Raspbian? I am the author of Processing's Hardware I/O library - this would enable users to use hardware PWM from within Processing on their Raspberry Pi computers.

Let me know if I should send a PR for the kernel part of this - I'll of course also be eying any discussion that happens upstream regarding my patch submission.

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell May 1, 2017

Contributor

I would expect your patch to be quickly accepted - let us know when it is and we will back-port it to the current rpi-
branches and merge your udev rule into Raspbian.

Contributor

pelwell commented May 1, 2017

I would expect your patch to be quickly accepted - let us know when it is and we will back-port it to the current rpi-
branches and merge your udev rule into Raspbian.

@JamesH65

This comment has been minimized.

Show comment
Hide comment
@JamesH65

JamesH65 May 19, 2017

Contributor

@gohai Do you know if this was accepted? If so we can cherry pick it's commit.

Contributor

JamesH65 commented May 19, 2017

@gohai Do you know if this was accepted? If so we can cherry pick it's commit.

@gohai

This comment has been minimized.

Show comment
Hide comment
@gohai

gohai May 21, 2017

Contributor

@JamesH65 I've submitted it to linux-pwm, in the proper format, and with the right folks in CC, but haven't heard back so far.

Contributor

gohai commented May 21, 2017

@JamesH65 I've submitted it to linux-pwm, in the proper format, and with the right folks in CC, but haven't heard back so far.

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell May 21, 2017

Contributor

I think they're quite busy with the 4.12 release candidates - I also have patches waiting for review.

Contributor

pelwell commented May 21, 2017

I think they're quite busy with the 4.12 release candidates - I also have patches waiting for review.

@gohai

This comment has been minimized.

Show comment
Hide comment
@gohai

gohai May 21, 2017

Contributor

@pelwell Thanks for the heads-up. I'll keep an eye on the mailing list and will report here once it is in some tree...

Contributor

gohai commented May 21, 2017

@pelwell Thanks for the heads-up. I'll keep an eye on the mailing list and will report here once it is in some tree...

@lategoodbye

This comment has been minimized.

Show comment
Hide comment
@lategoodbye

lategoodbye May 30, 2017

Contributor

@gohai I think your upstream patch got lost. I suggest to resend the patch and also add linux-arm-kernel (moderated list) to CC in order to increase the chance of an reviewer. Another approach is to ask about this topic on kernelnewbies mailing list or IRC, where you get a much fast reply.

Contributor

lategoodbye commented May 30, 2017

@gohai I think your upstream patch got lost. I suggest to resend the patch and also add linux-arm-kernel (moderated list) to CC in order to increase the chance of an reviewer. Another approach is to ask about this topic on kernelnewbies mailing list or IRC, where you get a much fast reply.

@gohai

This comment has been minimized.

Show comment
Hide comment
@gohai

gohai Jun 2, 2017

Contributor

@lategoodbye Just re-sent it, with CC to linux-arm-kernel and linux-rpi-kernel for what it's worth. I dropped by on kernelnewbies IRC, there the suggestion was to just be more insistent (I was told the submission looks fine).

Contributor

gohai commented Jun 2, 2017

@lategoodbye Just re-sent it, with CC to linux-arm-kernel and linux-rpi-kernel for what it's worth. I dropped by on kernelnewbies IRC, there the suggestion was to just be more insistent (I was told the submission looks fine).

@lategoodbye

This comment has been minimized.

Show comment
Hide comment
@lategoodbye

lategoodbye Jul 6, 2017

Contributor

I've seen Thierry on the mailing list, so maybe you should send a gentle ping. Otherwise the merge window is still open.

Contributor

lategoodbye commented Jul 6, 2017

I've seen Thierry on the mailing list, so maybe you should send a gentle ping. Otherwise the merge window is still open.

@gohai

This comment has been minimized.

Show comment
Hide comment
@gohai

gohai Jul 11, 2017

Contributor

@lategoodbye I've sent it three times already - anyone, feel free to pick this up yourself, but I am wholeheartedly discouraged from further attempting to make a contribution at this point...

Contributor

gohai commented Jul 11, 2017

@lategoodbye I've sent it three times already - anyone, feel free to pick this up yourself, but I am wholeheartedly discouraged from further attempting to make a contribution at this point...

@JamesH65

This comment has been minimized.

Show comment
Hide comment
@JamesH65

JamesH65 Sep 13, 2017

Contributor

@gohai @pelwell Was there any progress on this?

Contributor

JamesH65 commented Sep 13, 2017

@gohai @pelwell Was there any progress on this?

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Sep 13, 2017

Contributor

I can see that the patch got no response upstream, which is very disappointing. @gohai - give it one more try, wait a week, and if you get no response I'll apply it downstream and maintain it myself.

Contributor

pelwell commented Sep 13, 2017

I can see that the patch got no response upstream, which is very disappointing. @gohai - give it one more try, wait a week, and if you get no response I'll apply it downstream and maintain it myself.

@lategoodbye

This comment has been minimized.

Show comment
Hide comment
@lategoodbye

lategoodbye Sep 13, 2017

Contributor

As long as the merge window is open, any attempt would be pointless. We must wait until 4.14rc-1 is released.

Contributor

lategoodbye commented Sep 13, 2017

As long as the merge window is open, any attempt would be pointless. We must wait until 4.14rc-1 is released.

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Sep 13, 2017

Contributor

Why pointless? Do all reviewers become mute during the merge window? An indication of whether the submitter is on the right lines or doomed to failure isn't a lot to ask for.

Contributor

pelwell commented Sep 13, 2017

Why pointless? Do all reviewers become mute during the merge window? An indication of whether the submitter is on the right lines or doomed to failure isn't a lot to ask for.

@lategoodbye

This comment has been minimized.

Show comment
Hide comment
@lategoodbye

lategoodbye Sep 13, 2017

Contributor

I think there was enough time to review, so it's all about merging. Some maintainers ignore patches within the merge window.

Contributor

lategoodbye commented Sep 13, 2017

I think there was enough time to review, so it's all about merging. Some maintainers ignore patches within the merge window.

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Sep 13, 2017

Contributor

It is unreasonable to expect submitters to know about merge windows. Since the original submission, 4.13 gone mainstream and now we are waiting for 4.14 rc1.

@thierryreding Should @gohai resubmit his patch or is it already in the pipeline somewhere?

Contributor

pelwell commented Sep 13, 2017

It is unreasonable to expect submitters to know about merge windows. Since the original submission, 4.13 gone mainstream and now we are waiting for 4.14 rc1.

@thierryreding Should @gohai resubmit his patch or is it already in the pipeline somewhere?

@larsks

This comment has been minimized.

Show comment
Hide comment
@larsks

larsks Sep 26, 2017

For folks who find themselves here via google, note that the udev rules suggested in this issue only solve half the problem: while they will result in correct ownership and permissions on /sys/class/pwm and friends, they will not actually apply to the new sysfs entries created when you export a pwm (via for example echo 1 > /sys/class/pwm/pwmchip0/export). Those files will still be owned by root:root .

larsks commented Sep 26, 2017

For folks who find themselves here via google, note that the udev rules suggested in this issue only solve half the problem: while they will result in correct ownership and permissions on /sys/class/pwm and friends, they will not actually apply to the new sysfs entries created when you export a pwm (via for example echo 1 > /sys/class/pwm/pwmchip0/export). Those files will still be owned by root:root .

@gohai

This comment has been minimized.

Show comment
Hide comment
@gohai

gohai Sep 26, 2017

Contributor

@larsks The necessary kernel patch is linked in the first sentence of the initial message in this issue.

Contributor

gohai commented Sep 26, 2017

@larsks The necessary kernel patch is linked in the first sentence of the initial message in this issue.

@thierryreding

This comment has been minimized.

Show comment
Hide comment
@thierryreding

thierryreding Sep 26, 2017

Contributor

@gohai best to resubmit this patch. I don't remember seeing it before and I can't find anything that looks related in my inbox. Maybe it was lost along the way? Sorry.

Contributor

thierryreding commented Sep 26, 2017

@gohai best to resubmit this patch. I don't remember seeing it before and I can't find anything that looks related in my inbox. Maybe it was lost along the way? Sorry.

@gohai

This comment has been minimized.

Show comment
Hide comment
@gohai

gohai Sep 26, 2017

Contributor

@thierryreding I just sent it again, subject should be [RESEND][PATCH] pwm: Set class for exported channels in sysfs.

Might have not made it onto the mailing lists this time, because after 45 minutes I still couldn't get git send-email work with my GMail address. Oh well...

Contributor

gohai commented Sep 26, 2017

@thierryreding I just sent it again, subject should be [RESEND][PATCH] pwm: Set class for exported channels in sysfs.

Might have not made it onto the mailing lists this time, because after 45 minutes I still couldn't get git send-email work with my GMail address. Oh well...

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Sep 26, 2017

Contributor

I just received it.

Contributor

pelwell commented Sep 26, 2017

I just received it.

@gohai

This comment has been minimized.

Show comment
Hide comment
@gohai

gohai Oct 8, 2017

Contributor

@thierryreding Have you received my patch? The resend made it to linux-pwm...

Contributor

gohai commented Oct 8, 2017

@thierryreding Have you received my patch? The resend made it to linux-pwm...

@gohai

This comment has been minimized.

Show comment
Hide comment
@gohai

gohai Nov 26, 2017

Contributor

Pinging @thierryreding

Contributor

gohai commented Nov 26, 2017

Pinging @thierryreding

@JamesH65

This comment has been minimized.

Show comment
Hide comment
@JamesH65

JamesH65 Dec 4, 2017

Contributor

Would be good to get some sort of closure on this one.... @thierryreding @gohai @pelwell

Contributor

JamesH65 commented Dec 4, 2017

Would be good to get some sort of closure on this one.... @thierryreding @gohai @pelwell

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Dec 4, 2017

Contributor

There's shortage of time, and then there's obstruction.

@gohai If you submit a PR against 4.9 (and 4.14 if it takes more than a simple cherry-pick) I'll apply it downstream.

Contributor

pelwell commented Dec 4, 2017

There's shortage of time, and then there's obstruction.

@gohai If you submit a PR against 4.9 (and 4.14 if it takes more than a simple cherry-pick) I'll apply it downstream.

@6by9

This comment has been minimized.

Show comment
Hide comment
@6by9

6by9 Dec 5, 2017

Contributor

Response on the mailing list that it has been applied to for-next - http://lists.infradead.org/pipermail/linux-rpi-kernel/2017-December/007193.html

Contributor

6by9 commented Dec 5, 2017

Response on the mailing list that it has been applied to for-next - http://lists.infradead.org/pipermail/linux-rpi-kernel/2017-December/007193.html

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Dec 5, 2017

Contributor

I've cherry-picked - just compile-testing now.

Contributor

pelwell commented Dec 5, 2017

I've cherry-picked - just compile-testing now.

@gohai

This comment has been minimized.

Show comment
Hide comment
@gohai

gohai Dec 5, 2017

Contributor

@6by9 @pelwell @lategoodbye Fantastic. Thanks everyone for your support!

Contributor

gohai commented Dec 5, 2017

@6by9 @pelwell @lategoodbye Fantastic. Thanks everyone for your support!

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Dec 5, 2017

Contributor

All merged now - thanks everyone.

Contributor

pelwell commented Dec 5, 2017

All merged now - thanks everyone.

@pelwell pelwell closed this Dec 5, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment