rhysmorgan134 / react-carplay

MIT License
382 stars 58 forks source link

App not detecting phone being plugged in #20

Closed Tigo2000 closed 1 year ago

Tigo2000 commented 1 year ago

App does not recognize/detect phone, following message is shown: "Connect iPhone to begin CarPlay". After a few seconds the following is output to the console:

volvo@raspberrypi:~ $ sudo /home/volvo/Desktop/Carplay.AppImage --no-sandbox

/root/.config/ReactCarplay spawning carplay { dpi: 240, nightMode: 0, hand: 0, boxName: 'nodePlay', width: 800, height: 480, fps: 30 } directory found device not connected Socket connected. sending data...

14 0.225 0.7032967032967034 (node:1762) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'transfer' of null at /tmp/.mount_CarplaAMpFNp/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:247:29 at new Promise () at /tmp/.mount_CarplaAMpFNp/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:246:13 at new Promise () at DongleHandler.serialise (/tmp/.mount_CarplaAMpFNp/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:237:16) at DongleHandler.sendTouch (/tmp/.mount_CarplaAMpFNp/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:145:14) at Carplay.sendTouch (/tmp/.mount_CarplaAMpFNp/resources/app.asar/node_modules/node-carplay/modules/Carplay.js:25:22) at IpcMainImpl. (/tmp/.mount_CarplaAMpFNp/resources/app.asar/build/electron/main.js:99:17) at IpcMainImpl.emit (events.js:315:20) at Object. (electron/js2c/browser_init.js:161:9492) (Use carplay --trace-warnings ... to show where the warning was created) (node:1762) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:1762) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 16 0.225 0.7032967032967034 (node:1762) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'transfer' of null at /tmp/.mount_CarplaAMpFNp/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:247:29 at new Promise () at /tmp/.mount_CarplaAMpFNp/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:246:13 at new Promise () at DongleHandler.serialise (/tmp/.mount_CarplaAMpFNp/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:237:16) at DongleHandler.sendTouch (/tmp/.mount_CarplaAMpFNp/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:145:14) at Carplay.sendTouch (/tmp/.mount_CarplaAMpFNp/resources/app.asar/node_modules/node-carplay/modules/Carplay.js:25:22) at IpcMainImpl. (/tmp/.mount_CarplaAMpFNp/resources/app.asar/build/electron/main.js:99:17) at IpcMainImpl.emit (events.js:315:20) at Object. (electron/js2c/browser_init.js:161:9492) (node:1762) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

Tried connecting the phone using Wi-Fi, BlueTooth, a lightning cable plugged in the Carlinkit adapter, and a lightning cable plugged in the rpi itself. Also created the udev rules using the setup-pi.sh script from this repo.

Raspberry Pi 3b+ (Linux raspberrypi 5.15.76-v7+ #1597 SMP Fri Nov 4 12:13:17 GMT 2022 armv7l GNU/Linux) react-carplay release v1.0.4. Carlinkit CPC200-CCPA iPhone 6S ffplay version 4.3.5-0+deb11u1+rpt2 ffmpeg version 4.3.5-0+deb11u1+rpt2

Any ideas? Let me know if any more info is needed.

Thanks!

rhysmorgan134 commented 1 year ago

It doesn’t appear to be detecting your dongle at all, device not connected should read device connected.

which dongle are you using and is it genuine? If you can send the pid and vid of it from lsusb when it’s connected, that may help

Tigo2000 commented 1 year ago

Bought the dongle directly from https://carlinkit.store, it's the CPC200-CCPA.

lsusb:

Bus 001 Device 006: ID 1314:1521
Bus 001 Device 004: ID 0424:7800 Standard Microsystems Corp. Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Just spoke with LRYMND as well, he mentioned downgrading to raspbian buster so currently testing that.

It should recognize the dongle even if there's no phone plugged in, correct?

rhysmorgan134 commented 1 year ago

Yeah so it has got the same values so “should” work. Agree with trying on buster, the appimage was packaged on that version so is the best step to try first.

Please feedback if it works, and I will rebuild.

Tigo2000 commented 1 year ago

Hi Rhys,

Just tested with Buster:

volvo@raspberrypi:~ $ uname -a raspberrypi 5.10.103-v7+ #1529 SMP Tue Mar 8 12:21:37 GMT 2022 armv7l GNU/Linux volvo@raspberrypi:~ $ cat /etc/udev/rules.d/52-nodecarplay.rules SUBSYSTEM=="usb", ATTR{idVendor}=="1314", ATTR{idProduct}=="1520", MODE="0660", GROUP="plugdev" volvo@raspberrypi:~ $ lsusb Bus 001 Device 006: ID 1314:1521
Bus 001 Device 004: ID 0424:7800 Standard Microsystems Corp. Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Starting app:

volvo@raspberrypi:~ $ sudo /home/volvo/Desktop/React-Carplay/Carplay.AppImage --no-sandbox /root/.config/ReactCarplay spawning carplay { dpi: 240, nightMode: 0, hand: 0, boxName: 'nodePlay', width: 800, height: 480, fps: 30 } directory found device not connected Socket connected. sending data... 14 0.591743119266055 0.02923076923076923 (node:976) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'transfer' of null at /tmp/.mount_CarplaUhegXx/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:247:29 at new Promise () at /tmp/.mount_CarplaUhegXx/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:246:13 at new Promise () at DongleHandler.serialise (/tmp/.mount_CarplaUhegXx/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:237:16) at DongleHandler.sendTouch (/tmp/.mount_CarplaUhegXx/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:145:14) at Carplay.sendTouch (/tmp/.mount_CarplaUhegXx/resources/app.asar/node_modules/node-carplay/modules/Carplay.js:25:22) at IpcMainImpl. (/tmp/.mount_CarplaUhegXx/resources/app.asar/build/electron/main.js:99:17) at IpcMainImpl.emit (events.js:315:20) at Object. (electron/js2c/browser_init.js:161:9492) (Use carplay --trace-warnings ... to show where the warning was created) (node:976) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) (node:976) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 16 0.591743119266055 0.02923076923076923 (node:976) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'transfer' of null at /tmp/.mount_CarplaUhegXx/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:247:29 at new Promise () at /tmp/.mount_CarplaUhegXx/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:246:13 at new Promise () at DongleHandler.serialise (/tmp/.mount_CarplaUhegXx/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:237:16) at DongleHandler.sendTouch (/tmp/.mount_CarplaUhegXx/resources/app.asar/node_modules/node-carplay/modules/DongleHandler.js:145:14) at Carplay.sendTouch (/tmp/.mount_CarplaUhegXx/resources/app.asar/node_modules/node-carplay/modules/Carplay.js:25:22) at IpcMainImpl. (/tmp/.mount_CarplaUhegXx/resources/app.asar/build/electron/main.js:99:17) at IpcMainImpl.emit (events.js:315:20) at Object. (electron/js2c/browser_init.js:161:9492) (node:976) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

Same error sadly.

Tigo2000 commented 1 year ago

Just picked up a secondhand Carlinkit adapter (CPC200-CCPM) and that one is recognized in the app:

directory found device connected and ready starting projection

lsusb shows ID 1314:1520 on this new dongle rather than ID 1314:1521 on the 'old' dongle.

Glad that this works, but it would be great to get the original dongle (CPC200-CCPA) working since that one supports Wi-Fi/BT and this dongle only supports a wired connection. Do you have any ideas as to why the original dongle doesn't work?

Let me know if you need any more info.

Thanks!

rhysmorgan134 commented 1 year ago

Great news, should be a straight forward fix, just need to add in the extra product ID or maybe just search by vendor ID, the. The new dongle should work (if it uses the same protocol)

thanks for figuring it out!

LRYMND commented 1 year ago

I investigated now a bit and figured that 3 months ago, the necessary changes were already made to node-carplay (Added support for CPC200-CCPA).

Dependencies for my own app are at ^2.0.8 and it is downloading 2.0.9 after inspecting the package.json in the node-carplay folder. However the code for Donglehandler.js ist still the outdated version and the commit from above is missing. Do you eventually need to update the NPM package or should it pick up the changes from the git repo automatically?

Tigo2000 commented 1 year ago

Tested earlier today and by editing the DongleHandler.js to reflect the changes in the commit that LRYMND mentioned above, the CCPA dongle is recognized by the app.

Agreed with LRYMND to check the npm package/installation process. After that I think this issue can be closed :)

rhysmorgan134 commented 1 year ago

I’ll get package.json update and rebuild, thanks guys.

rhysmorgan134 commented 1 year ago

latest release should fix above issues

Nickelpick12 commented 10 months ago

Hello, I am having the same issue as what was described before. Here is the link to the dongle I got.

When I run lsusb:

raspberry@raspberrypi:~/Desktop $ lsusb Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver Bus 001 Device 007: ID 05ac:12a8 Apple, Inc. iPhone 5/5C/5S/6/SE Bus 001 Device 004: ID 0461:4e66 Primax Electronics, Ltd HP USB Optical Mouse Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I belive Device 007 is the dongle. Any advise?

kostasfe commented 10 months ago

@Nickelpick12 , unfortunately you've got the wrong dongle. There's another thread (#32) specifying which of them work. Your dongle is just for making CarPlay functionality you already from wired into wireless. Instead you need to get one that gives you CarPlay functionality in the first place.