staging.inyokaproject.org

UDEV, USB und Smartphone

Status: Ungelöst | Ubuntu-Version: Ubuntu 11.10 (Oneiric Ocelot)
Antworten |

th3rdster

Avatar von th3rdster

Anmeldungsdatum:
20. November 2009

Beiträge: Zähle...

Hallo liebe Ubuntugemeinde,

Udev bringt mich zum Verzweifeln...

Ich möchte ein automatisches Backup Skript starten, sobald ich via USB mein Motorola Milestone anschliesse, welches die Fotos des Handys auf den PC kopiert. Das skript ist ok (läuft wenn manuell gestartet).

Nur die Udev Rules funktioniert nicht.

Ich bin nach der Anleitung udev vorgegangen.

1
ls usb -v

gibt:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
Bus 001 Device 004: ID 22b8:41db Motorola PCS Droid/Milestone (Debug mode)
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x22b8 Motorola PCS
  idProduct          0x41db Droid/Milestone (Debug mode)
  bcdDevice            2.16
  iManufacturer           1 Motorola
  iProduct                2 A853
  iSerial                 3 0403994602003017
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           55
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          4 Motorola Config 42
    bmAttributes         0xc0
      Self Powered
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk (Zip)
      iInterface              9 Motorola MSD Interface
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x86  EP 6 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x05  EP 5 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass     66 
      bInterfaceProtocol      1 
      iInterface             10 Motorola ADB Interface
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x87  EP 7 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x06  EP 6 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)

In /etc/udev/rules.d/75-milestone_backup.rules liegt folgender Eintrag:

1
SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="0x22b8", ATTRS{idProduct}=="0x41db", RUN+="gnome-terminal -e /usr/local/milestone_backup.sh"

Das Skript /usr/local/milestone_backup.sh hat Ausführungsrechte und funktioniert wenn manuell gestartet.

Wenn ich das Smartphone anschließe startet kein Skript.

Hat wer ähnliche Erfahrungen oder hat eine Ahnung warum?

LG th3rdster

TausB

Avatar von TausB

Anmeldungsdatum:
26. November 2009

Beiträge: 1570

Evtl. Zugriffsrechte auf die Schnittstelle? Teste einmal zusätzlich die Option:
MODE="666"

TausB

redknight Team-Icon

Moderator & Supporter
Avatar von redknight

Anmeldungsdatum:
30. Oktober 2008

Beiträge: 21863

Zeig mal dein Skript her. Und teste, ob es mit

env -i

läuft.

th3rdster

(Themenstarter)
Avatar von th3rdster

Anmeldungsdatum:
20. November 2009

Beiträge: Zähle...

Mit

1
env -i /usr/local/MLSTN_BU_UDEV.sh

läuft das shell script. (Habs umbenannt)

Mode="666" bringt leider auch nichts.

Meine Rule heisst: /etc/udev/rules.d/75-milestone_backup.rules (Kann hier was nicht stimmen?)

Darin eingetragen ist jetzt :

1
SUBSYSTEMS=="usb", MODE="666", ACTION=="add", ATTRS{idVendor}=="0x22b8", ATTRS{idProduct}=="0x41db", RUN+="gnome-terminal -e /usr/local/MLSTN_BU_UDEV.sh"

MLSTN_BU_UDEV.sh (vereinfacht):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
echo "$DATE" >> $MLSTN_HIST
echo "Milestone Sync in Progress"
rsync -abv --delete --progress --backup-dir=CHANGES-$DATE/ --exclude=dropbox/ --exclude=Music/ --exclude=Recycled/ --exclude=.Trash-1000/ --exclude=keepass/ --exclude=dcim/ $MLSTN_DRD/ $MLSTN_ARCHV/ >> $MLSTN_HIST
 
cp -av $MLSTN_KPSS_DDC/XXX.XXX $MLSTN_KPSS_DRD/ >> $MLSTN_HIST

rsync -av --progress $MLSTN_CM/ $MLSTN_CM_STRG/ >> $MLSTN_HIST
echo "#######################################################################" >> $MLSTN_HIST

echo "Press any Key to finish"
read foo

redknight Team-Icon

Moderator & Supporter
Avatar von redknight

Anmeldungsdatum:
30. Oktober 2008

Beiträge: 21863

th3rdster schrieb:

MLSTN_BU_UDEV.sh (vereinfacht):

*seufz* Schrieb ich vereinfacht? Ich wollte eben sehen, welche pfade und so weiter du benutzt. Genau das sieht man jetzt nicht.

th3rdster

(Themenstarter)
Avatar von th3rdster

Anmeldungsdatum:
20. November 2009

Beiträge: Zähle...

gg 😉

Das steht noch davor :

1
2
3
4
5
6
7
MLSTN_DRD=/media/DROID 
MLSTN_ARCHV=/media/STORAGE/00S_ARCHIVE/XXX
MLSTN_KPSS_DDC=/home/XXX/Dropbox-Decrypted/0D_KEEPASS
MLSTN_KPSS_DRD=/media/DROID/keepass
MLSTN_CM=/media/DROID/dcim/Camera 
MLSTN_CM_STRG=/media/STORAGE/PRIVAT/PICS/
MLSTN_HIST=/home/XXX/Dropbox-Decrypted/0D_SYSLOGS/MLSTN_HIST_HIST

redknight Team-Icon

Moderator & Supporter
Avatar von redknight

Anmeldungsdatum:
30. Oktober 2008

Beiträge: 21863

Ok, die Variablen sehen OK aus. Benutz mal absolute Pfade für rsync und cp. Interessant wäre auch, wenn Du herausfinden kannst, was genau schief läuft.

Antworten |