WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: bluetooth what is really needed  (Read 5076 times)

Offline fow0ryl

  • Newbie
  • *
  • Posts: 12
bluetooth what is really needed
« on: August 22, 2017, 08:05:40 AM »
Hello,

after installing TC the first time I tried to get bluetooth running. This is needed for use of a bacode scanner.

So I decided to install bluez.
Then I check the local bluetooth device with "hcitool dev". Thats ok
Then I scanned for bluetooth devices "hci scan". Ok again.
Connecting a bluetooth mouse with "sudo hidd --connect" works fine.

Ok, to make the connection permanent I found an entry that uses simple-agent.
But where to find simple agent?

Next try.
Looking around I found a topic where blueman is used for easy setup. So I installed blueman. Bad idea.
Closing some windows freezes the system. No mouse, no keyboard anymore.
Removed the power and restart the system again. Using blueman to configure a bluetooth device freezes the system.

Should I reinstall the whole system?
Or how can I remove blueman and all of its dependencies?

Spending 2 days to get the basic installation work.
- no bluetooth yet
- german keyboard is very ugly (only a few basic key's are working)
, xorg not running yet to support needed resolution

I'm near the point of giving up....

Henning


Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: bluetooth what is really needed
« Reply #1 on: August 22, 2017, 08:14:47 AM »
simple-agent  should be provided by  bluez.tcz , no?
Download a copy and keep it handy: Core book ;)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11701
Re: bluetooth what is really needed
« Reply #2 on: August 22, 2017, 08:16:00 AM »
Hi fow0ryl
Quote
Or how can I remove blueman and all of its dependencies?
Use the  Apps  utility. Go to  Apps->Maintenance->Onboot Maintenance  and select the extension you want to remove. It will add
unneeded dependencies to the list of items to remove automatically. Then restart the system to complete the removal process.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: bluetooth what is really needed
« Reply #3 on: August 22, 2017, 12:04:19 PM »
simple-agent is provided by the x86 bluez, but the x86_64 bluez is newer and works differently = which are you using?
« Last Edit: August 22, 2017, 12:09:13 PM by Juanito »

Offline fow0ryl

  • Newbie
  • *
  • Posts: 12
Re: bluetooth what is really needed
« Reply #4 on: August 22, 2017, 12:48:15 PM »
Hello,

first I have tried to remove blueman via "Onboot Maintenance". blueman was the last line, and before the blueman entry there was an empty line.
Have removed that empty line and all extensions are gone. No GUI anymore :(
So I decided to install from scratch. Only half an hour this time ...

I found that simple-agent is part of bluez (must be x86, the old sempron CPU ist not capable of 64 bit)
But it looks like a python script, and python was not installed.

Followed these  instructions http://www.m-opensolutions.com/?p=240  until point 4.
The bluetooth barcode scanner is working without any password request?!

After installing python the simple-agent is running too and requesting the password as described.
Followed step 6 and everything went fine. The requested file "trusts" is found in /var/lib/bluetooth/...

But why I need point 5 & 6? There is no difference, exept that there are more files at /var/lib/bluetooth/...
The scanner is already working at point 4.

Okay. Followed the instructions till the end. After Reboot als files are restored. But Scanner is not working :(
I have to manually do a "hid --connect" to get the scanner work.

Henning

Offline fow0ryl

  • Newbie
  • *
  • Posts: 12
Re: bluetooth what is really needed
« Reply #5 on: August 23, 2017, 08:31:45 AM »
I guess there is something missing.
Regardless of executing steps 5 & 6 as described before or not, I always have to switch the scanner on, and do a "sudo hidd -t 3600 --connect ..."
10 minutes after the last scan the scanner goes to sleep.
"hidd --show" shows no devices anymore.

The scanner wakes up when scanning a barcode again.
But bluetooth remains off.
I have to connect again.

Is the something like udev to reactivate the scanner automaticly ?

Henning

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: bluetooth what is really needed
« Reply #6 on: August 23, 2017, 10:56:48 AM »
udev would wait for a peripheral to attempt to contact your tc machine - in this case your tc machine needs to contact the scanner to wake it up?
« Last Edit: August 23, 2017, 11:00:26 AM by Juanito »

Offline fow0ryl

  • Newbie
  • *
  • Posts: 12
Re: bluetooth what is really needed
« Reply #7 on: August 24, 2017, 03:09:04 AM »
No, The scanner goes to sleep after 10 minutes. "hidd --show" , says no devide connected.
If you like to scan again, you have to "power on" by pressing the scan button and hold it for a second. After a short beep, the scanner is ready again. Just press the scan button to scan a new barcode. I think its very similar to a bluetooth mouse. If the mouse goes to sleep, you have to push any button to wake it up.

But in tc the device remains unconnected until I do a "hidd --connect".
After connecting manually it is visible with dmesg too.
Code: [Select]
hid-generic 0005:0100:0040.0011: unknown main item tag 0x0
input: S as /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42/0005:0100:0040.0011/input/input22
hid-generic 0005:0100:0040.0011: input,hidraw0: BLUETOOTH HID v0.33 Keyboard [S] on 00:11:b1:07:a3:97
If I power off the scanner manually, the dmesg entry is still there ...

I tried to find out what I need, but don't understand it yet. Thats what I find, if the device is connected.
Code: [Select]
tc@box:/home$ udevadm info -a -p /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42/0005:0100:0040.0012/hidr
aw/hidraw0

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42/0005:0100:0040.0012/hidraw/hidraw0':
    KERNEL=="hidraw0"
    SUBSYSTEM=="hidraw"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42/0005:0100:0040.0012':
    KERNELS=="0005:0100:0040.0012"
    SUBSYSTEMS=="hid"
    DRIVERS=="hid-generic"
    ATTRS{country}=="33"

  looking at parent device '/devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42':
    KERNELS=="hci0:42"
    SUBSYSTEMS=="bluetooth"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0':
    KERNELS=="hci0"
    SUBSYSTEMS=="bluetooth"
    DRIVERS==""

  looking at parent device '/devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0':
    KERNELS=="4-1:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="btusb"
    ATTRS{bInterfaceProtocol}=="01"
    ATTRS{bInterfaceNumber}=="00"
    ATTRS{bInterfaceSubClass}=="01"
    ATTRS{bInterfaceClass}=="e0"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{authorized}=="1"
    ATTRS{bNumEndpoints}=="03"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:13.2/usb4/4-1':
    KERNELS=="4-1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bDeviceClass}=="e0"
    ATTRS{bmAttributes}=="c0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{version}==" 2.00"
    ATTRS{devnum}=="2"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{idProduct}=="0001"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{urbnum}=="45372"
    ATTRS{bDeviceSubClass}=="01"
    ATTRS{maxchild}=="0"
    ATTRS{bcdDevice}=="1958"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{idVendor}=="0a12"
    ATTRS{product}=="Bluetooth V2.0 Dongle"
    ATTRS{speed}=="12"
    ATTRS{removable}=="unknown"
    ATTRS{ltm_capable}=="no"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{busnum}=="4"
    ATTRS{authorized}=="1"
    ATTRS{quirks}=="0x0"
    ATTRS{configuration}==""
    ATTRS{devpath}=="1"
    ATTRS{bDeviceProtocol}=="01"
    ATTRS{bNumInterfaces}==" 2"

  looking at parent device '/devices/pci0000:00/0000:00:13.2/usb4':
    KERNELS=="usb4"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{bDeviceClass}=="09"
    ATTRS{manufacturer}=="Linux 4.8.17-tinycore ohci_hcd"
    ATTRS{bmAttributes}=="e0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{version}==" 1.10"
    ATTRS{devnum}=="1"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{idProduct}=="0001"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{urbnum}=="205"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{maxchild}=="2"
    ATTRS{bcdDevice}=="0408"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{idVendor}=="1d6b"
    ATTRS{product}=="OHCI PCI host controller"
    ATTRS{speed}=="12"
    ATTRS{authorized_default}=="1"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{removable}=="unknown"
    ATTRS{ltm_capable}=="no"
    ATTRS{serial}=="0000:00:13.2"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{busnum}=="4"
    ATTRS{authorized}=="1"
    ATTRS{quirks}=="0x0"
    ATTRS{configuration}==""
    ATTRS{devpath}=="0"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bNumInterfaces}==" 1"

  looking at parent device '/devices/pci0000:00/0000:00:13.2':
    KERNELS=="0000:00:13.2"
    SUBSYSTEMS=="pci"
    DRIVERS=="ohci-pci"
    ATTRS{subsystem_device}=="0x4389"
    ATTRS{vendor}=="0x1002"
    ATTRS{d3cold_allowed}=="0"
    ATTRS{msi_bus}=="1"
    ATTRS{device}=="0x4389"
    ATTRS{local_cpulist}=="0-1"
    ATTRS{class}=="0x0c0310"
    ATTRS{driver_override}=="(null)"
    ATTRS{local_cpus}=="3"
    ATTRS{enable}=="1"
    ATTRS{irq}=="18"
    ATTRS{broken_parity_status}=="0"
    ATTRS{dma_mask_bits}=="32"
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{subsystem_vendor}=="0x1002"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""


Is there any place in tc, where I can look for these events?
As far as I understand thats what udev is for.

Of course I can write a script, thats trying to connect in a loop. But thats not a real fine solution...
« Last Edit: August 24, 2017, 03:24:36 AM by fow0ryl »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: bluetooth what is really needed
« Reply #8 on: August 24, 2017, 03:41:19 AM »
Ah - I misunderstood.

You should be able to create a udev rule, which executes a script when the scanner is activated again, and add it to your backup.

Offline fow0ryl

  • Newbie
  • *
  • Posts: 12
Re: bluetooth what is really needed
« Reply #9 on: August 24, 2017, 04:06:23 AM »
Yes I think so, but I don't understand ...
All Information I have found, is available only after I connect manually.

But how to find a information that is usable in a udev rule?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: bluetooth what is really needed
« Reply #10 on: August 24, 2017, 04:29:31 AM »
"udevadmin monitor" and then press the button to wake the scanner?

Offline fow0ryl

  • Newbie
  • *
  • Posts: 12
Re: bluetooth what is really needed
« Reply #11 on: August 24, 2017, 06:40:34 AM »
Okay,
the trick is to stay calm.
The first event takes about 20 seconds after power on, ...
Code: [Select]
tc@box:~$ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[9610.482252] add      /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
UDEV  [9610.483450] add      /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
KERNEL[9614.930133] remove   /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
UDEV  [9614.930948] remove   /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
KERNEL[9618.468147] add      /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:43 (bluetooth)
UDEV  [9618.469085] add      /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:43 (bluetooth)
KERNEL[9622.823668] remove   /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:43 (bluetooth)
UDEV  [9622.824673] remove   /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:43 (bluetooth)
KERNEL[9626.397144] add      /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:44 (bluetooth)
UDEV  [9626.398030] add      /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:44 (bluetooth)
KERNEL[9630.718673] remove   /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:44 (bluetooth)
UDEV  [9630.719605] remove   /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:44 (bluetooth)
KERNEL[9658.643161] add      /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
UDEV  [9658.644196] add      /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
KERNEL[9662.930679] remove   /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
UDEV  [9662.931695] remove   /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
KERNEL[9699.873175] add      /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
UDEV  [9699.874206] add      /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
KERNEL[9704.317149] remove   /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
UDEV  [9704.317925] remove   /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
KERNEL[9723.184184] add      /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)
UDEV  [9723.185217] add      /devices/pci0000:00/0000:00:13.2/usb4/4-1/4-1:1.0/bluetooth/hci0/hci0:42 (bluetooth)

I will try to create a udev rule now...