bluez-utils


Forum: Networking
Topic: bluez-utils
started by: Onyarian

Posted by Onyarian on Nov. 01 2007,17:34
Hello,

I have upgrade my DSL to 4.0 and now I can't utilize bluez-utils.unc because it's for version 2.4.26 and not for 2.4.31 and it can't find the modules.
It make the folder /lib/modules/2.4.26/kernel... but for DSL4.0 it must be /lib/modules/2.4.31/kernel...

where can I found the modules for this version?

Thanks

Posted by Juanito on Nov. 01 2007,18:00
The modules in the bluez-utils extension were taken from knoppix-3.4 - maybe there is a version of knoppix that corresponds to 2.4.31? Another option would be to compile the modules...
Posted by Onyarian on Nov. 01 2007,20:39
yes,

because I have copied the modules in the 2.4.31 folder and the result is:

dsl@box:/ramdisk/home/dsl$ insmod bluez
Using /lib/modules/2.4.31/kernel/net/bluetooth/bluez.o
/lib/modules/2.4.31/kernel/net/bluetooth/bluez.o: kernel-module
version mismatch
       /lib/modules/2.4.31/kernel/net/bluetooth/bluez.o was compiled
for kernel version 2.4.26
       while this kernel is version 2.4.31.

I have to study it...when I have time.

Thanks!

Posted by ^thehatsrule^ on Nov. 02 2007,00:00
If you want to risk it, you can force it by using insmod -f
And make sure you have root privileges, so you can prepend sudo.

Posted by Onyarian on Nov. 02 2007,10:19
I want to prove your insmod -f

By the time I have download linux-2.4.31.tar.gz, there is a folder 'drivers' with another one 'bluetooth' with files .c and .h

Config.in
Makefile
Makefile.lib
bfusb.c
bluecard_cs.c
bt3c_cs.c
btuart_cs.c
dtl1_cs.c
hci_bcsp.c
hci_bcsp.h
hci_h4.c
hci_h4.h
hci_ldisc.c
hci_uart.h
hci_usb.c
hci_usb.h
hci_vhci.c
hci_vhci.h

I have never compiled, how can I do it?
must I compile all the folders and not only the bluetooth one?

Posted by Juanito on Nov. 02 2007,11:10
See < here > for some ideas on what to do.

I believe you will need to compile from the top level of the kernel sources (eg /usr/src/linux-2.4.31), but you will only need to save the modules with the same name as those in the bluez-utils extension.

Edit: It looks like I managed to compile the bt modules in 2.4.31, give me a while to test them and then I'll post them if things work OK:
Code Sample
$ export PATH=/opt/compile-3.3.5/bin:$PATH
$ cd /usr/src/linux-2.4.31
$ make mrproper
$ make include/linux/version.h
$ make symlinks
[/usr/include -> /opt/compile-3.3.5/include]
$ make menuconfig [load .config and save]
[add #include <sys/param.h> to ../scripts/makedep.c]
$ make dep
$ make clean
$ make modules
$ touch mymarker
[open terminal as root]
# make modules_install
[swap back to terminal as user]
$ sudo find / -not -type 'd' -cnewer mymarker | grep -v "\/proc\/" | tee files
$ beaver files [edit all but bluetooth modules]
$ sudo tar -T files --no-recursion -zcvf /tmp/bt_modules-2.4.31.dsl

Posted by roberts on Nov. 02 2007,15:35
I have posted modules that were created when I made the 2.4.31 kernel including net-modules.tgz which has some bluetooth modules.
< http://distro.ibiblio.org/pub....modules >

Posted by Juanito on Nov. 02 2007,19:56
After a quick test, it looks like the modules work - if there's a need I can post them:
Code Sample
$ sudo insmod bluez
$ sudo insmod hci_usb
$ sudo insmod l2cap  
$ sudo insmod rfcomm
$ sudo insmod crc32
$ sudo insmod bnep
$ sudo insmod sco
$ mydsl-load /mnt/sdb1/mydsl/optional/bluez-utils.dsl
$ sudo hciconfig hci0 up
$ sudo hcid restart
$ hcitool scan
Scanning ...
       00:0A:D9:E8:4A:65       .P900
$ sudo hcitool cc 00:0A:D9:E8:4A:65
[PIN request on remote device]
$ sudo hcitool auth 00:0A:D9:E8:4A:65
[bt device paired]

Posted by ^thehatsrule^ on Nov. 02 2007,21:16
Quote (roberts @ Nov. 02 2007,10:35)
I have posted modules that were created when I made the 2.4.31 kernel including net-modules.tgz which has some bluetooth modules.
< http://distro.ibiblio.org/pub....modules >

Doesn't look like they were built, the .lst shows empty dirs.
Posted by roberts on Nov. 02 2007,22:01
Just downloaded from ibiblio.org and extracted and got:
Code Sample


lib/modules/2.4.31/kernel/net/bluetooth/:
drwxrwsr-x      5 dsl      staff         160 Oct 21  2005 .
drwxrwsr-x    14 dsl      staff         280 Nov  2 18:59 ..
-rw-rw-r--        1 dsl      staff       49356 Oct 21  2005 bluez.o
drwxrwsr-x      2 dsl      staff          60 Nov  2 18:59 bnep
drwxrwsr-x      2 dsl      staff          60 Nov  2 18:59 cmtp
-rw-rw-r--        1 dsl      staff       26168 Oct 21  2005 l2cap.o
drwxrwsr-x      2 dsl      staff          60 Nov  2 18:59 rfcomm
-rw-rw-r--        1 dsl      staff       15352 Oct 21  2005 sco.o

lib/modules/2.4.31/kernel/net/bluetooth/bnep:
drwxrwsr-x    2 dsl      staff          60 Nov  2 18:59 .
drwxrwsr-x    5 dsl      staff         160 Oct 21  2005 ..
-rw-rw-r--      1 dsl      staff       16070 Oct 21  2005 bnep.o

lib/modules/2.4.31/kernel/net/bluetooth/cmtp:
drwxrwsr-x    2 dsl      staff          60 Nov  2 18:59 .
drwxrwsr-x    5 dsl      staff         160 Oct 21  2005 ..
-rw-rw-r--      1 dsl      staff       20697 Oct 21  2005 cmtp.o

lib/modules/2.4.31/kernel/net/bluetooth/rfcomm:
drwxrwsr-x    2 dsl      staff          60 Nov  2 18:59 .
drwxrwsr-x    5 dsl      staff         160 Oct 21  2005 ..
-rw-rw-r--      1 dsl      staff       42580 Oct 21  2005 rfcomm.o

Posted by ^thehatsrule^ on Nov. 02 2007,22:08
I suppose the .lst file is just incorrect then.
Posted by roberts on Nov. 03 2007,05:21
OIC. Thanks for pointing this out. I updated the list files to only show the dot ohs.
Posted by Juanito on Nov. 03 2007,05:28
The modules in lib/modules/2.4.31/kernel/drivers/bluetooth/ are also required - I'll post an extension with all of the bt modules.
Posted by Onyarian on Nov. 04 2007,19:37
Thanks Juanito, and of course to Roberts.
Posted by Onyarian on Nov. 21 2007,19:59
I have some troubles with the new version of bluez-utils.

I have a file called conect-blue.sh to make step by step the internet conexion via mobil phone:

----------------------------------
#!/bin/bash

. /etc/init.d/dsl-functions

echo "cargar modulo bluez"
echo -n "Presionar una tecla... "; read gagme
sudo insmod bluez

echo "cargar modulo hci_uart"
echo -n "Presionar una tecla... "; read gagme
sudo insmod hci_uart

echo "cargar modulo sco"
echo -n "Presionar una tecla... "; read gagme
sudo insmod sco

echo "cargar modulo l2cap"
echo -n "Presionar una tecla... "; read gagme
sudo insmod l2cap

echo "cargar modulo rfcomm"
echo -n "Presionar una tecla... "; read gagme
sudo insmod rfcomm

echo "cargar hcid"
echo -n "Presionar una tecla... "; read gagme
sudo hcid

echo "Conectar con pcmcia bluetooth"
echo -n "Presionar una tecla... "; read gagme

sudo hciattach -s 57600 /dev/ttyS17 bcsp

echo "Levantar conexion bluetooth"
echo -n "Presionar una tecla... "; read gagme

sudo hciconfig hci0 up

echo "reiniciar hcid"
echo -n "Presionar una tecla... "; read gagme
sudo hcid restart

echo "escanear el telefono"
echo -n "Presionar una tecla... "; read gagme
sudo hcitool scan

echo "conectar S68"
echo -n "Presionar una tecla... "; read gagme
sudo hcitool cc xx:xx:xx:xx:xx:xx

echo "autentificar S68"
echo -n "Presionar una tecla... "; read gagme
sudo hcitool auth xx:xx:xx:xx:xx:xx

echo "unir con S68"
echo -n "Presionar una tecla... "; read gagme
sudo rfcomm bind 0 xx:xx:xx:xx:xx:xx 2

echo "mostrar rfcomm"
echo -n "Presionar una tecla... "; read gagme
sudo rfcomm show

echo "crear nodo"
echo -n "Presionar una tecla... "; read gagme
sudo mknod -m 666 /dev/rfcomm0 c 216 0

echo "cargar sdpd"
echo -n "Presionar una tecla... "; read gagme
sudo sdpd

echo "asignar canal 2"
echo -n "Presionar una tecla... "; read gagme
sudo sdptool add --channel=2 DUN

echo "realizar conexion gprs"
echo "terminar conexion con: CTRL-C"
echo -n "Presionar una tecla... "; read gagme
sudo /usr/sbin/pppd call gprs

echo "Completada la conexion"
echo -n "Presionar una tecla... "; read gagme
exit 0
----------------------------------------------

this woks correctly with the bt_modules-2.4.31 and bluez-utils.unc old version of 13,61 Mb, but with the two last versions of bluez-utils.uci 731,46 Kb and the last of 657,54 Kb I have this error when it try to exec hcid (all the previous insmod to hcid goes ok):

....
cargar hcid
Presionar una tecla...
sudo: hcid: command not found
....

I can see hcid in /opt/bluez-utils/sbin/hcid
but seems that is not in the path

With bluez-utils.unc (old version) I can see hcid in /usr/sbin

perhaps because one is .uci and the other is .unc., but the reality is that in the .uci don't find it.

The next commands to hcid don't works for the same reason (command not found)

The solution I found is to call this files with:

----------
...
echo "cargar hcid"
echo -n "Presionar una tecla... "; read gagme
sudo /opt/bluez-utils/sbin/hcid
...
and so on with the other commands (some with /opt/bluez-utils/sbin/ and some with /opt/bluez-utils/bin)

perhaps, is posible to do this within the .uci? or to put a path? or something else?

I hope my conect-blue.sh can be usefull to someone

Thanks.

(Sorry that my english is not so good)  :)

Posted by Juanito on Nov. 22 2007,04:20
The latest bluez-utils.uci should put symlinks for all the executables into /opt/bin which is in the path - could you check if this is so?

Even if the symlinks are in opt/bin (eg /opt/bin/hciconfig -> /opt/bluez-utils/sbin/hciconfig), it appears that scripts do not find them, at least in the script I tried. I do not know why this should be, but perhaps it could be fixed by putting a path statement at the start of the script?

Note also, you could put the bluetooth modules into /mydsl/modules to have them loaded automatically at boot if you use bluetooth all the time. The only drawback with this would be that the crc32 module needs to be loaded before the bnep module (if you use the bep module).

Posted by Onyarian on Nov. 22 2007,16:42
I have verified that the symlinks are in /opt/bin but when I execute:

sudo /op/bin/hcid
the response is:

sudo: /opt/bin/hcid: command not found

If I double click in emelfm over /opt/bin/hcid symlink the response is:

sh: line 1: ./hcid: no such file or directory
----end-of-output----

Now I delete this /opt/bin/hcid symlink and create a new one to /opt/bin/ from the /opt/bluez-utils/sbin/hcid and now this /opt/bin/hcid symlink works OK.

so I have verified that with all symlinks in /opt/bin occurs the same. Perhaps there is an error in the generation of the symlinks to /opt/bin.

Perhaps the key is the "line1: ./hcid" of the symlink, its lookink to a wrong place
Can you verified it?

Posted by Juanito on Nov. 23 2007,07:03
I get the following when I load the latest extension:
Code Sample
$ ls -l /opt/bin/hcid
lrwxrwxrwx    1 root     root           34 Nov 23 09:47 /opt/bin/hcid -> /ramdisk/opt/bluez-utils/sbin/hcid

Maybe the problem is that it should read "/opt/bin/hcid -> /opt/bluez-utils/sbin/hcid".

Let me try with that and see if it makes a difference.

Posted by ^thehatsrule^ on Nov. 23 2007,07:26
Quote (Juanito @ Nov. 23 2007,02:03)
I get the following when I load the latest extension:
Code Sample
$ ls -l /opt/bin/hcid
lrwxrwxrwx    1 root     root           34 Nov 23 09:47 /opt/bin/hcid -> /ramdisk/opt/bluez-utils/sbin/hcid

Maybe the problem is that it should read "/opt/bin/hcid -> /opt/bluez-utils/sbin/hcid".

Let me try with that and see if it makes a difference.

If you remember with the xorg extension, we had a similar problem with a similar symlink.  All the tests were done on frugal environments, where /ramdisk exists.  Our first traditional style hdd-install tester reported errors, which was fixed by changing the symlink as described.

Posted by Juanito on Nov. 23 2007,07:41
Aaah - that would make sense. I created the symlinks by highlighting the whole lot in emelFM and clicking the "symlink" button, I guess I'll have to do it like this in future:
Code Sample
$ sudo ln -s /opt/my-app/bin/* /opt/bin

...but even allowing for that, a script to autostart a bt device wouldn't work for me either, I guess more trouble-shooting is required.

Edit (and here it is):
Code Sample
$ ls -l /opt/bin/hcid
lrwxrwxrwx    1 root     root           26 Nov 23 14:38 /opt/bin/hcid -> /opt/bluez-utils/sbin/hcid
$ cat /opt/mybt_test.sh
#!/bin/bash
#
hciconfig hci0 up
hcid restart
sdpd
#
# EOF

$ sudo /opt/mybt_test.sh
/opt/mybt_test.sh: line 3: hciconfig: command not found
/opt/mybt_test.sh: line 4: hcid: command not found
/opt/mybt_test.sh: line 5: sdpd: command not found

...but if I add a path statement:
Code Sample
$ cat /opt/mybt_test.sh
#!/bin/bash
#
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/games:/opt/bin:.
#
hciconfig hci0 up
hcid restart
sdpd
#
# EOF

$ sudo /opt/mybt_test.sh
$ hciconfig
hci0:   Type: USB
       BD Address: 00:10:C6:56:F4:9F ACL MTU: 192:8 SCO MTU: 64:8
       UP RUNNING PSCAN ISCAN
       RX bytes:99 acl:0 sco:0 events:13 errors:0
       TX bytes:300 acl:0 sco:0 commands:13 errors:0

- so it appears /opt/bin is not in the path as far as running scripts is concerned?

Posted by ^thehatsrule^ on Nov. 23 2007,17:05
That's due to the use of sudo, which resets PATH to safe defaults.

In your script, you can just use something like `export PATH="$PATH:/opt/bin"` instead which is easier to decipher (unless you want to edit sudoers..)

Side note: I remember that /opt/bin was added to root's path for convenience with some uci/targz extensions, but it now also seems to include the current directory.  I am led to believe that this is not good practice...

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.