Diffstat (limited to 'noncore/net/opietooth/lib/device.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/lib/device.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/net/opietooth/lib/device.cc b/noncore/net/opietooth/lib/device.cc index 2f04d46..88d4cf9 100644 --- a/noncore/net/opietooth/lib/device.cc +++ b/noncore/net/opietooth/lib/device.cc | |||
@@ -117,49 +117,52 @@ void Device::slotExited( OProcess* proc) | |||
117 | owarn << "normalExit" << oendl; | 117 | owarn << "normalExit" << oendl; |
118 | int ret = m_process->exitStatus(); | 118 | int ret = m_process->exitStatus(); |
119 | if( ret == 0 ){ // attached | 119 | if( ret == 0 ){ // attached |
120 | owarn << "attached" << oendl; | 120 | owarn << "attached" << oendl; |
121 | owarn << "Output: " << m_output.data() << oendl; | 121 | owarn << "Output: " << m_output.data() << oendl; |
122 | pid = parsePid( m_output ); | 122 | pid = parsePid( m_output ); |
123 | owarn << "Pid = " << pid << oendl; | 123 | owarn << "Pid = " << pid << oendl; |
124 | // now hciconfig hci0 up ( determine hciX FIXME) | 124 | // now hciconfig hci0 up ( determine hciX FIXME) |
125 | // and call hciconfig hci0 up | 125 | // and call hciconfig hci0 up |
126 | // FIXME hardcoded to hci0 now :( | 126 | // FIXME hardcoded to hci0 now :( |
127 | m_hci = new OProcess( ); | 127 | m_hci = new OProcess( ); |
128 | *m_hci << "hciconfig"; | 128 | *m_hci << "hciconfig"; |
129 | *m_hci << "hci0 up"; | 129 | *m_hci << "hci0"; |
130 | *m_hci << "up"; | ||
130 | connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), | 131 | connect(m_hci, SIGNAL( processExited(Opie::Core::OProcess*) ), |
131 | this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); | 132 | this, SLOT( slotExited(Opie::Core::OProcess* ) ) ); |
132 | if(!m_hci->start() ){ | 133 | if(!m_hci->start() ){ |
133 | owarn << "could not start" << oendl; | 134 | owarn << "could not start" << oendl; |
134 | m_attached = false; | 135 | m_attached = false; |
135 | emit device("hci0", false ); | 136 | emit device("hci0", false ); |
136 | } | 137 | } |
137 | }else{ | 138 | }else{ |
138 | owarn << "crass" << oendl; | 139 | owarn << "crass" << oendl; |
139 | m_attached = false; | 140 | m_attached = false; |
140 | emit device("hci0", false ); | 141 | emit device("hci0", false ); |
141 | 142 | ||
142 | } | 143 | } |
143 | } | 144 | } |
144 | delete m_process; | 145 | delete m_process; |
145 | m_process = 0; | 146 | m_process = 0; |
146 | }else if(proc== m_hci ){ | 147 | }else if(proc== m_hci ){ |
147 | owarn << "M HCI exited" << oendl; | 148 | owarn << "M HCI exited" << oendl; |
148 | if( m_hci->normalExit() ){ | 149 | if( m_hci->normalExit() ){ |
149 | owarn << "normal exit" << oendl; | 150 | owarn << "normal exit" << oendl; |
150 | int ret = m_hci->exitStatus(); | 151 | int ret = m_hci->exitStatus(); |
151 | if( ret == 0 ){ | 152 | if( ret == 0 ){ |
152 | owarn << "attached really really attached" << oendl; | 153 | owarn << "attached really really attached" << oendl; |
153 | m_attached = true; | 154 | m_attached = true; |
155 | //Wait for a device to be brought up | ||
156 | ::sleep(1); | ||
154 | emit device("hci0", true ); | 157 | emit device("hci0", true ); |
155 | }else{ | 158 | }else{ |
156 | owarn << "failed" << oendl; | 159 | owarn << "failed" << oendl; |
157 | emit device("hci0", false ); | 160 | emit device("hci0", false ); |
158 | m_attached = false; | 161 | m_attached = false; |
159 | } | 162 | } |
160 | }// normal exit | 163 | }// normal exit |
161 | delete m_hci; | 164 | delete m_hci; |
162 | m_hci = 0; | 165 | m_hci = 0; |
163 | } | 166 | } |
164 | } | 167 | } |
165 | void Device::slotStdOut(OProcess* proc, char* chars, int len) | 168 | void Device::slotStdOut(OProcess* proc, char* chars, int len) |