hotplug ** DISCONTINUED **

johnbock

Mitglied
Mitglied seit
2 Mrz 2008
Beiträge
310
Punkte für Reaktionen
0
Punkte
0
Support for this thread has been discontinued by the author. This hotplug implementation has been abandoned in favor for mdev.







The current hotplug chain functions improperly. After looking into the cause of the irritation I have discovered a locking problem in the current system. It seems that the current hotplug system was specified with not more than two block devices (i.e. sda & sda1). IMHO this can be corrected only with a redesign.

The function of the current design is limited to only one hotplug subsystem (usb) ignoring all others (block, ...) and thus requiring locking. To circumvent this, I propose to use the hotplug system as is was implemented: as a state-machine. Following is a time-line documenting my intension.
Code:
t0             --> t1                    --> t2             --> t3

load usbcore
(usbfs)
load musb_hdrc

                   usb                       block              block
                   add                       add                mount

               1-> hub (9.0.0)

               2-> mass storage (8.6.xx)
                   load usb_storage
                   load sd_mod
                                         3-> sda
                                             exec mknod
                                             exec tune
                                             exec hdparm
                                             exec sg3-tools

                                         4-> sda1
                                             exec mknod
                                             exec blkid
                                             swapon device

                                         5-> sda2           6-> sda2
                                             exec mknod         swapon file
                                             exec blkid         start apps
                                             load ext2
                                             exec fsck
                                             exec mount

At t0 (sometime at boot) the modules usbcore and musb_hdrc must be inserted into the kernel. This process does not require inserting nor mounting usbfs. These will 'discover' the hub which will in turn 'discover' any connected (and powered) usb devices. These actions kick-off the above example with chain lead at 2). Here my micro disk.

2) The usb device interface is discovered. This announces itself as the interface 8.6.50: of the mass storage class (8 ), transparent scsi command set subclass (6) with the intrface protocol 'bulk' (50). At this point the appropriate modules usb_storage and sd_mod shall be inserted.
3-5) Here the disk and partitions of the device are 'discovered' and made available. These events are triggered as the nodes are available. Finally, sda2 is mounted.
6) After the node has been successfully mounted, hotplug triggers the corresponding event. Then any required applications may be executed.

I expect this to be minimally intrusive to the current system. I propose triggering the new system when two avm configuration properties are off:
1) aurad
2) ftpd
With these off we are free to implement the above as required.

A proof of concept has been implemented using the following structure containing several files restricting hotplug behavior to the above time line.
Code:
fritzbox@new-york:~/freetz/hotplug/src$ ls -lR | egrep '^(d|\.|-).*'
.:
drwxr-x--- 2 fritzbox fritzbox 176 2008-04-13 19:56 device
drwxr-x--- 2 fritzbox fritzbox 232 2008-04-13 20:03 event
-rwxr-x--- 1 fritzbox fritzbox 457 2008-04-12 10:31 hotplug
drwxr-x--- 2 fritzbox fritzbox 184 2008-04-13 20:03 lib

./device:
-rw-r----- 1 fritzbox fritzbox 2200 2008-04-11 17:30 avmusbwlan.add
-rw-r----- 1 fritzbox fritzbox  297 2008-04-11 17:30 avmusbwlan.remove
-rw-r----- 1 fritzbox fritzbox  217 2008-04-09 12:56 disk.add
-rw-r----- 1 fritzbox fritzbox  570 2008-04-12 14:29 partition.add
./event:
-rw-r----- 1 fritzbox fritzbox 426 2008-04-13 19:56 block.add
-rw-r----- 1 fritzbox fritzbox 579 2008-04-13 11:45 block.mount
-rw-r----- 1 fritzbox fritzbox 135 2008-04-13 08:53 block.remove
-rw-r----- 1 fritzbox fritzbox 641 2008-04-13 11:42 block.umount
-rw-r----- 1 fritzbox fritzbox 300 2008-04-13 18:00 usb.add
-rw-r----- 1 fritzbox fritzbox 380 2008-04-12 10:39 usb_device.add
./lib:
-rw-r----- 1 fritzbox fritzbox  129 2008-04-11 17:27 ar7value
-rwxr-x--- 1 fritzbox fritzbox 9992 2008-04-11 09:07 avmusbwlanstart
-rw-r----- 1 fritzbox fritzbox  278 2008-04-11 17:29 led
-rw-r----- 1 fritzbox fritzbox  292 2008-04-11 17:28 loadmodules
-rw-r----- 1 fritzbox fritzbox 2407 2008-04-13 20:03 mount

The files in the event directory are sourced by the program specified in /proc/sys/kernel/hotplug. The names are indicative to hotplug function: i.e. usb.add will be called when a new usb device has been connected to the system.

The contents of the device directory shall be logically grouped to action and device subclass: i.e. disk.add is sourced as a block device with a node MINOR of 0 becomes available. Last but not least, the lib directory contains files performing specific tasks.

Each of the files in the lib directory contain a single function or a group of logically related functions including a function to eliminate these from the current environment. The naming convention for the contents of a file is <filename>[_<function>[_<sub function>]]. For example, a file led contains the several functions to control the LEDs on the housing. Depending on function these could be named led_on, led_set, led_off, led_clean. The functions on, off and set control the behavior of the LEDs, while clean removes all led_<functions> from the environment. This function will either be called automatically (as in the case of mount) or may be called from the sourcing program.



Being relatively new to freetz I do require more information and a rigorous discussion concerning this subject. Oh, and please feel free to write in German. I will continue to write in English;)



Please note: the attached archive is for review purposes only. It is highly recommended not to install this package.
 

Anhänge

  • hotplug-proposal.tgz
    4.6 KB · Aufrufe: 3
  • hotplug-proposal_0.1.tgz
    6.9 KB · Aufrufe: 2
  • hotplug-proposal_0.3.tgz
    7.4 KB · Aufrufe: 1
  • hotplug-proposal_0.3.1.tgz
    7.4 KB · Aufrufe: 4
Zuletzt bearbeitet:
10.Apr.2008 updated propsal
1) described example chain
2) attached proof of concept
 
initial operation

With the implementation version 0.1 of the hotplug proposal I was able get hotplugging to perform the operations documented in the time-line.

Prerequisites and presumptions:
1) no connected usb devices
2) copied proposal implementation v0.1 onto the box, default /tmp/_dev_hot_plug_
3) hotplug program path of 1) loaded to /proc/sys/kernel/hotplug
4) usb hard disk
5) delete corresponding device nodes in /dev
6) absence of the kernel modules scsi_mod, sd_mod, usb_storage, ext2, ext3, mbcache, fat, vfat, nls_iso8859-1, nls_cp437
7) the program blkid of the e2fs-tools is in $PATH

The implementation can handle certain error conditions such as the presence of the above modules and missing mount points. This run should show that the system is able to handle missing the above. In other words, the proposal can be used at boot;)

For this run I have added two entries to /etc/fstab:
Code:
UUID=a43c59fa-8c6c-4ab1-9fb5-56055bbb84e9 none swap sw          0       0
UUID=8767bfe9-6747-4937-81c3-eb56d1b76d22 /var/opt ext2 noatime,nodiratime 0  1

Here the results from syslog
Code:
Apr 12 10:51:36 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 12 10:51:36 fritz local0.debug hotplug: starting hotplug chain 'usb.add'
Apr 12 10:51:36 fritz local0.debug hotplug: starting hotplug chain 'usb.add'
Apr 12 10:51:36 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 12 10:51:36 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 12 10:51:36 fritz local0.debug hotplug: starting hotplug chain 'usb_device.add'
Apr 12 10:51:36 fritz local0.debug hotplug: loading usb-storage kernel module
Apr 12 10:51:37 fritz local0.debug hotplug: ignoring 'module.add' hotplug event
Apr 12 10:51:37 fritz local0.info hotplug: attached device 'TrekStor - HS020GB '
Apr 12 10:51:37 fritz local0.debug hotplug: ignoring 'module.add' hotplug event
Apr 12 10:51:37 fritz local0.debug hotplug: ignoring 'drivers.add' hotplug event
Apr 12 10:51:37 fritz local0.debug hotplug: ignoring 'scsi_host.add' hotplug event
Apr 12 10:51:37 fritz local0.debug hotplug: loading sd_mod kernel module
Apr 12 10:51:37 fritz local0.debug hotplug: ignoring 'module.add' hotplug event
Apr 12 10:51:37 fritz local0.debug hotplug: ignoring 'drivers.add' hotplug event
Apr 12 10:51:42 fritz local0.debug hotplug: ignoring 'scsi.add' hotplug event
Apr 12 10:51:42 fritz local0.debug hotplug: ignoring 'scsi_disk.add' hotplug event
Apr 12 10:51:42 fritz local0.debug hotplug: starting hotplug chain 'block.add'
Apr 12 10:51:43 fritz local0.debug hotplug: starting hotplug chain 'block.add'
Apr 12 10:51:43 fritz local0.debug hotplug: ignoring 'scsi_device.add' hotplug event
Apr 12 10:51:43 fritz local0.debug hotplug: starting hotplug chain 'block.add'
Apr 12 10:51:43 fritz local0.debug hotplug: loading swap kernel module
Apr 12 10:51:43 fritz local0.err hotplug: modprobe: module swap not found
Apr 12 10:51:43 fritz local0.err hotplug: modprobe: failed to load module swap
Apr 12 10:51:43 fritz local0.debug hotplug: loading ext2 kernel module
Apr 12 10:51:43 fritz local0.info hotplug: activated swap on '/dev/sda1'
Apr 12 10:51:43 fritz local0.debug hotplug: ignoring 'module.add' hotplug event
Apr 12 10:51:43 fritz local0.debug hotplug: ignoring 'module.add' hotplug event
Apr 12 10:51:43 fritz local0.info hotplug: created mount point '/var/opt'
Apr 12 10:51:43 fritz local0.debug hotplug: m_fst=>ext2< m_src=>/dev/sda2< m_dst=>/var/opt< m_opt=>-o noatime,nodiratime<
Apr 12 10:51:44 fritz local0.debug hotplug: starting hotplug chain 'block.mount'
Apr 12 10:51:44 fritz local0.info hotplug: not starting any applications on '/var/opt'
Apr 12 10:51:44 fritz local0.info hotplug: mounted '/dev/sda2' on '/var/opt' with options 'noatime,nodiratime'

with out debug messages
Code:
Apr 12 10:51:37 fritz local0.info hotplug: attached device 'TrekStor - HS020GB '
Apr 12 10:51:43 fritz local0.err hotplug: modprobe: module swap not found
Apr 12 10:51:43 fritz local0.err hotplug: modprobe: failed to load module swap
Apr 12 10:51:43 fritz local0.info hotplug: activated swap on '/dev/sda1'
Apr 12 10:51:43 fritz local0.info hotplug: created mount point '/var/opt'
Apr 12 10:51:44 fritz local0.info hotplug: not starting any applications on '/var/opt'
Apr 12 10:51:44 fritz local0.info hotplug: mounted '/dev/sda2' on '/var/opt' with options 'noatime,nodiratime'

and a few other systems...
Code:
/var # lsmod
Module                  Size  Used by    Tainted: P  
ext2                   58194  1 
mbcache                 7035  1 ext2
sd_mod                 17211  3 
usb_storage            36164  2 
scsi_mod               92657  2 sd_mod,usb_storage
userman                32623  2 
wlan_scan_ap           11051  1 
wlan_acl                4478  1 
wlan_wep                6623  0 
wlan_tkip              13986  2 
wlan_ccmp               9315  1 
wlan_xauth              1182  0 
ath_pci               158200  0 
ath_rate_atheros       29493  1 ath_pci
wlan                  246993  9 wlan_scan_ap,wlan_acl,wlan_wep,wlan_tkip,wlan_ccmp,wlan_xauth,ath_pci,ath_rate_atheros
ath_hal               203744  3 ath_pci,ath_rate_atheros
ath_dfs                24350  1 ath_pci
avm_ath_extensions     28085  3 ath_pci,wlan,ath_hal
kdsldmod              882042  5 userman
musb_hdrc              35988  0 
usbcore               126185  3 usb_storage,musb_hdrc
dect_io                21060  2 
avm_dect              549025  1 dect_io
capi_codec             93998  0 
isdn_fbox_fon5        764139  0 
pcmlink               156761  3 avm_dect,capi_codec,isdn_fbox_fon5
dsl_ur8               166948  0 
jffs2                 115489  1 
Piglet_noemif          21607  0

Code:
/var # ls -l /dev/sd*
brw-rw----    1 root     root       8,   0 Apr 12 10:51 /dev/sda
brw-rw----    1 root     root       8,   1 Apr 12 10:51 /dev/sda1
brw-rw----    1 root     root       8,   2 Apr 12 10:51 /dev/sda2

Code:
/var # cat /proc/partitions 
major minor  #blocks  name

  31     0       6725 mtdblock0
  31     1        890 mtdblock1
  31     2         64 mtdblock2
  31     3        256 mtdblock3
  31     4        256 mtdblock4
  31     5        384 mtdblock5
   8     0   19569312 sda
   8     1     125936 sda1
   8     2   19442688 sda2

Code:
/var # cat /proc/swaps 
Filename                                Type            Size    Used    Priority
/dev/sda1                               partition       125928  0       -6

Code:
/var # mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
dev on /dev type tmpfs (rw,nosuid)
proc on /proc type proc (rw,nosuid,nodev,noexec)
ramfs on /var type ramfs (rw)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec)
/dev/mtdblock5 on /data type jffs2 (rw)
ramfs on /data/tam/rec type ramfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda2 on /var/opt type ext2 (rw,noatime,nodiratime)
 
Zuletzt bearbeitet:
The proposal version 0.3 is working as expected for memory keys containing a fat filesystem. Unconfigured block devices are being properly recognized and mounted as they were under /var/media/ftp/uStor??. Currently the loaded modules are not being unloaded after use. However, directories and device nodes are being deleted.

All connected block devices must manually unmounted before detachment.

All types of USB devices are being properly recognized, although not automatically configured: missing modules and the like...

Following is the syslog as I attached a usb-serial device and a avm usb wlan stick n.
Code:
Apr 13 12:05:25 fritz local0.debug hotplug: starting hotplug chain 'usb.add'
Apr 13 12:05:25 fritz local0.debug hotplug: starting hotplug chain 'usb.add'
Apr 13 12:05:25 fritz local0.err hotplug: unrecognized interface 255/0/0
Apr 13 12:05:25 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 13 12:05:25 fritz local0.debug hotplug: starting hotplug chain 'usb_device.add'
Apr 13 12:05:25 fritz local0.info hotplug: attached device 'Prolific Technology Inc. - USB-Serial Controller'
Apr 13 12:05:25 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 13 12:05:25 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 13 12:05:25 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 13 12:07:12 fritz local0.debug hotplug: ignoring 'usb_endpoint.remove' hotplug event
Apr 13 12:07:12 fritz local0.debug hotplug: ignoring 'usb_endpoint.remove' hotplug event
Apr 13 12:07:12 fritz local0.debug hotplug: ignoring 'usb_endpoint.remove' hotplug event
Apr 13 12:07:12 fritz local0.debug hotplug: ignoring 'usb.remove' hotplug event
Apr 13 12:07:12 fritz local0.debug hotplug: ignoring 'usb_device.remove' hotplug event
Apr 13 12:07:12 fritz local0.debug hotplug: ignoring 'usb_endpoint.remove' hotplug event
Apr 13 12:07:12 fritz local0.debug hotplug: ignoring 'usb.remove' hotplug event
Apr 13 12:07:19 fritz local0.debug hotplug: starting hotplug chain 'usb.add'
Apr 13 12:07:20 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 13 12:07:20 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 13 12:07:20 fritz local0.debug hotplug: ignoring 'scsi_host.add' hotplug event
Apr 13 12:07:20 fritz local0.debug hotplug: starting hotplug chain 'usb.add'
Apr 13 12:07:20 fritz local0.err hotplug: unrecognized interface 8/2/80
Apr 13 12:07:20 fritz local0.debug hotplug: starting hotplug chain 'usb_device.add'
Apr 13 12:07:20 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 13 12:07:20 fritz local0.info hotplug: attached device 'AVM Berlin - FRITZ!WLAN USB Stick N'
Apr 13 12:07:25 fritz local0.debug hotplug: ignoring 'scsi_device.add' hotplug event
Apr 13 12:07:25 fritz local0.debug hotplug: ignoring 'scsi.add' hotplug event
Apr 13 12:07:50 fritz local0.debug hotplug: ignoring 'usb_endpoint.remove' hotplug event
Apr 13 12:07:50 fritz local0.debug hotplug: ignoring 'scsi_device.remove' hotplug event
Apr 13 12:07:50 fritz local0.debug hotplug: ignoring 'scsi.remove' hotplug event
Apr 13 12:07:50 fritz local0.debug hotplug: ignoring 'scsi_host.remove' hotplug event
Apr 13 12:07:50 fritz local0.debug hotplug: ignoring 'usb.remove' hotplug event
Apr 13 12:07:50 fritz local0.debug hotplug: ignoring 'usb_device.remove' hotplug event
Apr 13 12:07:50 fritz local0.debug hotplug: ignoring 'usb_endpoint.remove' hotplug event
Apr 13 12:07:50 fritz local0.debug hotplug: ignoring 'usb.remove' hotplug event
Apr 13 12:07:50 fritz local0.debug hotplug: ignoring 'usb_endpoint.remove' hotplug event
Apr 13 12:07:51 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 13 12:07:51 fritz local0.debug hotplug: starting hotplug chain 'usb.add'
Apr 13 12:07:51 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 13 12:07:51 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 13 12:07:51 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 13 12:07:51 fritz local0.debug hotplug: starting hotplug chain 'usb.add'
Apr 13 12:07:51 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 13 12:07:51 fritz local0.err hotplug: unrecognized interface 255/0/0
Apr 13 12:07:51 fritz local0.debug hotplug: starting hotplug chain 'usb_device.add'
Apr 13 12:07:51 fritz local0.info hotplug: attached device 'AVM Berlin - FRITZ!WLAN USB Stick N'
 
Now I've connected a hub and have three memory devices on the hub:
1) 1GB memory key
2) 64MB memory key
3) Sony Ericsson W900i

I got a few minor errors during plugging, but everything seems to be working correctly:
Code:
/var/mod/root # mount
rootfs on / type rootfs (rw)
/dev/root on / type squashfs (ro)
dev on /dev type tmpfs (rw,nosuid)
proc on /proc type proc (rw,nosuid,nodev,noexec)
ramfs on /var type ramfs (rw)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec)
/dev/mtdblock5 on /data type jffs2 (rw)
ramfs on /data/tam/rec type ramfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /var/media/ftp/uStor01 type vfat (rw,fmask=0000,dmask=0000,codepage=cp437,iocharset=iso8859-1)
/dev/sdb1 on /var/media/ftp/uStor11 type vfat (rw,fmask=0000,dmask=0000,codepage=cp437,iocharset=iso8859-1)
/dev/sdc1 on /var/media/ftp/uStor21 type vfat (rw,fmask=0000,dmask=0000,codepage=cp437,iocharset=iso8859-1)

syslog with out debug messages:
Code:
Apr 13 18:00:48 fritz local0.info hotplug: attached device 'NEC Corporation - USB2.0 Hub Controller'
Apr 13 18:08:31 fritz local0.info hotplug: attached device 'LEXAR MEDIA     - JUMPDRIVE GEYSR'
Apr 13 18:08:36 fritz local0.info hotplug: created mount point '/var/media/ftp/uStor01'
Apr 13 18:08:36 fritz local0.info hotplug: mounted '/dev/sda1' on '/var/media/ftp/uStor01' with 'rw,uid=0,gid=0,fmask=0000,dmask=0000'
Apr 13 18:08:37 fritz local0.info hotplug: not starting any applications on '/var/media/ftp/uStor01'
Apr 13 18:11:18 fritz local0.info hotplug: attached unidentified device at major '189' and minor '35'
Apr 13 18:11:24 fritz local0.err hotplug: '' unrecognized filesystem type on '/dev/sdb'
Apr 13 18:11:25 fritz local0.info hotplug: created mount point '/var/media/ftp/uStor11'
Apr 13 18:11:25 fritz local0.info hotplug: mounted '/dev/sdb1' on '/var/media/ftp/uStor11' with 'rw,uid=0,gid=0,fmask=0000,dmask=0000'
Apr 13 18:11:26 fritz local0.info hotplug: not starting any applications on '/var/media/ftp/uStor11'
Apr 13 18:40:33 fritz local0.info hotplug: attached device 'USB      - Storage Device  '
Apr 13 18:40:40 fritz local0.err hotplug: '' unrecognized filesystem type on '/dev/sdc'
Apr 13 18:40:41 fritz local0.info hotplug: created mount point '/var/media/ftp/uStor21'
Apr 13 18:40:41 fritz local0.info hotplug: mounted '/dev/sdc1' on '/var/media/ftp/uStor21' with 'rw,uid=0,gid=0,fmask=0000,dmask=0000'
Apr 13 18:40:42 fritz local0.info hotplug: not starting any applications on '/var/media/ftp/uStor21'
 

Anhänge

  • freetz.status.png
    freetz.status.png
    75.9 KB · Aufrufe: 61
Now that I finally found the time and was able to cleanup avm's stick'n'surf hotplug stuff (wow, that was a bugger!) I'm releasing version 0.4 of the hotplug replacement proposal.

Now I'm at point where I could use a little help: I need a some input as to which is the best freetz way to implement the last step in the hotplug chain - starting applications.

Which need to be started, when, priority and how the user may configure these...
 

Anhänge

  • hotplug-proposal_0.4.tgz
    8.1 KB · Aufrufe: 5
It's working at boot!!

Now I've integrated the proposal with freetz 2024. Seems to be working:)

Supported:
ext2, vfat
usb memory keys and HDs
avm usb wlan stick'n'surf
mini fons may work, don't have one to test
7270 (7170 may work, support has been turned-off)

Unsupported:
usb printer
usb bluetooth
all other usb devices not listed in supported

This is a development version and I cannot recommend it's installation. Although I have this installed and test it myself, I cannot take responsibility for any potential damage which may be incurred.

All that said and done...
The tar file may be unpacked in the freetz top-level directory. The patch must be applied (adds the hotplug replacement to the testing configuration menu). The hotplug replacement requires e2fsprogs but it's not being enforced at configuration time.

Here's a copy of my log when connected a usb HD.
Code:
Apr 21 22:46:38 fritz local0.debug hotplug: loading usb-storage kernel module
Apr 21 22:46:38 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 21 22:46:38 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 21 22:46:38 fritz local0.debug hotplug: ignoring 'usb_endpoint.add' hotplug event
Apr 21 22:46:38 fritz local0.info hotplug: attached device 'TrekStor - HS020GB '
Apr 21 22:46:39 fritz local0.debug hotplug: ignoring 'module.add' hotplug event
Apr 21 22:46:39 fritz local0.debug hotplug: ignoring 'module.add' hotplug event
Apr 21 22:46:39 fritz local0.debug hotplug: ignoring 'drivers.add' hotplug event
Apr 21 22:46:39 fritz local0.debug hotplug: ignoring 'scsi_host.add' hotplug event
Apr 21 22:46:39 fritz local0.debug hotplug: loading sd_mod kernel module
Apr 21 22:46:39 fritz local0.debug hotplug: ignoring 'module.add' hotplug event
Apr 21 22:46:39 fritz local0.debug hotplug: ignoring 'drivers.add' hotplug event
Apr 21 22:46:44 fritz local0.debug hotplug: ignoring 'scsi.add' hotplug event
Apr 21 22:46:44 fritz local0.debug hotplug: ignoring 'scsi_disk.add' hotplug event
Apr 21 22:46:45 fritz local0.debug hotplug: ignoring 'scsi_device.add' hotplug event
Apr 21 22:46:45 fritz local0.debug hotplug: loading ext2 kernel module
Apr 21 22:46:45 fritz local0.info hotplug: swap activated on '/dev/sda1'
Apr 21 22:46:45 fritz local0.debug hotplug: ignoring 'module.add' hotplug event
Apr 21 22:46:45 fritz local0.debug hotplug: ignoring 'module.add' hotplug event
Apr 21 22:46:45 fritz local0.info hotplug: created mount point '/var/media/ftp/uStor02'
Apr 21 22:46:45 fritz local0.debug hotplug: m_fst=>ext2< m_src=>/dev/sda2< m_dst=>/var/media/ftp/uStor02< m_opt=>-o noatime,nodiratime<
Apr 21 22:46:45 fritz local0.info hotplug: mounted '/var/media/ftp/uStor02' on '/dev/sda2' with 'noatime,nodiratime'
Apr 21 22:46:45 fritz local0.info hotplug: not starting any applications on '/var/media/ftp/uStor02'

There are no entries in syslog for the hotplug events at boot-time but the HD has been mounted! Both partitions: swap and uStor02;) Cooooool.
 

Anhänge

  • freetz_hotplug-0.4.0.tgz
    5.9 KB · Aufrufe: 7
  • freetz_hotplug.patch.gz
    536 Bytes · Aufrufe: 5
Compared to AVM's clutter your scripts look realy clean. :)

Greets Oliver
 
Hast du schonmal Swap + Samba und/oder RRDstats getestet? Viele hier im Forum hatten Probleme, dass dann Samba/RRDstats beendet wurde. Funktioniert dies?
PS: Ich hab mich noch nicht getraut dein neues hotplug zu testen, liest sich aber prima!
 
Hast du schonmal Swap + Samba und/oder RRDstats getestet? Viele hier im Forum hatten Probleme, dass dann Samba/RRDstats beendet wurde. Funktioniert dies?

At this point no programs are being started at plugging events...
I'd like to work out some kind of user configurable scheme as which programs are started when and with which priority.

But you're right, I should test something along these lines before we go further. Must I automatically start these at plug-time or is a manual start enough?

I had problems with mounting/swapping both partitions at boot, which is now working. Presently, they require manual umounting/swap-offing (hehe) before unplugging.

It be nice if we could umount/swap-off a partition in the status page. (This is independent of hotplug)

PS: Ich hab mich noch nicht getraut dein neues hotplug zu testen, liest sich aber prima!
That's understandable... With the integrated build it's as easy everything else in freetz to deinstall.
APROPOS deinstall. The build patches the device tables in root/etc and tools. These can be returned to their original state with a 'make hotplug-uninstall'.

olstudent schrieb:
Compared to AVM's clutter your scripts look realy clean.
Thanx!
 
So wie ich gelesen hatte waren Swap, Samba und RRDstats immer auf "automatisch" gestellt. D.h. dass Swap und RRDstats einmalig beim booten ausgeführt werden und Samba bei neuen Partitionen mittles "/etc/samba_control" immer restartet wird.
 
I would really like to see this in freetz. Maybe it's also possible to implement compatability with the aurad and avms ftpd? I don't know how these work, but I think some people want to use them and it would be much nicer if the hotplug package was independent of remove some other functionality. If this is possible, I would suggest to enable this new hotplug mechanism by default, and then it is also a solution to #2.

Perhaps we should really start a svn branch with this to be able to test it with some more boxes/configurations?
 
Perhaps we should really start a svn branch with this to be able to test it with some more boxes/configurations?

I do not think, that an new svn-branch ist the solution to test this on more platforms. But an actuial diff to a fresh trunk-checkoput ist the thing i would prefer.

The avm-storage-scripts need to be updated to use this with all the avm-stuff, do they?
 
So wie ich gelesen hatte waren Swap, Samba und RRDstats immer auf "automatisch" gestellt. D.h. dass Swap und RRDstats einmalig beim booten ausgeführt werden und Samba bei neuen Partitionen mittles "/etc/samba_control" immer restartet wird.

Swap partitions (automatic recognition) are being integrated at the event level. Swap files, on the other hand, are not.

I'd really like to see detach buttons for the active partitions in the freetz status page.

I think, we should start prioritizing the modules/programs for hotplug integration. Here's a list of things to which we should attach priority:

umount/swapoff support in freetz status page (avm tools are unaware and I don't want to add avm locking support: that was the reason it didn't work correctly in the first place)
ntfs automatic mount support
aurad (what's that called usbip?)
ftpd
samba
nfs
printing
bluetooth devices


As this gets larger with more support for various devices the number of files required increase. I don't think it's a good idea to clutter /etc with all of these and would like to place the various hotplug subsystems somewhere like /lib/hotplug or /usr/share/hotplug (the former being a better place to conform with common mounting schemes: i.e. boot requirement never in /usr).

I could get warm with the following directory structure.
Code:
/etc/hotplug        home to events, device and required library files 
            /event       event to device mapping
            /device      device to service/subsystem mapping
            /lib         required common library
/lib/hotplug        home to extended library and subsystem directives
            /lib         extended common library
            /mount       filesystem mount/umount directives
            /service     samba, nfs, smtp directives
            /config      service priority and hotplug service configuration
 
The avm-storage-scripts need to be updated to use this with all the avm-stuff, do they?

I do not recommend using nor patching the 'avm-stuff': it's much too complicated, buggy and too interwoven for easy maintenance. Additionally, supporting that would require event locking and that's source of our hotplugging wows!
 
I do not think, that an new svn-branch ist the solution to test this on more platforms.

Ok. I think this is a really big change to the current freetz package. Therefore, I'd vote for not targeting this change for inclusion in freetz-1.0, if we want to release anywhere in the near future. I'd focus on fixing the last obvious bugs and then release 1.0.

On the other hand, it is quite desirable to get this new hotplug architecture to work and be included in freetz as soon as possible. Starting a branch for this seems to be natural in my eyes, as on one hand, it does not conflict with a soon release of 1.0, but on the other hand, it allows for simple users to test this without too much hassle (get the right trunk the patch is for or adapt the patch every time trunk changes, ...), plus it allows for different developers to work on the different tasks involved with the implemenation (as mentioned by johnbock). That's the sense of svn imho.

But that's only my opinion.
 
You're really right, this is too much stuff for the outstanding 1.0-relaese. So a new milestone, a new trunk and anything else needed for that should be niche. But - with that - we should think about what we intend to put in the 1.0-relase, which has not been done right, does it?
 
Yes, you're right. Perhaps you open this discussion on the developer mailing list?
 
So wie ich gelesen hatte waren Swap, Samba und RRDstats immer auf "automatisch" gestellt. D.h. dass Swap und RRDstats einmalig beim booten ausgeführt werden und Samba bei neuen Partitionen mittles "/etc/samba_control" immer restartet wird.

I just tested this with connected usb HD and autostart RRDstats at boot: everything got mounted/swapped and started without any intervention;)
 
Seems very well designed, nice.
But one question: how is freetz_hotplug.patch applied?
something like: patch -p1 < freetz_hotplug.patch
or what else.
 

Zurzeit aktive Besucher

Statistik des Forums

Themen
246,308
Beiträge
2,249,812
Mitglieder
373,915
Neuestes Mitglied
sunburstc
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.