2014년 3월 24일 월요일

Ubuntu에서 Bluetooth 활용

linaro@cubietruck:~$ sudo apt-get install bluez
linaro@cubietruck:~$ sudo hcitool dev
Devices:
hci0 00:1C:34:01:2F:2A

linaro@cubietruck:~$ sudo hciconfig hci0 up
linaro@cubietruck:~$ sudo hcitool scan
Scanning ...
DC:2C:26:D1:82:FB Celluon PK Series

linaro@cubietruck:~$ sudo l2ping DC:2C:26:D1:82:FB
Ping: DC:2C:26:D1:82:FB from 00:1C:34:01:1F:0A (data size 44) ...
44 bytes from DC:2C:26:D1:82:FB id 0 time 17.59ms
44 bytes from DC:2C:26:D1:82:FB id 1 time 6.57ms
44 bytes from DC:2C:26:D1:82:FB id 2 time 6.99ms
44 bytes from DC:2C:26:D1:82:FB id 3 time 7.45ms
44 bytes from DC:2C:26:D1:82:FB id 4 time 6.79ms


linaro@cubietruck:~$ sudo sdptool browse DC:2C:26:D1:82:FB
Browsing DC:2C:26:D1:82:FB ...
Service Name: Bluetooth Wireless Keyboard SDP Server
Service Description: Keyboard
Service RecHandle: 0x0
Service Class ID List:
  "SDP Server" (0x1000)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 1
  "SDP" (0x0001)
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "" (0x0100)
    Version: 0x0100

Service Name: Bluetooth Wireless  Keyboard                        
Service Description: Keyboard
Service Provider:              .  
Service RecHandle: 0x10000
Service Class ID List:
  "Human Interface Device" (0x1124)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 17
  "HIDP" (0x0011)
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Human Interface Device" (0x1124)
    Version: 0x0100



linaro@cubietruck:~$ sudo hidd --connect DC:2C:26:D1:82:FB


linaro@cubietruck:~$ sudo hcitool con
Connections:
< ACL DC:2C:26:D1:82:FB handle 43 state 1 lm MASTER 
linaro@cubietruck:~$


linaro@cubietruck:~$ sudo vim /etc/bluetooth/rfcomm.conf


rfcomm0 {
       # Automatically bind the device at startup
       bind no;

       # Bluetooth address of the device
       device DC:2C:26:D1:82:FB;

       # RFCOMM channel for the connection
       channel 1;

       # Description of the connection
       comment "Example Bluetooth device";
}


댓글 없음:

댓글 쓰기