debian下蓝牙适配器的配置和使用

本文打算将蓝牙适配器和手机蓝牙进行配对。

买了个支持蓝牙4.0协议的蓝牙适配器,将其插入到pc(debian 7.4)的usb口。

查看手机蓝牙信息:

选择手机中"设置"->"关于手机"->"状态信息"可以看到蓝牙地址是18:DC:56:D2:1C:1A

pc上安装蓝牙工具:

sudo apt-get install bluez bluez-hcidump

查看系统输出信息:

$ dmesg | tail -n 4
[25259.408121] usb 1-1.2: new full-speed USB device number 32 using ehci_hcd
[25259.614615] usb 1-1.2: New USB device found, idVendor=0a12, idProduct=0001
[25259.614621] usb 1-1.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[25259.614626] usb 1-1.2: Product: CSR8510 A10

查看蓝牙适配器设备信息:

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 001 Device 031: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 002 Device 003: ID 046d:c05a Logitech, Inc. Optical Mouse M90
Bus 003 Device 002: ID 413c:2003 Dell Computer Corp. Keyboard
$ lsusb -s 001:031 -v

Bus 001 Device 031: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Couldn‘t open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          224 Wireless
  bDeviceSubClass         1 Radio Frequency
  bDeviceProtocol         1 Bluetooth
  bMaxPacketSize0        64
  idVendor           0x0a12 Cambridge Silicon Radio, Ltd
  idProduct          0x0001 Bluetooth Dongle (HCI mode)
  bcdDevice           88.91
  iManufacturer           0
  iProduct                2
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          177
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0000  1x 0 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0009  1x 9 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       2
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0011  1x 17 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       3
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0019  1x 25 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0019  1x 25 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       4
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0021  1x 33 bytes
        bInterval               1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       5
      bNumEndpoints           2
      bInterfaceClass       224 Wireless
      bInterfaceSubClass      1 Radio Frequency
      bInterfaceProtocol      1 Bluetooth
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0031  1x 49 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            1
          Transfer Type            Isochronous
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0031  1x 49 bytes
        bInterval               1

安装bluez后,会提供两个工具hciconfig和hcitool进行蓝牙相关的配置。

查看当前蓝牙适配器参数配置:

$ sudo hciconfig -a
hci0:    Type: BR/EDR  Bus: USB
    BD Address: 00:1A:7D:DA:71:13  ACL MTU: 310:10  SCO MTU: 64:8
    UP RUNNING PSCAN
    RX bytes:3639 acl:0 sco:0 events:169 errors:0
    TX bytes:745 acl:0 sco:0 commands:47 errors:0
    Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
    Link policy: RSWITCH HOLD SNIFF PARK
    Link mode: SLAVE ACCEPT
    Name: ‘debian-0‘
    Class: 0x420100
    Service Classes: Networking, Telephony
    Device Class: Computer, Uncategorized
    HCI Version: 4.0 (0x6)  Revision: 0x22bb
    LMP Version: 4.0 (0x6)  Subversion: 0x22bb
    Manufacturer: Cambridge Silicon Radio (10)

蓝牙适配器的mac地址是: 00:1A:7D:DA:71:13,名称是debian-0。

查看蓝牙适配器提供的各种功能:

$ sdptool browse local
Browsing FF:FF:FF:00:00:00 ...
Service Name: SIM Access Server
Service RecHandle: 0x10000
Service Class ID List:
  "SIM Access" (0x112d)
  "Generic Telephony" (0x1204)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 8
Profile Descriptor List:
  "SIM Access" (0x112d)
    Version: 0x0101

Service Name: Headset Audio Gateway
Service RecHandle: 0x10001
Service Class ID List:
  "Headset Audio Gateway" (0x1112)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 12
Profile Descriptor List:
  "Headset" (0x1108)
    Version: 0x0102

Service Name: Hands-Free Audio Gateway
Service RecHandle: 0x10002
Service Class ID List:
  "Handsfree Audio Gateway" (0x111f)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 13
Profile Descriptor List:
  "Handsfree" (0x111e)
    Version: 0x0105

Service Name: AVRCP TG
Service RecHandle: 0x10003
Service Class ID List:
  "AV Remote Target" (0x110c)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 23
  "AVCTP" (0x0017)
    uint16: 0x103
Profile Descriptor List:
  "AV Remote" (0x110e)
    Version: 0x0103

Service Name: AVRCP CT
Service RecHandle: 0x10004
Service Class ID List:
  "AV Remote" (0x110e)
Protocol Descriptor List:
  "L2CAP" (0x0100)
    PSM: 23
  "AVCTP" (0x0017)
    uint16: 0x103
Profile Descriptor List:
  "AV Remote" (0x110e)
    Version: 0x0100

Service Name: Dial-Up Networking
Service RecHandle: 0x10005
Service Class ID List:
  "Dialup Networking" (0x1103)
  "Generic Networking" (0x1201)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 1
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100

Service Name: OBEX Object Push
Service RecHandle: 0x10006
Service Class ID List:
  "OBEX Object Push" (0x1105)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 9
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX Object Push" (0x1105)
    Version: 0x0100

Service Name: OBEX File Transfer
Service RecHandle: 0x10007
Service Class ID List:
  "OBEX File Transfer" (0x1106)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 10
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX File Transfer" (0x1106)
    Version: 0x0100

扫描蓝牙设备:

$ hcitool scan
Scanning ...
    C4:17:FE:F6:65:FF    PC-201209031236
    CC:52:AF:4F:52:16    HR-6F1397D64651
    18:DC:56:D2:1C:1A    Coolpad 8297

使用hcitool获取手机蓝牙信息:

$ hcitool name 18:DC:56:D2:1C:1A
Coolpad 8297
$ sudo hcitool info 18:DC:56:D2:1C:1A
Requesting information ...
    BD Address:  18:DC:56:D2:1C:1A
    Device Name: Coolpad 8297
    LMP Version: 4.0 (0x6) LMP Subversion: 0x0
    Manufacturer: MediaTek, Inc. (70)
    Features page 0: 0xbf 0x3e 0x8d 0xfe 0xdb 0xff 0x5b 0x87
        <3-slot packets> <5-slot packets> <encryption> <slot offset>
        <timing accuracy> <role switch> <sniff mode> <RSSI>
        <channel quality> <SCO link> <HV2 packets> <HV3 packets>
        <CVSD> <power control> <transparent SCO> <broadcast encrypt>
        <EDR ACL 2 Mbps> <EDR ACL 3 Mbps> <enhanced iscan>
        <interlaced iscan> <interlaced pscan> <inquiry with RSSI>
        <extended SCO> <EV4 packets> <EV5 packets> <AFH cap. slave>
        <AFH class. slave> <LE support> <3-slot EDR ACL>
        <5-slot EDR ACL> <sniff subrating> <pause encryption>
        <AFH cap. master> <AFH class. master> <EDR eSCO 2 Mbps>
        <EDR eSCO 3 Mbps> <3-slot EDR eSCO> <extended inquiry>
        <LE and BR/EDR> <simple pairing> <encapsulated PDU>
        <non-flush flag> <LSTO> <inquiry TX power> <EPC>
        <extended features>
    Features page 1: 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00
    Features page 2: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

配置蓝牙适配器使得能被其他设备搜索到:

$ sudo hciconfig hci0 iscan

这时在手机中搜索蓝牙设备可以搜索到"debian-0",但是使用手机配对时提示“PIN或者配对密钥不正确,无法和debian-0进行配对"。

在执行下面几条命令:

$ sudo hciconfig hci0 pscan
$ sudo hciconfig hci0 noencrypt
$ sudo hciconfig hci0 noauth

然后在手机里可以对"debian-0"配对即可配对成功。

此时可以在pc上执行l2ping命令 :

[email protected]:~$ sudo l2ping  -c 3 18:DC:56:D2:1C:1A
[sudo] password for host:
Ping: 18:DC:56:D2:1C:1A from 00:1A:7D:DA:71:13 (data size 44) ...
44 bytes from 18:DC:56:D2:1C:1A id 0 time 15.00ms
44 bytes from 18:DC:56:D2:1C:1A id 1 time 26.16ms
44 bytes from 18:DC:56:D2:1C:1A id 2 time 26.14ms
3 sent, 3 received, 0% loss

如果不使用上面的hciconfig命令来进行配置,也可以使用blueman或者gnome-bluetooth来配置蓝牙,安装这些工具:

sudo apt-get install blueman gnome-bluetooth

这两个工具都是图形化界面,使用起来相当方便,只是需要从手机端发起配对请求,然后在pc端和手机端分别进行确认即完成配对。

然后可以在pc端用蓝牙来向手机发送文件。

上面这两种情况下都是在手机端发起配对请求,之后也只是能通过蓝牙发文件。

但我希望能够使用bluez系列工具中提供的命令行工具从pc端发起配对请求,以便于以后将蓝牙适配器用到嵌入式开发板上。

参考《在linux下蓝牙使用rfcomm连接》 、《BluetoothUser》以及《Bluetooth_Mouse》进行操作,但都没成功,

这是因为我使用的bluez版本是4.99,没有bluez5中的bluetoothctl工具,也没有bluez4中的hidd工具,也没有常用的bluez3中的/etc/bluetooth/hcid.conf配置文件,

进行配对时总是会因为pin或者key的问题而导致配对失败,导致网络上大部分教程都不适用于这个版本。

最终我选用了另一种方式,先从手机来对蓝牙设备进行配对,然后将其模式修改成master,再从pc下执行命令就可以了。

首先配置rfcomm,修改/etc/bluetooth/rfcomm.conf(其实我不确定是否需要该配置,只是在参考网络文章时修改了这个配置文件):

[email protected]:~$ cat /etc/bluetooth/rfcomm.conf
#
# RFCOMM configuration file.
#

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

    # Bluetooth address of the device
    device 18:DC:56:D2:1C:1A;

    # RFCOMM channel for the connection
    channel    1;

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

重启蓝牙服务:

sudo /etc/init.d/bluetooth restart

可以使用hcidump(类似于tcpdump工具能够打印bluez中每步都执行了什么功能,可以用于调试):

sudo hcidump -Xt

按照前面的步骤从手机来对蓝牙适配器进行配对,可以配对成功。

查看hci0(类似于网卡的eth0接口)的连接模式(link mode,可以是master或者slave):

$ sudo hciconfig hci0 lm
hci0:    Type: BR/EDR  Bus: USB
    BD Address: 00:1A:7D:DA:71:13  ACL MTU: 310:10  SCO MTU: 64:8
    Link mode: SLAVE ACCEPT 

将其连接模式从SLAVE修改为master:

sudo hciconfig hci0 lm master

这时查看连接模式:

$ sudo hciconfig hci0 lm
[sudo] password for host:
hci0:    Type: BR/EDR  Bus: USB
    BD Address: 00:1A:7D:DA:71:13  ACL MTU: 310:10  SCO MTU: 64:8
    Link mode: MASTER 

已经将link mode修改为master模式。

使用rfcomm来连接手机蓝牙设备:

$ sudo rfcomm connect hci0 18:DC:56:D2:1C:1A
Connected /dev/rfcomm0 to 18:DC:56:D2:1C:1A on channel 1
Press CTRL-C for hangup

连接成功,查看连接信息:

$ sudo hcitool  con
Connections:
    < ACL 18:DC:56:D2:1C:1A handle 72 state 1 lm MASTER AUTH ENCRYPT 

可以执行hcitool中的cmd命令,例如下面的命令将当前设备的名称改成"ABCD":

$ sudo hcitool cmd 0x03 0x0013 0x41 0x42 0x43 0x44
< HCI Command: ogf 0x03, ocf 0x0013, plen 4
  41 42 43 44
> HCI Event: 0x0e plen 4
  01 13 0C 00 

此时在hcidump对应窗口显示下面的信息:

2014-06-18 15:04:22.929405 < HCI Command: Write Local Name (0x03|0x0013) plen 4
    name ‘ABCDBCD‘
2014-06-18 15:04:22.930381 > HCI Event: Command Complete (0x0e) plen 4
    Write Local Name (0x03|0x0013) ncmd 1
    status 0x00
2014-06-18 15:04:22.930474 < HCI Command: Read Local Name (0x03|0x0014) plen 0
2014-06-18 15:04:22.947378 > HCI Event: Command Complete (0x0e) plen 252
    Read Local Name (0x03|0x0014) ncmd 1
    status 0x00 name ‘ABCD‘

使用hciconfig工具也可以查看到当前蓝牙适配器名称:

$ sudo hciconfig hci0 name
hci0:    Type: BR/EDR  Bus: USB
    BD Address: 00:1A:7D:DA:71:13  ACL MTU: 310:10  SCO MTU: 64:8
    Name: ‘ABCD‘

可以看到蓝牙适配器的名称已经被改成ABCD了。

还有其他很多命令都可以用hcitool hci0 cmd来进行配置,《利用 hcitool 通过hci 命令与芯片交互》中提供了其他的一些命令,感兴趣的话可以自己玩玩看。

也可以下载《蓝牙4.0规范》,从704-1103页有关于蓝牙命令的详细说明。

debian下蓝牙适配器的配置和使用

时间: 2024-10-13 02:04:40

debian下蓝牙适配器的配置和使用的相关文章

debian下安装rvm配置ruby环境

先安装rvm curl -L https://get.rvm.io | bash -s stable source ~/.rvm/scripts/rvm 安装必须的东西 rvm requirements 看看装哪个ruby rvm list known 2.1.3貌似最新 rvm install ruby-2.1.3 设置默认 rvm use ruby-2.1.3 --default 如果看到 RVM is not a function, selecting rubies with 'rvm u

Linux Debian 下LNMP服务器——nginx+mysql+php环境搭建及配置

昨天刚给公司服务器装了LNMP服务器环境,在这里简单记录一下过程备忘. 这里我在安装的时候是用的Dotdeb源,仅供参考. 1.导入Dotdeb源,据说Dotdeb源里的软件版本比较新. 在向源中导入Dotdeb前,我们需要先获取GnuPG key并导入: wget http://www.dotdeb.org/dotdeb.gpg cat dotdeb.gpg | apt-key add - 提示OK,表明导入成功.然后我们开始导入Dotdeb源,源列表的位置在“/etc/apt/sources

debian下samba配置

debian下samba配置  http://blog.chinaunix.net/uid-2282111-id-2113216.html 服务器端配置过程:1. apt-get install samba2. 修改/etc/samba/smb.conf,配置共享文件夹属性 [email protected]:~/jz2440# vi /etc/samba/smb.conf [global] workgroup = WORKGROUP netbios name = CentOS7 server

debian下配置dynamic printk以及重新编译内核

在以前的一篇博文<编译debian内核>已经提过了重新编译内核的方法,但是整个过程花费时间较长,并且生成deb包. 这里我采用稍微简单一些的方法,因为我并没有对内核或者驱动代码做任何修改,仅仅是在内核中选中一些未被选中的调试选项(以便于查看log信息) 先获取内核源码: sudo apt-get source linux-source-3.2 会在当前文件夹下得到几个文件: $ ls linux-3.2.57 linux_3.2.57-3+deb7u2.debian.tar.xz linux_

debian下配置防火墙iptables

debian下iptables输入命令后即时生效,但重启之后配置就会消失,可用iptables-save快速保存配置,然后在开机自动的时候让iptables自动加载刚刚导出的配置文件,方法如下: 若要停止iptables,iptables -F清空所有配置效果等同于停止. whereis iptables           查找iptables 所在的路径. 1.将iptables配置保存到/etc/iptables,这个文件名可以自己定义,与下面的配置一致即可 iptables-save >

Debian下配置网络的方法

1.网络配置 配置网卡修改 /etc/network/interfaces 添加如下 # #号后面是备注,不要添加哦! auto eth0 #开机自动激活 iface eth0 inte static #静态IP address 192.168.0.56 #本机IP netmask 255.255.255.0 #子网掩码 gateway 192.168.0.254 #路由网关 #因为我是通过路由上网的,所以配置为静态IP和网关 如果是用DHCP自动获取,请在配置文件里添加如下: iface et

[boostrap]debian下为arm创建debian和emdebian文件系统

转自:http://www.cnblogs.com/qiaoqiao2003/p/3738552.html Debian系统本身包含对arm的支持,其包含的软件包最多,但是最终的文件系统要大一些. emdebian 是一个非常好用的嵌入式linux操作系统,其基于debian的特点对于熟悉debian系统的人来说很容易就能得心应手地进行配置. emdebian有好几个版本:Grip,Crush,Baked. 关于它们的详细介绍可以查看:http://www.emdebian.org/emdebi

Debian下自动备份文件并上传到远程FTP服务器且删除指定日期前的备份Shell脚本

说明:  1.备份目录/home/osyunwei下面所有的文件到/home/osyunweibak里面,并且保存为osyunwei20120701.tar.gz的压缩文件格式(2012_07_01是指备份执行时当天的日期),最后只保留最近7天的备份 2.上传/home/osyunweibak里面的备份文件到远程FTP服务器上,并且只保留最近7天的备份. 3.FTP服务器:192.168.21.139 端口:21 账号:osyunwei 密码:123456 osyunweibak为备份文件存放目

将Windows MyEclipse的web项目移植到Debian下

用windows先的MyEclipse很方便,但是要把MyEclipse的web项目移植到Debian下,稍微有一点麻烦.当然,如果是ubuntu的话,直接装MyEclipse就可以了.这里只将针对于无图形界面的Debian的移植过程. 1.配环境(jdk+apache+tomcat+mysql)(当然,不需要数据库的就用配了) 2.把原来的项目移植到Linux下. 主要分为以上两个部分讲述. ========================= 1.1 jdk 我下载的是jdk.tar.gz包,