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 -a
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: BR/EDR Bus: UART
BD Address: 00:18:9A:26:93:23 ACL MTU: 620:5 SCO MTU: 64:8
DOWN
RX bytes:870 acl:0 sco:0 events:22 errors:0
TX bytes:446 acl:0 sco:0 commands:21 errors:0
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80
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: BR/EDR Bus: UART
BD Address: 00:18:9A:26:93:23 ACL MTU: 620:5 SCO MTU: 64:8
UP RUNNING PSCAN
RX bytes:870 acl:0 sco:0 events:22 errors:0
TX bytes:446 acl:0 sco:0 commands:21 errors:0
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80
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.0 (0x3) Revision: 0x10c6
LMP Version: 2.0 (0x3) Subversion: 0x10c6
Manufacturer: Cambridge Silicon Radio (10)
Bluetooth Device 를 Scan 가능하도록 설정
# hciconfig hci0 piscan
# hciconfig -a
hci0: Type: Primary Bus: UART
BD Address: 00:18:9A:07:DC:7A 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)
우리의 BT-AP 동작상의 PIN Code 생성을 위한 Seed를 만들어 놓기 위해 /usr/sbin/BT-Address 를 실행한다.
/usr/sbin/BT-Address
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:07:DC:7A
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]
NAP 동작이 없으므로 추가 - 해도되고 안해도 됨
# sdptool add NAP
?????----------------------
# bt-adapter -i
[hci0]
Name: VI-0 [rw]
Address: 00:18:9A:07:DC:7A
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, NAP]
Agent를 등록한다.
#bt-agent &
# Agent registered
Network Connection을 생성한다.
#bt-nerwork --server nap br0 &
# NAP server registered
대기하다보면 PANU에서 연결요청이 들어온다.
이는 초기 한번만 실행된다.
Device: VI-0 (00:18:9A:26:93:23)
Access Bluetooth Address File
Retrieved line of length 9 :
00515194
Read Bluetooth Address Value = 00515194(0x0007DC7A)
Address :00515194(0x0007dc7a)
PIN code:11278784
bluetoothd[211]: input-headset driver probe failed for device 00:18:9A:26:93:23
network 동작 요구 들어온다.
Device: VI-0 (00:18:9A:26:93:23)
Authorize a connection to: 0000000f-0000-1000-8000-00805f9b34fb (yes/no)? bluetoothdbr01:: Apdodrntw c1n(ebtnoe:pb0e)0 entered blocking state
br0: port 1(bnep0) entered disabled state
device bnep0 entered promiscuous mode
bluetoothd[211]: bridge br0: interface bnep0br0: port 1(bnep0) entered blocking state
br0: port 1(bnep0) entered forwarding state
Bluetooth: Short BCSP packet
Bluetooth: Short BCSP packet
Bluetooth: Short BCSP packet
Bluetooth: Short BCSP packet
Bluetooth: Error in BCSP hdr checksum
Bluetooth: Short BCSP packet
Bluetooth: Short BCSP packet
Bluetooth: Short BCSP packet
Bluetooth: Short BCSP packet
Bluetooth: Short BCSP packet
Bluetooth: Short BCSP packet
Bluetooth: Error in BCSP hdr checksum
# ifconfig
bnep0 Link encap:Ethernet HWaddr 00:18:9A:07:DC:7A
inet6 addr: fe80::218:9aff:fe07:dc7a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:935 (935.0 B) TX bytes:303 (303.0 B)
br0 Link encap:Ethernet HWaddr 00:18:9A:07:DC:7A
inet addr:172.16.10.1 Bcast:172.16.10.255 Mask:255.255.255.0
inet6 addr: fe80::dcd0:e8ff:fe00:1984/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:17 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:704 (704.0 B) TX bytes:1318 (1.2 KiB)
eth0 Link encap:Ethernet HWaddr 1A:B9:D9:29:CE:1C
inet addr:192.168.28.28 Bcast:192.168.28.255 Mask:255.255.255.0
inet6 addr: fe80::18b9:d9ff:fe29:ce1c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7180 errors:0 dropped:0 overruns:0 frame:0
TX packets:3174 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7956147 (7.5 MiB) TX bytes:514104 (502.0 KiB)
Interrupt:29
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:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:340 (340.0 B) TX bytes:340 (340.0 B)
# route add -net 172.16.10.0 netmask 255.255.255.0 gw 172.16.10.1 dev br0
# route add -net 192.168.28.0 netmask 255.255.255.0 gw 192.168.28.28 dev eth0
# echo 1 > /proc/sys/net/ipv4/ip_forward
# 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=128 time=1.388 ms
64 bytes from 192.168.28.100: seq=1 ttl=128 time=0.716 ms
^C
--- 192.168.28.100 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.716/1.052/1.388 ms
# ping 172.16.10.2
PING 172.16.10.2 (172.16.10.2): 56 data bytes
64 bytes from 172.16.10.2: seq=0 ttl=64 time=70.288 ms
64 bytes from 172.16.10.2: seq=1 ttl=64 time=69.078 ms
^C
--- 172.16.10.2 ping statistics ---
3 packets transmitted, 2 packets received, 33% packet loss
round-trip min/avg/max = 69.078/69.683/70.288 ms
/etc/network/interfaces
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto br0
iface br0 inet static
pre-up brctl addbr br0
address 172.16.10.1
network 172.16.10.0
netmask 255.255.255.0
broadcast 172.16.10.255
auto pan1
iface pan1 inet manual
pre-up brctl addbr br0
pre-up brctl addif br0 $IFACE
pre-up ifconfig $IFACE 0.0.0.0 up
post-down ifconfig $IFACE down
post-down brctl delif br0 $IFACE
/etc/init.d/S80dhcp-server
...
## INTERFACES=""
INTERFACES="br0"
# Additional options that are passed to the DHCP server daemon?
OPTIONS=""
NAME="dhcpd"
DAEMON="/usr/sbin/${NAME}"
## CFG_FILE="/etc/default/${NAME}"
CFG_FILE="/etc/dhcp/${NAME}"
...
route