-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: a bytes-like object is required, not 'int' #40
Comments
I found that the problem is with internalblue/utils/packing.py so i updated u8 function to this:
01-16 05:46:00.952 15136 15169 E %s restarting the bluetooth process.: command_timed_out and after this bluetooth is restarting. |
Hi @jurek4321, definitely looks as if something goes wrong there. To debug if it is the Once you connect with InternalBlue, you should see a version command (because that's the first thing InternalBlue does to determine the correct firmware file), and you should also see the contents of the packet when or before it breaks. @unixb0y did some changes to the If you see stuff in Wireshark but not in InternalBlue, I can do some debugging these days and check if the new Best, |
Ah, and maybe one thing I should add: If InternalBlue gets the correct firmware version answer, it will send a command starting with |
Thanks for replay, how i can get correct patch to build bluetooth stack for z3c? |
I tried to build it for z3c but when i run "breakfast z3c" i get following error: ** Don't have a product spec for: 'lineage_z3c' |
Hi @jurek4321, building the module properly is somewhat complicated and I did that a loooong time ago :( I just realized that the debugging method with Wireshark in parallel doesn't seem to work, at least not with my setup, because the socket seems to be exclusive. However, that depends a bit on the precise setup. This is how the output looks like on my Nexus 5 with the most recent version of InternalBlue:
Depending on what you want to do you can also work around via InternalBlue instead of fixing your Android Workaround 1: Use the serial TTY interface within Android instead of modifying the driver.For this, you can call InternalBlue with the internalblue/internalblue/adbcore.py Line 347 in 070f828
Note that I did not test these commands on Android 6, only on 8-10. Thus, you might need to adapt them. But in general, you can always echo raw bytes into the Bluetooth serial interfaces. Forwarding this via You cannot enable the DIAG mode like this, because then you'd still get messages that are either ignored by Android or crash the driver. DIAG mode is the Workaround 2: Disable DIAGAssuming that your recompiled driver works (or the one you downloaded from here) except from diagnostics, you can also just remove this function: internalblue/internalblue/core.py Line 2157 in 070f828
Hope that helps you on the way to fixing your issues :) And good luck with compiling Android ;) Best, |
Hi @jiska2342, I successfully build bluetooth.default.so for z3c, but i still have the same problem that i have with ready build bluetooth.default.so for nexus 5. When im trying to receive with lmp monitoring enabled im getting errors in logcat and bluetooth is restarting:
Do you have any idea why its still not working and how i can fix it? |
Hi @jurek4321 , |
@jiska2342 , i know that it may not work, but as i wrote before i build bluetooth.default.so for z3c. I build it for lineage 14.1 and i'm using it with lineage 14.1. So it looks like patch for nexus 5 is not working with z3c. Is it possible that patch for nexus5 will not work with z3c? Did i need to change something it patch? |
Most likely, you will have to build |
Describe the bug
Hello, i'm trying to use it on sony z3 compact, so i installed lineage 14.1 and installed bluetooth.default.so for nexus 5 as it has the same broadcom chip, but when i try to use connect command i get error.
Hardware and operating system
Sony z3c with lineageos 14.1 from https://volatilesystems.org/dl/lineageos/14.1/z3c/ and this bluetooth stack https://github.com/seemoo-lab/internalblue/tree/master/android/lineageos14_1_hammerhead .
To Reproduce
Logs or screenshots
Python log:
% ./internalblue .local/bin debian
dpkg-query: no path found matching pattern bin/armeabilinux*-as*
Could not find 'as' installed for ContextType(arch = 'thumb', bits = 32, endian = 'little')
Try installing binutils for this architecture:
https://docs.pwntools.com/en/stable/install/binutils.html
[!] pwntools cannot find binutils for arm architecture. Disassembling will not work!
dpkg-query: no path found matching pattern bin/armeabilinux*-as*
Could not find 'as' installed for ContextType(arch = 'thumb', bits = 32, endian = 'little')
Try installing binutils for this architecture:
https://docs.pwntools.com/en/stable/install/binutils.html
[!] pwntools cannot find binutils for arm architecture. Disassembling will not work!
[] HCI device: hci0 [00:1A:7D:DA:71:11] flags=5
[] Found multiple adb devices
[🍺] Please specify device:
1) hci: 00:1A:XX:XX:XX:XX (hci0)
2) adb: YT910ZTYAT (Xperia Z3C)
Choice [1]
2
[] Connected to YT910ZTYAT
[] Chip identifier: 0x6109 (003.001.009)
[] Using fw_0x6109.py
[] Loaded firmware information for BCM4335C0.
[] Try to enable debugging on H4 (warning if not supported)...
[] Starting commandLoop for self.internalblue <internalblue.adbcore.ADBCore object at 0x7fdac5990208>
/ /_ / /____ _______ ___ / / _ )/ / _____
/ // _ / __/ -) / _ / _ `/ / _ / / // / -)
/////_/_// ////_,////_,/_/
type <help -v> for usage information!
Android Logcat:
01-15 10:30:29.338 6638 6666 W %s legacy transmit of command. Use transmit_command instead.: transmit_downward
01-15 10:30:33.038 968 1113 D lights.msm8974: led [solid] = 6000ff00
01-15 10:30:33.096 968 1302 E BatteryStatsService: no controller energy info supplied
01-15 10:30:33.096 968 1302 E BatteryStatsService: no controller energy info supplied
01-15 10:30:33.097 968 3575 E BatteryStatsService: power: Missing API
01-15 10:30:33.142 968 1302 E BatteryStatsService: modem info is invalid: ModemActivityInfo{ mTimestamp=0 mSleepTimeMs=0 mIdleTimeMs=0 mTxTimeMs[]=[0, 0, 0, 0, 0] mRxTimeMs=0 mEnergyUsed=0}
01-15 10:30:34.378 6638 6665 W bt_hci_packet_fragmenter: reassemble_and_dispatch got continuation for unknown packet. Dropping it.
01-15 10:30:34.450 6638 6669 W bt_btm : btm_acl_created hci_handle=12 link_role=1 transport=1
01-15 10:30:34.450 6638 6669 W bt_l2cap: L2CAP got conn_comp for unknown BD_ADDR
01-15 10:30:42.454 6638 6658 E bt_hci : command_timed_out hci layer timeout waiting for response to a command. opcode: 0x41d
01-15 10:30:42.454 6638 6658 E %s restarting the bluetooth process.: command_timed_out
01-15 10:30:42.455 6638 6658 I %s : ssr_cleanup
01-15 10:30:42.457 6638 6658 E bt_hci : hci_cmd_timeout: SOC Status is reset
01-15 10:30:42.457 6638 6658 E bt_hci :
01-15 10:30:42.524 2535 2535 D BluetoothInputDevice: Proxy object disconnected
01-15 10:30:42.524 2535 2535 D HidProfile: Bluetooth service disconnected
01-15 10:30:42.524 2535 2535 D BluetoothPan: BluetoothPAN Proxy object disconnected
01-15 10:30:42.524 2535 2535 D PanProfile: Bluetooth service disconnected
01-15 10:30:42.524 2535 2535 D BluetoothMap: Proxy object disconnected
01-15 10:30:42.524 2535 2535 D MapProfile: Bluetooth service disconnected
01-15 10:30:42.524 2535 2535 D BluetoothA2dp: Proxy object disconnected
01-15 10:30:42.525 2535 2535 D BluetoothPbap: Proxy object disconnected
01-15 10:30:42.525 2535 2535 D PbapServerProfile: Bluetooth service disconnected
01-15 10:30:42.525 968 2316 W BluetoothManagerService: Profile service for profile: ComponentInfo{com.android.bluetooth/com.android.bluetooth.hfp.HeadsetService} died.
01-15 10:30:42.527 968 968 D BluetoothManagerService: BluetoothServiceConnection, disconnected: com.android.bluetooth.btservice.AdapterService
01-15 10:30:42.527 968 968 D BluetoothManagerService: BluetoothServiceConnection, disconnected: com.android.bluetooth.gatt.GattService
01-15 10:30:42.527 968 968 D BluetoothA2dp: Proxy object disconnected
01-15 10:30:42.527 968 968 D AudioService: mConnectedBTDevicesList size 0
01-15 10:30:42.527 2535 5070 D BluetoothHeadset: Proxy object disconnected
01-15 10:30:42.527 2535 2535 D HeadsetProfile: Bluetooth service disconnected
01-15 10:30:42.527 968 2316 D BluetoothHeadset: Proxy object disconnected
01-15 10:30:42.528 2505 2530 D BluetoothHeadset: Proxy object disconnected
01-15 10:30:42.528 968 2316 D BluetoothHeadset: Proxy object disconnected
01-15 10:30:42.528 2150 2150 D BluetoothInputDevice: Proxy object disconnected
01-15 10:30:42.528 968 2316 D BluetoothHeadset: Proxy object disconnected
01-15 10:30:42.528 2150 2150 D HidProfile: Bluetooth service disconnected
01-15 10:30:42.529 2150 2150 D BluetoothPan: BluetoothPAN Proxy object disconnected
01-15 10:30:42.529 2150 2150 D PanProfile: Bluetooth service disconnected
01-15 10:30:42.530 2150 2150 D BluetoothMap: Proxy object disconnected
01-15 10:30:42.530 2150 2150 D MapProfile: Bluetooth service disconnected
01-15 10:30:42.531 968 1306 E BluetoothManagerService: MESSAGE_BLUETOOTH_SERVICE_DISCONNECTED(1)
01-15 10:30:42.531 968 1306 D BluetoothManagerService: Broadcasting onBluetoothServiceDown() to 5 receivers.
01-15 10:30:42.531 2150 2150 D BluetoothA2dp: Proxy object disconnected
01-15 10:30:42.531 968 1306 D BluetoothAdapter: onBluetoothServiceDown: Sending callbacks to 0 clients
01-15 10:30:42.531 968 1306 D BluetoothAdapter: onBluetoothServiceDown: Finished sending callbacks to registered clients
01-15 10:30:42.531 968 1306 D BluetoothManagerService: Sending BLE State Change: ON > TURNING_OFF
01-15 10:30:42.532 2535 2583 D BluetoothAdapter: onBluetoothServiceDown: Sending callbacks to 1 clients
01-15 10:30:42.532 2535 2583 D BluetoothAdapter: onBluetoothServiceDown: Finished sending callbacks to registered clients
01-15 10:30:42.532 2505 2821 D BluetoothAdapter: onBluetoothServiceDown: Sending callbacks to 0 clients
01-15 10:30:42.532 2505 2821 D BluetoothAdapter: onBluetoothServiceDown: Finished sending callbacks to registered clients
01-15 10:30:42.532 3469 3517 D BluetoothAdapter: onBluetoothServiceDown: Sending callbacks to 0 clients
01-15 10:30:42.532 3469 3517 D BluetoothAdapter: onBluetoothServiceDown: Finished sending callbacks to registered clients
01-15 10:30:42.532 2150 2150 D BluetoothPbap: Proxy object disconnected
01-15 10:30:42.532 2150 2150 D PbapServerProfile: Bluetooth service disconnected
01-15 10:30:42.533 2150 2678 D BluetoothHeadset: Proxy object disconnected
01-15 10:30:42.533 2150 2189 D BluetoothAdapter: onBluetoothServiceDown: Sending callbacks to 1 clients
01-15 10:30:42.533 2150 2189 D BluetoothAdapter: onBluetoothServiceDown: Finished sending callbacks to registered clients
01-15 10:30:42.534 968 3562 I ActivityManager: Process com.android.bluetooth (pid 6638) has died
01-15 10:30:42.534 968 3562 D ActivityManager: cleanUpApplicationRecord -- 6638
01-15 10:30:42.534 2150 2150 D HeadsetProfile: Bluetooth service disconnected
01-15 10:30:42.534 968 3562 W ActivityManager: Scheduling restart of crashed service com.android.bluetooth/.hid.HidService in 1000ms
01-15 10:30:42.535 968 3562 W ActivityManager: Scheduling restart of crashed service com.android.bluetooth/.hdp.HealthService in 1000ms
01-15 10:30:42.535 968 3562 W ActivityManager: Scheduling restart of crashed service com.android.bluetooth/.pbap.BluetoothPbapService in 1000ms
01-15 10:30:42.536 968 3562 W ActivityManager: Scheduling restart of crashed service com.android.bluetooth/.map.BluetoothMapService in 1000ms
01-15 10:30:42.536 968 3562 W ActivityManager: Scheduling restart of crashed service com.android.bluetooth/.hfp.HeadsetService in 1000ms
01-15 10:30:42.536 968 3562 W ActivityManager: Scheduling restart of crashed service com.android.bluetooth/.gatt.GattService in 1000ms
01-15 10:30:42.536 968 3562 W ActivityManager: Scheduling restart of crashed service com.android.bluetooth/.btservice.AdapterService in 11000ms
01-15 10:30:42.537 968 3562 W ActivityManager: Scheduling restart of crashed service com.android.bluetooth/.opp.BluetoothOppService in 21000ms
01-15 10:30:42.537 968 3562 W ActivityManager: Scheduling restart of crashed service com.android.bluetooth/.pan.PanService in 21000ms
01-15 10:30:42.537 968 3562 W ActivityManager: Scheduling restart of crashed service com.android.bluetooth/.a2dp.A2dpService in 20999ms
01-15 10:30:42.540 338 338 I brcm-uim: brcm-uim:After Polling to check POLLERR | POLLHUP erro = 1
01-15 10:30:42.540 338 338 I brcm-uim: brcm-uim:Breaking out from RE_POLL_TILL_POLL_ERR while loop with err=1
01-15 10:30:42.542 968 968 D AudioService: mConnectedBTDevicesList size 0
01-15 10:30:42.543 968 1306 D BluetoothManagerService: Bluetooth is complete send Service Down
01-15 10:30:42.543 968 1306 D BluetoothManagerService: Broadcasting onBluetoothServiceDown() to 5 receivers.
01-15 10:30:42.543 968 1306 D BluetoothAdapter: onBluetoothServiceDown: Sending callbacks to 0 clients
01-15 10:30:42.543 968 1306 D BluetoothAdapter: onBluetoothServiceDown: Finished sending callbacks to registered clients
01-15 10:30:42.543 968 1306 D BluetoothManagerService: unbindAndFinish(): null mBinding = false mUnbinding = false
01-15 10:30:42.543 968 1306 D BluetoothManagerService: Sending BLE State Change: TURNING_OFF > OFF
01-15 10:30:42.543 3469 3517 D BluetoothAdapter: onBluetoothServiceDown: Sending callbacks to 0 clients
01-15 10:30:42.543 3469 3517 D BluetoothAdapter: onBluetoothServiceDown: Finished sending callbacks to registered clients
01-15 10:30:42.544 2535 2577 D BluetoothAdapter: onBluetoothServiceDown: Sending callbacks to 1 clients
01-15 10:30:42.544 2535 2577 D BluetoothAdapter: onBluetoothServiceDown: Finished sending callbacks to registered clients
01-15 10:30:42.544 2150 2192 D BluetoothAdapter: onBluetoothServiceDown: Sending callbacks to 1 clients
01-15 10:30:42.544 2150 2192 D BluetoothAdapter: onBluetoothServiceDown: Finished sending callbacks to registered clients
01-15 10:30:42.544 2150 2784 D BluetoothEventManager: isFirstBoot: false state: 13
01-15 10:30:42.545 338 338 I brcm-uim: brcm-uim:value of install = 0
01-15 10:30:42.545 338 338 I brcm-uim: brcm-uim:value of dev_fd = 6
01-15 10:30:42.545 338 338 I brcm-uim: brcm-uim:snoop_enable = 0
01-15 10:30:42.546 2505 2525 D BluetoothAdapter: onBluetoothServiceDown: Sending callbacks to 0 clients
01-15 10:30:42.546 2505 2525 D BluetoothAdapter: onBluetoothServiceDown: Finished sending callbacks to registered clients
01-15 10:30:42.548 2535 2535 D BluetoothEventManager: isFirstBoot: false state: 13
01-15 10:30:42.549 338 338 I brcm-uim: brcm-uim:cleanup complete
01-15 10:30:42.549 338 338 I brcm-uim: brcm-uim: setting upio power to 0
01-15 10:30:42.549 338 338 D bt_upio : upio_set_bluetooth_power(on: 0)
01-15 10:30:42.549 338 338 D bt_upio : is_emulator_context : 0
01-15 10:30:42.549 338 338 D bt_upio : is_rfkill_disabled ? [0]
01-15 10:30:42.549 338 338 D bt_upio : is_rfkill_disabled returned
01-15 10:30:42.549 338 338 D bt_upio : is_rfkill_disabled returned ret 0
01-15 10:30:42.549 338 338 I brcm-uim: brcm-uim:begin polling
01-15 10:30:42.549 338 338 I brcm-uim: brcm-uim:Polling to check POLLERR | POLLHUP on install fd
Additional context
It happens when i enter connect 1c:23:..... or any other working device.
os: debian buster.
The text was updated successfully, but these errors were encountered: