// File: /workspace/github_cpp_makefile_star2_O1/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 0x5d9a
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 0x4abc
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 0x5e88
callq 0x4030
movl (%rax), %edx
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5be8
xorl %ebp, %ebp
leaq 0xadaa(%rip), %rsi      # 0xf6f0
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 0x5e88
callq 0x4030
movl (%rax), %edx
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5be8
xorl %ebp, %ebp
leaq 0xad48(%rip), %rsi      # 0xf6f0
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 0x5e88
callq 0x4030
movl (%rax), %edx
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5be8
xorl %ebp, %ebp
leaq 0xace6(%rip), %rsi      # 0xf6f0
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 0x5e88
callq 0x4030
movl (%rax), %edx
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x5be8
xorl %ebp, %ebp
leaq 0xac87(%rip), %rsi      # 0xf6f0
movq 0xb530(%rip), %rdx      # 0xffa0
movq %rbx, %rdi
callq 0x4520
jmp 0x4a84
jmp 0x4aa0
jmp 0x4a84
jmp 0x4aa0
jmp 0x4a84
jmp 0x4aa0
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4aa6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42c0
jmp 0x4aa6
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x4ab3
movq %rbx, %rdi
callq 0x41e0
movq %r14, %rdi
callq 0x4550
nop