Bluetooth Module로 PSKEY 전달 및 리셋
# bccmd -t bcsp -d /dev/ttyS4 -b 115200 psload -r /root/my.psr Loading PSKEY_PCM_CONFIG32 ... done Loading PSKEY_USE_OLD_BCSP_LE ... done Loading PSKEY_PCM_CVSD_USE_NEW_FILTER ... done Loading PSKEY_PCM_FORMAT ... done Loading PSKEY_CODEC_OUT_GAIN ... done Loading PSKEY_CODEC_IN_GAIN ... done Loading PSKEY_PCM_LOW_JITTER_CONFIG ... done Loading PSKEY_HOSTIO_SCO_PCM_THRESHOLDS ... done Loading PSKEY_HOSTIO_SCO_HCI_THRESHOLDS ... done Loading PSKEY_HOSTIO_MAP_SCO_PCM_SLOT ... done Loading PSKEY_UART_BAUDRATE ... done Loading PSKEY_UART_CONFIG_BCSP ... done Loading PSKEY_UART_CONFIG_H4 ... done Loading PSKEY_UART_CONFIG_H5 ... done Loading PSKEY_UART_CONFIG_USR ... done Loading PSKEY_UART_TX_CRCS ... done Loading PSKEY_UART_ACK_TIMEOUT ... done Loading PSKEY_UART_TX_MAX_ATTEMPTS ... done Loading PSKEY_UART_TX_WINDOW_SIZE ... done Loading PSKEY_UART_HOST_WAKE ... done Loading PSKEY_HOSTIO_THROTTLE_TIMEOUT ... done Loading PSKEY_PCM_ALWAYS_ENABLE ... done Loading PSKEY_UART_HOST_WAKE_SIGNAL ... done Loading PSKEY_UART_CONFIG_H4DS ... done Loading PSKEY_H4DS_WAKE_DURATION ... done Loading PSKEY_H4DS_MAXWU ... done Loading PSKEY_H4DS_LE_TIMER_PERIOD ... done Loading PSKEY_H4DS_TWU_TIMER_PERIOD ... done Loading PSKEY_H4DS_UART_IDLE_TIMER_PERIOD ... done Loading 0x01e5 ... done Loading 0x01eb ... done Loading 0x01ec ... done Loading 0x01ed ... done Loading 0x01f0 ... done Loading PSKEY_ANA_FTRIM ... done Loading PSKEY_WD_TIMEOUT ... done Loading PSKEY_WD_PERIOD ... done Loading PSKEY_HOST_INTERFACE ... done Loading PSKEY_HQ_HOST_TIMEOUT ... done Loading PSKEY_HQ_ACTIVE ... done Loading PSKEY_BCCMD_SECURITY_ACTIVE ... done Loading PSKEY_ANA_FREQ ... done Loading PSKEY_PIO_PROTECT_MASK ... done Loading PSKEY_STUB ... done Loading PSKEY_TXRX_PIO_CONTROL ... done Loading PSKEY_ANA_RX_LEVEL ... done Loading PSKEY_ANA_RX_FTRIM ... done Loading PSKEY_PSBC_DATA_VERSION ... done Loading PSKEY_PCM0_ATTENUATION ... done Loading PSKEY_LO_LVL_MAX ... done Loading PSKEY_LO_ADC_AMPL_MIN ... done Loading PSKEY_LO_ADC_AMPL_MAX ... done Loading PSKEY_IQ_TRIM_CHANNEL ... done Loading PSKEY_IQ_TRIM_GAIN ... done Loading PSKEY_TX_OFFSET_HALF_MHZ ... done Loading PSKEY_GBL_MISC_ENABLES ... done Loading PSKEY_UART_SLEEP_TIMEOUT ... done Loading PSKEY_DEEP_SLEEP_STATE ... done Loading 0x022b ... done Loading 0x022c ... done Loading PSKEY_IQ_ENABLE_PHASE_TRIM ... done Loading PSKEY_HCI_HANDLE_FREEZE_PERIOD ... done Loading PSKEY_MAX_FROZEN_HCI_HANDLES ... done Loading PSKEY_PAGETABLE_DESTRUCTION_DELAY ... done Loading PSKEY_IQ_TRIM_PIO_SETTINGS ... done Loading PSKEY_USE_EXTERNAL_CLOCK ... done Loading PSKEY_DEEP_SLEEP_WAKE_CTS ... done Loading PSKEY_FC_HC2H_FLUSH_DELAY ... done Loading PSKEY_RX_HIGHSIDE ... done Loading PSKEY_TX_PRE_LVL ... done Loading PSKEY_RX_SINGLE_ENDED ... done Loading PSKEY_TX_FILTER_CONFIG ... done Loading PSKEY_CLOCK_REQUEST_ENABLE ... done Loading PSKEY_RX_MIN_ATTEN ... done Loading PSKEY_XTAL_TARGET_AMPLITUDE ... done Loading PSKEY_PCM_MIN_CPU_CLOCK ... done Loading PSKEY_CPU_IDLE_MODE ... done Loading PSKEY_DEEP_SLEEP_CLEAR_RTS ... done Loading PSKEY_RF_RESONANCE_TRIM ... done Loading PSKEY_DEEP_SLEEP_PIO_WAKE ... done Loading PSKEY_MODULE_ID ... done Loading PSKEY_MODULE_DESIGN ... done Loading PSKEY_VM_DISABLE ... done Loading PSKEY_DUT_VM_DISABLE ... done Loading PSKEY_USB_VERSION ... done Loading PSKEY_USB_DEVICE_CLASS_CODES ... done Loading PSKEY_USB_VENDOR_ID ... done Loading PSKEY_USB_PRODUCT_ID ... done Loading PSKEY_USB_ATTRIBUTES ... done Loading PSKEY_USB_MAX_POWER ... done Loading PSKEY_USB_BT_IF_CLASS_CODES ... done Loading PSKEY_USB_LANGID ... done Loading PSKEY_USB_DFU_CLASS_CODES ... done Loading PSKEY_USB_DFU_PRODUCT_ID ... done Loading PSKEY_USB_PIO_PULLUP ... done Loading PSKEY_USB_PIO_WAKE_TIMEOUT ... done Loading PSKEY_USB_BT_SCO_IF_CLASS_CODES ... done Loading PSKEY_USB_SUSPEND_PIO_LEVEL ... done Loading PSKEY_USB_SUSPEND_PIO_DIR ... done Loading PSKEY_USB_SUSPEND_PIO_MASK ... done Loading PSKEY_USB_ENDPOINT_0_MAX_PACKET_SIZE ... done Loading PSKEY_USB_CONFIG ... done Loading 0x02fc ... done Loading PSKEY_RADIOTEST_ATTEN_INIT ... done Loading PSKEY_RADIOTEST_FIRST_TRIM_TIME ... done Loading PSKEY_RADIOTEST_SUBSEQUENT_TRIM_TIME ... done Loading PSKEY_RADIOTEST_LO_LVL_TRIM_ENABLE ... done Loading PSKEY_RADIOTEST_DISABLE_MODULATION ... done Loading PSKEY_MDNS_PORT ... done Loading PSKEY_MDNS_TTL ... done Loading PSKEY_MDNS_IPV4_ADDR ... done Loading PSKEY_ARP_CACHE_TIMEOUT ... done Loading PSKEY_SLOW_CLOCK_FILTER_DIVIDER ... done Loading PSKEY_SLOW_CLOCK_FILTER_SHIFT ... done Loading PSKEY_LO_VCO_STANDBY ... done Loading PSKEY_LO_DIV_LATCH_BYPASS ... done Loading PSKEY_MR_TX_IF_ATTEN_OFF_TEMP ... done Loading PSKEY_PIO_WAKEUP_STATE ... done Loading PSKEY_ANALOGUE_ATTENUATOR ... done Loading PSKEY_TX_PRE_LVL_CLASS1 ... done Loading PSKEY_RX_MR_EQ_TAPS ... done Loading PSKEY_TEMPERATURE_VS_DELTA_TX_BB_MR_PAYLOAD ... done Loading PSKEY_TEMPERATURE_VS_DELTA_TX_BB_MR_HEADER ... done Loading PSKEY_TEMPERATURE_VS_DELTA_TX_PRE_LVL_MR ... done Loading PSKEY_TEMPERATURE_VS_DELTA_INTERNAL_PA_CLASS1 ... done Loading PSKEY_CLASS1_TX_CONFIG2 ... done Loading PSKEY_CLASS1_IQ_LVL ... done Loading PSKEY_UART_CONFIG2 ... done Loading PSKEY_MR_PIO_CONFIG ... done Loading PSKEY_TX_AVOID_PA_CLASS1_PIO ... done Loading PSKEY_TRANSMIT_OFFSET_CLASS1 ... done Loading PSKEY_CLOCK_REQUEST_FEATURES ... done Loading PSKEY_CHARGER_TRIM ... done Loading PSKEY_LC_USE_THROTTLING ... done Loading PSKEY_USB_DONT_RESET_BOOTMODE_ON_HOST_RESET ... done Loading PSKEY_MR_TX_CONFIG2 ... done Loading PSKEY_MR_TX_FILTER_CONFIG ... done Loading PSKEY_I2C_CONFIG ... done Loading PSKEY_MR_ANA_RX_FTRIM ... done Loading PSKEY_USB_VM_CONTROL ... done Loading PSKEY_TRIM_RADIO_FILTERS ... done Loading PSKEY_DEEP_SLEEP_USE_EXTERNAL_CLOCK ... done Loading PSKEY_SCHED_THROTTLE_TIMEOUT ... done Loading PSKEY_RSSI_CORRECTION ... done Loading PSKEY_MIN_WAIT_STATES ... done Loading PSKEY_SYNTH_TXRX_THRESHOLDS ... done Loading PSKEY_RX_ATTEN_UPDATE_RATE ... done Loading PSKEY_RX_ATTEN_BACKOFF ... done Loading PSKEY_ONCHIP_HCI_CLIENT ... done Loading PSKEY_RADIOTEST_CDMA_LO_REF_LIMITS ... done Loading PSKEY_RF_TRAP_BAD_DIVISION_RATIOS ... done Loading PSKEY_TEST_FORCE_OFFSET ... done Loading PSKEY_RX_DYNAMIC_LVL_OFFSET ... done Loading PSKEY_TEST_DELTA_OFFSET ... done Loading PSKEY_TEMPERATURE_VS_DELTA_TX_BB ... done Loading PSKEY_TEMPERATURE_VS_DELTA_TX_PRE_LVL ... done Loading PSKEY_TEMPERATURE_VS_DELTA_INTERNAL_PA ... done Loading PSKEY_TEMPERATURE_CALIBRATION ... done Loading PSKEY_DEEP_SLEEP_CORRECTION_FACTOR ... done Loading PSKEY_CLOCK_STARTUP_DELAY ... done Loading PSKEY_CDMA_LO_ERROR_LIMITS ... done Loading PSKEY_CDMA_LO_REF_LIMITS ... done Loading PSKEY_LOOP_FILTER_TRIM ... done Loading 0x044d ... done Loading 0x044e ... done Loading 0x044f ... done Loading 0x0450 ... done Loading 0x0451 ... done Loading 0x0452 ... done Loading 0x0453 ... done Loading 0x0455 ... done Loading 0x0456 ... done Loading 0x0457 ... done Loading 0x0458 ... done Loading 0x0459 ... done Loading 0x045a ... done Loading 0x215e ... done Loading 0x2160 ... done Loading 0x2161 ... done Loading 0x2162 ... done Loading 0x216e ... done Loading 0x2192 ... done Loading 0x21b6 ... done Loading 0x21b8 ... done Loading 0x21b9 ... done Loading 0x21bd ... done Loading 0x21c0 ... done Loading 0x21cd ... done Loading 0x21ce ... done Loading 0x21d3 ... done Loading 0x21d5 ... done Loading 0x21d8 ... done Loading 0x21da ... done Loading 0x21df ... done Loading 0x2433 ... done Loading 0x2434 ... done
Bluetooth Device 확인
# hciconfig
Bluetooth Device 를 kernel에 붙인다.
# hciattach -n -s 115200 /dev/ttyS4 bcsp 115200 & Device setup complete Bluetooth: Out-of-order packet arrived, got 1 expected 0
Bluetooth Device 확인
# hciconfig -a hci0: Type: Primary Bus: UART BD Address: 00:18:9A:26:93:23 ACL MTU: 620:5 SCO MTU: 64:8 DOWN RX bytes:891 acl:0 sco:0 events:23 errors:0 TX bytes:705 acl:0 sco:0 commands:22 errors:0 Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x59 0x83 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH HOLD SNIFF PARK Link mode: SLAVE ACCEPT
Bluetooth Device 가 정지 상태이므로 동작상태로 전환
# hciconfig hci0 up Bluetooth: Out-of-order packet arrived, got 1 expected 0 Device setup complete # hciconfig -a hci0: Type: Primary Bus: UART BD Address: 00:18:9A:26:93:23 ACL MTU: 620:5 SCO MTU: 64:8 UP RUNNING RX bytes:1754 acl:0 sco:0 events:45 errors:0 TX bytes:1404 acl:0 sco:0 commands:45 errors:0 Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x59 0x83 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH HOLD SNIFF PARK Link mode: SLAVE ACCEPT Name: 'CSR - bc4' Class: 0x000000 Service Classes: Unspecified Device Class: Miscellaneous, HCI Version: 2.1 (0x4) Revision: 0x1899 LMP Version: 2.1 (0x4) Subversion: 0x1899 Manufacturer: Cambridge Silicon Radio (10)
Bluetooth Device 를 Scan 가능하도록 설정
# hciconfig hci0 piscan # hciconfig -a hci0: Type: Primary Bus: UART BD Address: 00:18:9A:26:93:23 ACL MTU: 620:5 SCO MTU: 64:8 UP RUNNING PSCAN ISCAN RX bytes:2102 acl:0 sco:0 events:49 errors:0 TX bytes:1504 acl:0 sco:0 commands:51 errors:0 Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x59 0x83 Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 Link policy: RSWITCH HOLD SNIFF PARK Link mode: SLAVE ACCEPT Name: 'CSR - bc4' Class: 0x000000 Service Classes: Unspecified Device Class: Miscellaneous, HCI Version: 2.1 (0x4) Revision: 0x1899 LMP Version: 2.1 (0x4) Subversion: 0x1899 Manufacturer: Cambridge Silicon Radio (10)
Bluetooth demon 실행
# bluetoothd -n & # bluetoothd[225]: Bluetooth daemon 4.101 bluetoothd[225]: Starting SDP server bluetoothd[225]: DIS cannot start: GATT is disabled bluetoothd[225]: Failed to init deviceinfo plugin bluetoothd[225]: Failed to init proximity plugin bluetoothd[225]: Failed to init time plugin bluetoothd[225]: Failed to init alert plugin bluetoothd[225]: Failed to init thermometer plugin bluetoothd[225]: Parsing /etc/bluetooth/input.conf failed: No such file or directory bluetoothd[225]: Parsing /etc/bluetooth/audio.conf failed: No such file or directory bluetoothd[225]: Failed to init gatt_example plugin bluetoothd[225]: Bluetooth Management interface initialized bluetoothd[225]: Failed to open RFKILL control device bluetoothd[225]: Parsing /etc/bluetooth/serial.conf failed: No such file or directory bluetoothd[225]: Could not get the contents of DMI chassis type bluetoothd[225]: input-headset driver probe failed for device 24:DB:ED:F2:53:4F bluetoothd[225]: Adapter /org/bluez/225/hci0 has been enabled bluetoothd[225]: hci0: Load Long Term Keys (0x0013) failed: Not Supported (0x0c)
현재 BT Module 상태확인
# bt-adapter -i [hci0] Name: VI-0 [rw] Address: 00:18:9A:26:93:23 Class: 0x0 Discoverable: 1 [rw] DiscoverableTimeout: 0 [rw] Discovering: 0 Pairable: 1 [rw] PairableTimeout: 0 [rw] Powered: 1 [rw] UUIDs: [ServiceDiscoveryServer, BrowseGroupDescriptor, HeadsetAudioGateway, HandsfreeAudioGateway, AVRemoteControlTarget, AVRemoteControl]
PANU 동작이 없으므로 추가
# sdptool add PANU PANU service registered # bt-adapter -i [hci0] Name: VI-0 [rw] Address: 00:18:9A:26:93:23 Class: 0x0 Discoverable: 1 [rw] DiscoverableTimeout: 0 [rw] Discovering: 0 Pairable: 1 [rw] PairableTimeout: 0 [rw] Powered: 1 [rw] UUIDs: [ServiceDiscoveryServer, BrowseGroupDescriptor, HeadsetAudioGateway, HandsfreeAudioGateway, AVRemoteControlTarget, AVRemoteControl, PANU]
NAP 동작하는 주위의 BT 확인
# bt-adapter -d Searching... bluetoothd[225]: Discovery session 0x7f5fb080 with :1.11 activated [24:DB:ED:F2:53:4F] Name: SM-N750K Alias: SM-N750K Address: 24:DB:ED:F2:53:4F Icon: phone Class: 0x5a020c LegacyPairing: 0 Paired: 1 RSSI: -70 [F4:06:69:56:B1:47] Name: (null) Alias: F4-06-69-56-B1-47 Address: F4:06:69:56:B1:47 Icon: computer Class: 0x12010c LegacyPairing: 0 Paired: 0 RSSI: -83 bluetoothd[204]: Unknown command complete for opcode 37 [00:18:9A:07:DC:7A] Name: (null) Alias: 00-18-9A-07-DC-7A Address: 00:18:9A:07:DC:7A Icon: computer Class: 0x420100 LegacyPairing: 0 Paired: 0 RSSI: -73 bluetoothd[204]: Unknown command complete for opcode 37 Done
NAP 과 연결 및 Pairing
# bt-device -c 00:18:9A:07:DC:7A Connecting to: 00:18:9A:07:DC:7A Device: VI-0 (00:18:9A:07:DC:7A) Access Bluetooth Address File Fail to Read Bluetooth Address File Address :00515194(0x0007dc7a) PIN code:11278784 bluetoothd[204]: input-headset driver probe failed for device 00:18:9A:07:DC:7A Done #
Network Connection을 생성한다.
#bt-network -c 00:18:9A:07:DC:7A nap & Network service is connected bluetoothd[204]: bnep0 connected Interface: bnep0 UUID: NAP (00001116-0000-1000-8000-00805f9b34fb) #
Network 생성확인
ifconfig bnep0 Link encap:Ethernet HWaddr 00:18:9A:26:93:23 inet6 addr: fe80::218:9aff:fe26:9323/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3 errors:0 dropped:0 overruns:0 frame:0 TX packets:13 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:315 (315.0 B) TX bytes:858 (858.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
IP주소를 가져 오거나 수동 설정 한다.
DHCP를 이용한 IP 받아오기
# dhclient bnep0
Manual IP 설정
# ifconfig bnep0 add 172.16.10.2 # ifconfig bnep0 Link encap:Ethernet HWaddr 00:18:9A:26:93:23 inet addr:172.16.10.2 Bcast:172.16.255.255 Mask:255.255.0.0 inet6 addr: fe80::218:9aff:fe26:9323/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3 errors:0 dropped:0 overruns:0 frame:0 TX packets:16 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:319 (319.0 B) TX bytes:1040 (1.0 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Network 생성확인
# ifconfig bnep0 Link encap:Ethernet HWaddr 00:18:9A:26:93:23 inet6 addr: fe80::218:9aff:fe26:9323/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2 errors:0 dropped:0 overruns:0 frame:0 TX packets:10 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:182 (182.0 B) TX bytes:663 (663.0 B) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
외부와의 Network 연결을 위한 Gateway 설정
# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 172.16.0.0 * 255.255.0.0 U 0 0 0 bnep0 # route add default gw 172.16.10.1 # route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 172.16.10.1 0.0.0.0 UG 0 0 0 bnep0 172.16.0.0 * 255.255.0.0 U 0 0 0 bnep0 #
NAP(BT-AP)으로의 Local Address Ping Test
# ping 172.16.10.1 PING 172.16.10.1 (172.16.10.1): 56 data bytes 64 bytes from 172.16.10.1: seq=0 ttl=64 time=51.988 ms 64 bytes from 172.16.10.1: seq=1 ttl=64 time=69.315 ms 64 bytes from 172.16.10.1: seq=2 ttl=64 time=62.093 ms 64 bytes from 172.16.10.1: seq=3 ttl=64 time=57.377 ms ^C --- 172.16.10.1 ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max = 51.988/60.193/69.315 ms #
NAP(BT-AP)으로의 외부 Address Ping Test
# ping 192.168.28.28 PING 192.168.28.28 (192.168.28.28): 56 data bytes 64 bytes from 192.168.28.28: seq=0 ttl=64 time=97.868 ms 64 bytes from 192.168.28.28: seq=1 ttl=64 time=69.902 ms 64 bytes from 192.168.28.28: seq=2 ttl=64 time=56.526 ms ^C --- 192.168.28.28 ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 56.526/74.765/97.868 ms #
외부 Network 으로의 Ping Test
# ping 192.168.28.100 PING 192.168.28.100 (192.168.28.100): 56 data bytes 64 bytes from 192.168.28.100: seq=0 ttl=127 time=70.940 ms 64 bytes from 192.168.28.100: seq=1 ttl=127 time=54.995 ms 64 bytes from 192.168.28.100: seq=2 ttl=127 time=61.538 ms ^C --- 192.168.28.100 ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 54.995/62.491/70.940 ms #
외부 Internet (Google의 DNS서버)으로의 Ping Test
# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8): 56 data bytes 64 bytes from 8.8.8.8: seq=0 ttl=53 time=94.536 ms 64 bytes from 8.8.8.8: seq=1 ttl=53 time=117.943 ms 64 bytes from 8.8.8.8: seq=2 ttl=53 time=101.969 ms ^C --- 8.8.8.8 ping statistics --- 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 94.536/104.816/117.943 ms #
/etc/network/interfaces
auto lo iface lo inet loopback
/etc/init.d/S40network
#!/bin/sh # # Start the network.... # # Debian ifupdown needs the /run/network lock directory mkdir -p /run/network case "$1" in start) printf "Starting network: " /usr/sbin/inetd [ $? = 0 ] && echo "inetd OK" || echo "inetd FAIL" /sbin/ifup -a [ $? = 0 ] && echo "ifup OK" || echo "ifup FAIL" ;; stop) printf "Stopping network: " /sbin/ifdown -a [ $? = 0 ] && echo "OK" || echo "FAIL" ;; restart|reload) "$0" stop "$0" start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit $?
/etc/init.d/S60blueZ
#!/bin/sh # # Start the BlueZ.... # # Debian ifupdown needs the /run/network lock directory BT_pskey() { echo "BT Module : set PSKEY..." count=0 while [ ${count} -le 5 ]; do # /usr/sbin/bccmd -t bcsp -d /dev/ttyS4 -b 115200 psload -r /root/my.psr /root/bccmd -t bcsp -d /dev/ttyS4 -b 115200 psload -r /root/my.psr if [ $? = 0 ]; then count=10 echo "BT Module : set PSKEY - OK" else echo "BT Module : set PSKEY - FAIL" sleep 0.5 fi count=$(( ${count}+1 )) done } BT_attach() { echo "BT Module : Attach" count=0 while [ ${count} -le 5 ]; do /usr/sbin/hciattach -n -s 115200 /dev/ttyS4 bcsp 115200 & if [ $? = 0 ]; then count=10 echo "BT Module : Attach - OK" else echo "BT Module : Attach - FAIL" sleep 0.5 fi count=$(( ${count}+1 )) done } BT_up() { echo "BT Module : Start" count=0 while [ ${count} -le 5 ]; do /usr/sbin/hciconfig hci0 up if [ $? = 0 ]; then count=10 echo "BT Module : Start - OK" else echo "BT Module : Start - FAIL" sleep 0.5 fi count=$(( ${count}+1 )) done } BT_down() { echo "BT Module : Stop" count=0 while [ ${count} -le 5 ]; do /usr/sbin/hciconfig hci0 down if [ $? = 0 ]; then count=10 echo "BT Module : Stop - OK" else echo "BT Module : Stop - FAIL" sleep 0.5 fi count=$(( ${count}+1 )) done } BT_enable_scan() { echo "BT Module : Enable Scan" count=0 while [ ${count} -le 5 ]; do /usr/sbin/hciconfig hci0 piscan if [ $? = 0 ]; then count=10 echo "BT Module : Enable Scan - OK" else echo "BT Module : Enable Scan - FAIL" sleep 0.5 fi count=$(( ${count}+1 )) done } case "$1" in start) BT_pskey sleep 0.3 BT_attach sleep 0.5 BT_up sleep 0.3 BT_enable_scan # BT_down # sleep 0.3 /usr/sbin/bluetoothd -n & [ $? = 0 ] && echo "bluetoothd OK" || echo "bluetoothd FAIL" # for Handy sleep 0.5 /usr/bin/sdptool add PANU [ $? = 0 ] && echo "add PANU OK" || echo "add PANU FAIL" ;; stop) printf "Stopping BT: " killall bluetoothd [ $? = 0 ] && echo "OK" || echo "FAIL" ;; restart|reload) "$0" stop "$0" start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit $?