[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: udev rule for a kindle



On Thu, 12 Dec 2013 11:43:32 +1100
Scott Ferguson <scott.ferguson.debian.user@gmail.com> wrote:

> On 12/12/13 01:01, Sharon Kimble wrote:
> > 
> > I have a script for backing up my kindle when its first mounted,
> > but its not running on mounting, but *does* run when invoked
> > manually! When the kindle is mounted it should trigger this udev
> > rule -
> > 
> > # saved to /etc/udev/rules.d/85-kindle.rules ACTION=="add",\ 
> > SYSFS{idVendor}=="1949", SYSFS{idProduct}=="0004",\ 
> > RUN+="/home/boudiccas/bin/obkindle"
> > 
> > but its not happening. The script 'obkindle' has it being
> > executable from all users, so it should in theory be executable by
> > the system when the kindle is mounted. According to 'lsusb' the
> > kindle is recognised as -
> > 
> > Bus 001 Device 018: ID 1949:0004 Lab126, Inc. Amazon Kindle
> > 3/4/Paperwhite
> 
> To get the correct udev parameters for the device:-
> udevadm info -a -p $(udevadm info -q path -n $mount) | less
> 
> where $mount is where it is mounted
> 
> 
> > 
> > Can anyone show me where and why its not running on mounting please?
> 
> No. Sorry, but I can point you at where it's not working (bad tag). My
> Kindle "just works". SOLID/udisk/KDE/Wheezy automagically mounts the
> internal storage at /media/Kindle (and Calibre detects it).
> 
> You do know your Kindle *is* Linux and easy to root right? I back up
> the Linux, but not the ELibrary (storage) as that's a (partial)
> backup of my Calibre collection.
> 
> > 
> > Thanks Sharon.
> > 
> 
> Try (though I 'suspect" ACTION is unnecessary):-
> ACTION=="add",SUBSYSTEM=="usb", ATTR{idVendor}=="1949",
> ATTR{idProduct}=="0004", MODE="0666",
> RUN+="/home/boudiccas/bin/obkindle"

This is /etc/udev/rules.d/85-kindle.rules as it is now -
# saved to /etc/udev/rules.d/85-kindle.rules
ACTION=="add", SYSFS{idVendor}=="1949", SYSFS{idProduct}=="0004",
RUN+="/home/boudiccas/bin/obkindle" 
#ACTION=="add", SUBSYSTEM=="usb",
ATTR{idVendor}=="1949", ATTR{idProduct}=="0004", MODE="0666",
RUN+="/home/boudiccas/bin/obkindle"
Just two long lines, but the first line, #2 is actually quicker at
displaying the kindle than #3, and it still is not automounted. 

I've attached a file 'kindlemount.txt' which shows the output of '
udevadm monitor --udev', 'sudo grep Kindle /var/log/syslog', and
'lsusb'. 
> 
> Look at:-
> $ grep kindle /var/log/syslog
> you'll probably find "unknown key 'SYSFS" and other useful hints
> also "udevadm monitor --kernel" and "udevadm monitor --udev" will give
> you some real-time info about udev.

Theres no difference in the syslog whether I run with 'SYSFS' or
'ATTR', neither show up specifically
> 
> Don't forget to "# udevadm control --reload-rules" when you add a new
> udev rule.
> 
You're right, I did forget, but thanks for the reminder. :)

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
efever = http://www.efever.blogspot.com/
efever = http://sharon04.livejournal.com/
my git repo = https://bitbucket.org/boudiccas/dots
Debian testing, Fluxbox 1.3.5, LibreOffice 4.1.3.2
Registered Linux user 561944
 udevadm monitor --udev
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing

UDEV  [181453.330110] remove   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host15/target15:0:0/15:0:0:0/block/sde/sde1 (block)
UDEV  [181453.662839] change   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host15/target15:0:0/15:0:0:0/block/sde (block)
UDEV  [181453.680790] change   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host15/target15:0:0/15:0:0:0/block/sde (block)
UDEV  [181476.027784] remove   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host15/target15:0:0/15:0:0:0/bsg/15:0:0:0 (bsg)
UDEV  [181476.028411] remove   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host15/target15:0:0/15:0:0:0/scsi_device/15:0:0:0 (scsi_device)
UDEV  [181476.029119] remove   /devices/virtual/bdi/8:64 (bdi)
UDEV  [181476.029626] remove   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host15/target15:0:0/15:0:0:0/scsi_disk/15:0:0:0 (scsi_disk)
UDEV  [181476.029837] remove   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host15/target15:0:0/15:0:0:0/block/sde (block)
UDEV  [181476.030386] remove   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host15/target15:0:0/15:0:0:0/scsi_generic/sg5 (scsi_generic)
UDEV  [181476.030407] remove   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host15/target15:0:0/15:0:0:0 (scsi)
UDEV  [181476.030922] remove   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host15/scsi_host/host15 (scsi_host)
UDEV  [181476.032021] remove   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host15/target15:0:0 (scsi)
UDEV  [181476.032509] remove   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host15 (scsi)
UDEV  [181476.032897] remove   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0 (usb)
UDEV  [181476.130002] remove   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1 (usb)
UDEV  [181492.709829] add      /devices/virtual/bdi/8:64 (bdi)
UDEV  [181522.721091] add      /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1 (usb)
UDEV  [181523.005093] add      /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0 (usb)
UDEV  [181523.007076] add      /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host16 (scsi)
UDEV  [181523.008990] add      /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host16/target16:0:0 (scsi)
UDEV  [181523.015081] add      /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host16/scsi_host/host16 (scsi_host)
UDEV  [181523.018188] add      /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host16/target16:0:0/16:0:0:0 (scsi)
UDEV  [181523.019240] add      /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host16/target16:0:0/16:0:0:0/scsi_disk/16:0:0:0 (scsi_disk)
UDEV  [181523.019953] add      /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host16/target16:0:0/16:0:0:0/scsi_device/16:0:0:0 (scsi_device)
UDEV  [181523.023102] add      /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host16/target16:0:0/16:0:0:0/scsi_generic/sg5 (scsi_generic)
UDEV  [181523.024059] add      /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host16/target16:0:0/16:0:0:0/bsg/16:0:0:0 (bsg)
UDEV  [181523.967078] add      /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host16/target16:0:0/16:0:0:0/block/sde (block)
UDEV  [181524.202851] change   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host16/target16:0:0/16:0:0:0/block/sde (block)
UDEV  [181524.408557] change   /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host16/target16:0:0/16:0:0:0/block/sde (block)
UDEV  [181524.625350] add      /devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2.4/1-2.4.1/1-2.4.1:1.0/host16/target16:0:0/16:0:0:0/block/sde/sde1 (block)

Dec 12 10:54:49 london kernel: [180636.870193] usb 1-2.4.1: Product: Amazon Kindle
Dec 12 10:54:50 london kernel: [180637.883358] scsi 15:0:0:0: Direct-Access     Kindle   Internal Storage 0100 PQ: 0 ANSI: 2
Dec 12 10:55:19 london udisksd[5448]: Mounted /dev/sde1 at /media/boudiccas/Kindle on behalf of uid 1000

Bus 001 Device 030: ID 1949:0004 Lab126, Inc. Amazon Kindle 3/4/Paperwhite

Attachment: signature.asc
Description: PGP signature


Reply to: