// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq (%rsi), %rax
movq %rax, 0x10(%rdi)
addq $0x18, %rdi
addq $0x8, %rsi
callq 0x5d98
callq 0x4380
movq %rax, (%rbx)
testq %rax, %rax
je 0x48f8
leaq 0x676c(%rip), %rsi      # 0xb00d
movq %rax, %rdi
callq 0x4090
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x495a
leaq 0x6773(%rip), %rsi      # 0xb030
leaq 0x6771(%rip), %rdx      # 0xb035
movq %rax, %rdi
callq 0x4490
testl %eax, %eax
jne 0x49bc
movq %rbx, %rdi
callq 0x4ab8
movq 0x8(%rbx), %rdi
callq 0x41c0
testl %eax, %eax
jne 0x4a1b
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x4140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x66ef(%rip), %rsi      # 0xb004
leaq 0x66f0(%rip), %rdx      # 0xb00c
leaq 0x8(%rsp), %rdi
callq 0x5e90
callq 0x4030
movl (%rax), %edx
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5be6
xorl %ebp, %ebp
leaq 0xae3a(%rip), %rsi      # 0xf780
movq 0xb653(%rip), %rdx      # 0xffa0
movq %rbx, %rdi
callq 0x4520
jmp 0x4a78
movl $0x10, %edi
callq 0x4140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x669b(%rip), %rsi      # 0xb012
leaq 0x66b1(%rip), %rdx      # 0xb02f
leaq 0x8(%rsp), %rdi
callq 0x5e90
callq 0x4030
movl (%rax), %edx
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5be6
xorl %ebp, %ebp
leaq 0xadd8(%rip), %rsi      # 0xf780
movq 0xb5f1(%rip), %rdx      # 0xffa0
movq %rbx, %rdi
callq 0x4520
jmp 0x4a78
movl $0x10, %edi
callq 0x4140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x6668(%rip), %rsi      # 0xb041
leaq 0x6690(%rip), %rdx      # 0xb070
leaq 0x8(%rsp), %rdi
callq 0x5e90
callq 0x4030
movl (%rax), %edx
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5be6
xorl %ebp, %ebp
leaq 0xad76(%rip), %rsi      # 0xf780
movq 0xb58f(%rip), %rdx      # 0xffa0
movq %rbx, %rdi
callq 0x4520
jmp 0x4a78
movl $0x10, %edi
callq 0x4140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x6639(%rip), %rsi      # 0xb071
leaq 0x664f(%rip), %rdx      # 0xb08e
leaq 0x8(%rsp), %rdi
callq 0x5e90
callq 0x4030
movl (%rax), %edx
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5be6
xorl %ebp, %ebp
leaq 0xad17(%rip), %rsi      # 0xf780
movq 0xb530(%rip), %rdx      # 0xffa0
movq %rbx, %rdi
callq 0x4520
jmp 0x4a84
jmp 0x4aa5
jmp 0x4a84
jmp 0x4aa5
jmp 0x4a84
jmp 0x4aa5
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4a9e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42c0
testb %bpl, %bpl
jne 0x4aa8
jmp 0x4ab0
movq %rax, %r14
movq %rbx, %rdi
callq 0x41e0
movq %r14, %rdi
callq 0x4550