Patchwork Add a udev rules file for flashrom

login
register
about
Submitter Uwe Hermann
Date 2010-06-11 11:08:50
Message ID <20100611110850.GU21511@greenwood>
Download mbox | patch
Permalink /patch/1498/
State Accepted
Commit r1110
Headers show

Comments

Uwe Hermann - 2010-06-11 11:08:50
On Fri, Jun 11, 2010 at 02:55:51AM +0200, Carl-Daniel Hailfinger wrote:
> The following Bus Pirate link may be better:
> http://dangerousprototypes.com/2009/10/08/bus-pirate-raw-spi-mode/

Updated.

 
> Could you add a comment to the file which states the exact udev version
> and Debian release? udev and associated rulesets change so fast that it
> is unlikely the script will work as is on other machines.

Done, udev 154, but I think any recent version will work.

 
> Besides that, we should think about where to store this file. flashrom
> source tree, wiki or somewhere else...

Definately source tree, yes.

Updated patch attached.


Uwe.
Carl-Daniel Hailfinger - 2010-07-24 15:36:28
On 11.06.2010 13:08, Uwe Hermann wrote:
> On Fri, Jun 11, 2010 at 02:55:51AM +0200, Carl-Daniel Hailfinger wrote:
>   
>> The following Bus Pirate link may be better:
>> http://dangerousprototypes.com/2009/10/08/bus-pirate-raw-spi-mode/
>>     
>
> Updated.
>
>  
>   
>> Could you add a comment to the file which states the exact udev version
>> and Debian release? udev and associated rulesets change so fast that it
>> is unlikely the script will work as is on other machines.
>>     
>
> Done, udev 154, but I think any recent version will work.
>   

Turns out the plugdev group mentioned in the rules is nonstandard and
probably won't work anywhere except Debian.


>> Besides that, we should think about where to store this file. flashrom
>> source tree, wiki or somewhere else...
>>     
>
> Definately source tree, yes.
>
> Updated patch attached.
>   

Thanks. Could you add a comment to the udev file that it only works on
Debian and/or rename it to z60_flashrom_debian.rules?

Should we commit this to the main flashrom directory or to a new
directory tools/ or maybe scripts/ or helpers/?
I think tools/ is preferable, but I won't object to other solutions.

What do others think? We're starting a directory hierarchy here and
moving stuff around a few times is bad, so I'd like to get the location
finalized in a way that allows sensible future extension.

Side note: If we pick tools/, we can also place the MAC adjustment
scripts and some image extraction scripts there.

Once we have a decision on the final location of this script, this is
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

Regards,
Carl-Daniel
Uwe Hermann - 2010-07-27 22:02:39
On Sat, Jul 24, 2010 at 05:36:28PM +0200, Carl-Daniel Hailfinger wrote:
> Should we commit this to the main flashrom directory or to a new
> directory tools/ or maybe scripts/ or helpers/?
> I think tools/ is preferable, but I won't object to other solutions.

Put it into a util/ directory as per IRC discussion.

Also added a comment that "plugdev" may have to be changed on some
distros to whatever is suitable there.

 
> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>

Thanks, r1110.

I also added the new JTAGkey(2) device IDs for completeness.
 

Uwe.

Patch

Add a udev rules file for flashrom.

This allows USB-based external programmers to be used by non-root users
(which are in the 'plugdev' group). The file is to be installed by the
distros into the proper place (not sure if this is distro-specific). On
Debian the file will end up in /etc/udev/rules.d/z60_flashrom.rules.

Tested for udev version 154 on Debian unstable, but should work for almost
all somewhat recent versions of udev.

The following devices are listed so far:

 - Buspirate
 - Dediprog SF100
 - DLP Design DLP-USB1232H
 - FTDI FT4232H Mini-Module

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>

Index: z60_flashrom.rules
===================================================================
--- z60_flashrom.rules	(Revision 0)
+++ z60_flashrom.rules	(Revision 0)
@@ -0,0 +1,46 @@ 
+##
+## This file is part of the flashrom project.
+##
+## Copyright (C) 2010 Uwe Hermann <uwe@hermann-uwe.de>
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+##
+
+##
+## Please keep this list sorted alphabetically by vendor/device name.
+##
+
+## This is tested on udev version 154, other versions may need small fixes.
+
+ACTION!="add|change", GOTO="flashrom_rules_end"
+SUBSYSTEM!="usb|usb_device", GOTO="flashrom_rules_end"
+
+# Buspirate
+# http://dangerousprototypes.com/2009/10/08/bus-pirate-raw-spi-mode/
+ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="664", GROUP="plugdev"
+
+# Dediprog SF100
+# http://www.dediprog.com/SPI-flash-in-circuit-programming/SF100
+ATTRS{idVendor}=="0483", ATTRS{idProduct}=="dada", MODE="664", GROUP="plugdev"
+
+# DLP Design DLP-USB1232H
+# http://www.dlpdesign.com/usb/usb1232h.shtml
+ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", MODE="664", GROUP="plugdev"
+
+# FTDI FT4232H Mini-Module
+# http://www.ftdichip.com/Products/EvaluationKits/FT4232H_MiniModule.htm
+ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", MODE="664", GROUP="plugdev"
+
+LABEL="flashrom_rules_end"