// File: /workspace/github_cpp_makefile_star2_O2/merelin[P]mediasmartserverd/src/device_monitor.cpp
// Function: DeviceMonitor::Init(std::tr1::shared_ptr<LedControlBase> const&)
void DeviceMonitor::Init( const LedControlPtr& leds ) {
	leds_ = leds;
	
	// get udev library context
	dev_context_ = udev_new();
	if ( !dev_context_ ) throw ErrnoException( "udev_new" );
	
	// set up udev monitor
	dev_monitor_ = udev_monitor_new_from_netlink( dev_context_, "udev" );
	if ( !dev_monitor_ ) throw ErrnoException( "udev_monitor_new_from_netlink" );
	
	// only interested in scsi devices
	if ( udev_monitor_filter_add_match_subsystem_devtype( dev_monitor_, "scsi", "scsi_device" ) ) {
		throw ErrnoException( "udev_monitor_filter_add_match_subsystem_devtype" );
	}
	
	// enumerate existing devices
	enumDevices_( );
	
	// then start monitoring
	if ( udev_monitor_enable_receiving( dev_monitor_ ) ) {
		throw ErrnoException( "udev_monitor_enable_receiving" );
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
addq $0x10, %rdi
callq 0x57de
callq 0x43c0
movq %rax, (%rbx)
testq %rax, %rax
je 0x48f1
leaq 0x5771(%rip), %rsi      # 0xa00d
movq %rax, %rdi
callq 0x40a0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x4946
leaq 0x5778(%rip), %rsi      # 0xa030
leaq 0x5776(%rip), %rdx      # 0xa035
movq %rax, %rdi
callq 0x44c0
testl %eax, %eax
jne 0x499b
movq %rbx, %rdi
callq 0x4a70
movq 0x8(%rbx), %rdi
callq 0x4200
testl %eax, %eax
jne 0x49ed
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x4160
movq %rax, %rbx
leaq 0x5701(%rip), %rsi      # 0xa004
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5694
callq 0x4030
movl (%rax), %edx
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x56d0
xorl %ebp, %ebp
leaq 0xadae(%rip), %rsi      # 0xf6e0
movq 0xb667(%rip), %rdx      # 0xffa0
movq %rbx, %rdi
callq 0x4530
jmp 0x4a3d
pushq $0x10
popq %rdi
callq 0x4160
movq %rax, %rbx
leaq 0x56ba(%rip), %rsi      # 0xa012
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5694
callq 0x4030
movl (%rax), %edx
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x56d0
xorl %ebp, %ebp
leaq 0xad59(%rip), %rsi      # 0xf6e0
movq 0xb612(%rip), %rdx      # 0xffa0
movq %rbx, %rdi
callq 0x4530
jmp 0x4a3d
pushq $0x10
popq %rdi
callq 0x4160
movq %rax, %rbx
leaq 0x5694(%rip), %rsi      # 0xa041
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5694
callq 0x4030
movl (%rax), %edx
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x56d0
xorl %ebp, %ebp
leaq 0xad04(%rip), %rsi      # 0xf6e0
movq 0xb5bd(%rip), %rdx      # 0xffa0
movq %rbx, %rdi
callq 0x4530
jmp 0x4a3d
pushq $0x10
popq %rdi
callq 0x4160
movq %rax, %rbx
leaq 0x5672(%rip), %rsi      # 0xa071
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5694
callq 0x4030
movl (%rax), %edx
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x56d0
xorl %ebp, %ebp
leaq 0xacb2(%rip), %rsi      # 0xf6e0
movq 0xb56b(%rip), %rdx      # 0xffa0
movq %rbx, %rdi
callq 0x4530
jmp 0x4a49
jmp 0x4a5d
jmp 0x4a49
jmp 0x4a5d
jmp 0x4a49
jmp 0x4a5d
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x4150
testb %bpl, %bpl
jne 0x4a60
jmp 0x4a68
movq %rax, %r14
movq %rbx, %rdi
callq 0x4220
movq %r14, %rdi
callq 0x4550