teslacam icon indicating copy to clipboard operation
teslacam copied to clipboard

Tesla not seeing USB drive

Open natrlhy opened this issue 5 years ago • 51 comments

Thanks for this code. Hoping to get it fully working. Here are the steps I've taken to go through the install. I've done everything thus far as root:

`Insert your SDHC card into your PC. Launch Etcher. Point it to the location of the Raspbian .zip file and flash the card. When that is completed, I ejected the card and reinserted it. Connect the Micro USB to USB cable to the USB labeled port on the Pi Zero W

Use an SSH client to SSH to the Pi Zero W

hostname: rasbperrypi.local username: pi password: raspberry

Do everything as root:

sudo su - cd /boot vi wpa_supplicant.conf

Paste this for the WiFi Setup:

country=us update_config=1 ctrl_interface=/var/run/wpa_supplicant

network={ scan_ssid=1 ssid="yourwifi" psk="yourpassword" }

reboot

SSH back into the Pi to install DaemonTools:

mkdir -p /package chmod 1755 /package cd /package

wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz tar -xpf daemontools-0.76.tar.gz rm -f daemontools-0.76.tar.gz cd admin/daemontools-0.76

ed ./src/conf-cc 1s/$/ -include errno.h/ wq package/install

apt-get install csh csh -cf '/command/svscanboot &' sed -i "1 a\csh -cf '/command/svscanboot &'" /etc/rc.local chmod +x /etc/rc.local

Install Node.js: mkdir -p /opt/node; cd /opt/node wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-armv6l.tar.xz tar -xvf node-v10.16.0-linux-armv6l.tar.xz chown -R root:root node-v10.16.0-linux-armv6l ln -s /opt/node/node-v10.16.0-linux-armv6l/bin/* /usr/bin/

apt-get install git git config --global user.name "Me" git config --global user.email [email protected] cd /home/pi git clone https://github.com/milesburton/teslacam mkdir -p /etc/service;cd /etc/service;ln -s /home/pi/teslacam/services/* . cd /home/pi/teslacam;npm install cd /home/pi/teslacam/src/remote;npm install`

When I plug it into the USB port on the PI and the front USB on the Tesla M3, I never see the icon on the touchscreen that signifies the USB drive is seen.

I haven't done any DropBox integration yet as ultimately I want to upload to my Synology NAS

natrlhy avatar Jul 18 '19 02:07 natrlhy

Does the drive mount when you plug it in to your PC? That's the first ACID test to make sure it appears

milesburton avatar Jul 18 '19 07:07 milesburton

When I first flashed it I saw /boot. Now I don't see that in Explorer.

SSH:

pi@teslacam:~ $ df -h Filesystem Size Used Avail Use% Mounted on /dev/root 59G 1.6G 55G 3% / devtmpfs 213M 0 213M 0% /dev tmpfs 217M 0 217M 0% /dev/shm tmpfs 217M 3.1M 214M 2% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 217M 0 217M 0% /sys/fs/cgroup /dev/mmcblk0p1 253M 40M 214M 16% /boot tmpfs 44M 0 44M 0% /run/user/1000

natrlhy avatar Jul 18 '19 13:07 natrlhy

Take a look at the logs tail -f /home/pi/teslacam/services/dashcam-monitor/log/main/current. See if it's doing anything strange.

It's probably a permission issue, or maybe corrupt disk images.

On Thu, Jul 18, 2019 at 2:41 PM natrlhy [email protected] wrote:

When I first flashed it I saw /boot. Now I don't see that in Explorer.

SSH:

pi@teslacam:~ $ df -h Filesystem Size Used Avail Use% Mounted on /dev/root 59G 1.6G 55G 3% / devtmpfs 213M 0 213M 0% /dev tmpfs 217M 0 217M 0% /dev/shm tmpfs 217M 3.1M 214M 2% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 217M 0 217M 0% /sys/fs/cgroup /dev/mmcblk0p1 253M 40M 214M 16% /boot tmpfs 44M 0 44M 0% /run/user/1000

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/milesburton/teslacam/issues/17?email_source=notifications&email_token=AAJGHMYUGNKE42ZUIREODS3QABXIBA5CNFSM4IEWOCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2IQKXI#issuecomment-512820573, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJGHM6U6B6EUSZTIQF3LALQABXIBANCNFSM4IEWOCTQ .

milesburton avatar Jul 18 '19 14:07 milesburton

Not seeing any logs in that dir...

natrlhy avatar Jul 18 '19 14:07 natrlhy

My bet is it's not running. if you go to /home/pi and run npm start what does it say/do

On Thu, Jul 18, 2019 at 3:32 PM natrlhy [email protected] wrote:

Not seeing any logs in that dir...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/milesburton/teslacam/issues/17?email_source=notifications&email_token=AAJGHM2OBCRPCUPSY65QQMDQAB5GPA5CNFSM4IEWOCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2IVNNI#issuecomment-512841397, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJGHM3Y7NGPQVWOPOZ7INDQAB5GPANCNFSM4IEWOCTQ .

milesburton avatar Jul 18 '19 14:07 milesburton

root@teslacam:/home/pi# npm start npm ERR! path /home/pi/package.json npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open '/home/pi/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2019-07-18T14_43_17_323Z-debug.log

root@teslacam:/home/pi# more /root/.npm/_logs/2019-07-18T14_43_17_323Z-debug.log 0 info it worked if it ends with ok 1 verbose cli [ '/opt/node/node-v10.16.0-linux-armv6l/bin/node', 1 verbose cli '/usr/bin/npm', 1 verbose cli 'start' ] 2 info using [email protected] 3 info using [email protected] 4 verbose stack Error: ENOENT: no such file or directory, open '/home/pi/package.json' 5 verbose cwd /home/pi 6 verbose Linux 4.19.57+ 7 verbose argv "/opt/node/node-v10.16.0-linux-armv6l/bin/node" "/usr/bin/npm" "start" 8 verbose node v10.16.0 9 verbose npm v6.9.0 10 error path /home/pi/package.json 11 error code ENOENT 12 error errno -2 13 error syscall open 14 error enoent ENOENT: no such file or directory, open '/home/pi/package.json' 15 error enoent This is related to npm not being able to find a file. 16 verbose exit [ -2, true ]

natrlhy avatar Jul 18 '19 14:07 natrlhy

Sorry, run it from the teslacam directory

On Thu, Jul 18, 2019 at 3:43 PM natrlhy [email protected] wrote:

root@teslacam:/home/pi# npm start npm ERR! path /home/pi/package.json npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall open npm ERR! enoent ENOENT: no such file or directory, open '/home/pi/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2019-07-18T14_43_17_323Z-debug.log

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/milesburton/teslacam/issues/17?email_source=notifications&email_token=AAJGHM4VKGWLXYLXKB2OFQDQAB6RRA5CNFSM4IEWOCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2IWSBQ#issuecomment-512846086, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJGHM4VNVGRRQXZMFEMSV3QAB6RRANCNFSM4IEWOCTQ .

milesburton avatar Jul 18 '19 14:07 milesburton

Ok...

root@teslacam:/home/pi/teslacam# npm start

[email protected] start /home/pi/teslacam node src/services start

Running [sudo svc -u /home/pi/teslacam/./services/dashcam-monitor] svc: warning: unable to control /home/pi/teslacam/./services/dashcam-monitor: file does not exist Running [sudo svc -u /home/pi/teslacam/./services/dropbox-upload] svc: warning: unable to control /home/pi/teslacam/./services/dropbox-upload: file does not exist Running [sudo svc -u /home/pi/teslacam/./services/rotate-video] svc: warning: unable to control /home/pi/teslacam/./services/rotate-video: file does not exist (node:648) ExperimentalWarning: The fs.promises API is experimental

natrlhy avatar Jul 18 '19 14:07 natrlhy

Looks like it's not installed correctly. Can you run an "ls -lart" within the teslacam folder and again in the services folder? You may need to clone the repo again

milesburton avatar Jul 18 '19 14:07 milesburton

root@teslacam:/home/pi/teslacam# pwd /home/pi/teslacam root@teslacam:/home/pi/teslacam# ls -lart total 208 drwxr-xr-x 4 pi pi 4096 Jul 17 16:58 .. -rw-r--r-- 1 root root 222 Jul 17 16:58 .eslintrc.json -rw-r--r-- 1 root root 13 Jul 17 16:58 .eslintignore -rw-r--r-- 1 root root 8307 Jul 17 16:58 README.md -rw-r--r-- 1 root root 703 Jul 17 16:58 package.json -rw-r--r-- 1 root root 11357 Jul 17 16:58 LICENSE drwxr-xr-x 2 root root 4096 Jul 17 16:58 installation drwxr-xr-x 2 root root 4096 Jul 17 16:58 images -rw-r--r-- 1 root root 1324 Jul 17 16:58 .gitignore drwxr-xr-x 2 root root 4096 Jul 17 16:58 etc drwxr-xr-x 5 root root 4096 Jul 17 16:58 services drwxr-xr-x 3 root root 4096 Jul 17 16:58 src -rw-r--r-- 1 root root 57247 Jul 17 16:58 yarn.lock drwxr-xr-x 2 root root 4096 Jul 17 16:58 video drwxr-xr-x 2 root root 4096 Jul 17 16:58 supervise drwxr-xr-x 8 root root 4096 Jul 17 16:58 .git lrwxrwxrwx 1 root root 39 Jul 17 16:59 rotate-video -> /home/pi/teslacam/services/rotate-video lrwxrwxrwx 1 root root 41 Jul 17 16:59 dropbox-upload -> /home/pi/teslacam/services/dropbox-upload lrwxrwxrwx 1 root root 42 Jul 17 16:59 dashcam-monitor -> /home/pi/teslacam/services/dashcam-monitor drwxr-xr-x 194 root root 4096 Jul 17 17:17 node_modules -rw-r--r-- 1 root root 66747 Jul 17 17:17 package-lock.json drwxr-xr-x 11 root root 4096 Jul 17 17:17 .

root@teslacam:/home/pi/teslacam/services# ls -latrh total 20K drwxr-xr-x 4 root root 4.0K Jul 17 16:58 rotate-video drwxr-xr-x 4 root root 4.0K Jul 17 16:58 dropbox-upload drwxr-xr-x 4 root root 4.0K Jul 17 16:58 dashcam-monitor drwxr-xr-x 5 root root 4.0K Jul 17 16:58 . drwxr-xr-x 11 root root 4.0K Jul 17 17:17 ..

natrlhy avatar Jul 18 '19 14:07 natrlhy

This looks wrong:

rwxrwxrwx 1 root root 39 Jul 17 16:59 rotate-video -> /home/pi/teslacam/services/rotate-video lrwxrwxrwx 1 root root 41 Jul 17 16:59 dropbox-upload -> /home/pi/teslacam/services/dropbox-upload lrwxrwxrwx 1 root root 42 Jul 17 16:59 dashcam-monitor -> /home/pi/teslacam/services/dashcam-monitor

I'd abort this install, and delete the teslacam folder and clone down the repo again. Your existing symlinks should still be valid

On Thu, Jul 18, 2019 at 3:49 PM natrlhy [email protected] wrote:

root@teslacam:/home/pi/teslacam# pwd /home/pi/teslacam root@teslacam:/home/pi/teslacam# ls -lart total 208 drwxr-xr-x 4 pi pi 4096 Jul 17 16:58 .. -rw-r--r-- 1 root root 222 Jul 17 16:58 .eslintrc.json -rw-r--r-- 1 root root 13 Jul 17 16:58 .eslintignore -rw-r--r-- 1 root root 8307 Jul 17 16:58 README.md -rw-r--r-- 1 root root 703 Jul 17 16:58 package.json -rw-r--r-- 1 root root 11357 Jul 17 16:58 LICENSE drwxr-xr-x 2 root root 4096 Jul 17 16:58 installation drwxr-xr-x 2 root root 4096 Jul 17 16:58 images -rw-r--r-- 1 root root 1324 Jul 17 16:58 .gitignore drwxr-xr-x 2 root root 4096 Jul 17 16:58 etc drwxr-xr-x 5 root root 4096 Jul 17 16:58 services drwxr-xr-x 3 root root 4096 Jul 17 16:58 src -rw-r--r-- 1 root root 57247 Jul 17 16:58 yarn.lock drwxr-xr-x 2 root root 4096 Jul 17 16:58 video drwxr-xr-x 2 root root 4096 Jul 17 16:58 supervise drwxr-xr-x 8 root root 4096 Jul 17 16:58 .git lrwxrwxrwx 1 root root 39 Jul 17 16:59 rotate-video -> /home/pi/teslacam/services/rotate-video lrwxrwxrwx 1 root root 41 Jul 17 16:59 dropbox-upload -> /home/pi/teslacam/services/dropbox-upload lrwxrwxrwx 1 root root 42 Jul 17 16:59 dashcam-monitor -> /home/pi/teslacam/services/dashcam-monitor drwxr-xr-x 194 root root 4096 Jul 17 17:17 node_modules -rw-r--r-- 1 root root 66747 Jul 17 17:17 package-lock.json drwxr-xr-x 11 root root 4096 Jul 17 17:17 .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/milesburton/teslacam/issues/17?email_source=notifications&email_token=AAJGHM3FAOQKVKCRQKGVPHLQAB7IXA5CNFSM4IEWOCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2IXGZY#issuecomment-512848743, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJGHM6OBUPA76KQ54XNFCLQAB7IXANCNFSM4IEWOCTQ .

milesburton avatar Jul 18 '19 14:07 milesburton

Ok, and it's not an issue that it's all running as root? Should I reflash?

My steps for cloning the repo is valid?

cd /home/pi git clone https://github.com/milesburton/teslacam

natrlhy avatar Jul 18 '19 14:07 natrlhy

During installation you need to install daemon tools etc - this requires root.

The teslacam code itself doesn't require root, but you will need to install the ~/teslacam/installation/sudoers file to white list certain commands such as enabling host usb mode on the pi.

For the sake of getting it running, I'd just get it running as root - when it works, lock it down (all commands run as sudo, so you can restrict the code from doing anything unexpected)

On Thu, Jul 18, 2019 at 3:54 PM natrlhy [email protected] wrote:

Ok, and it's not an issue that it's all running as root?

My steps for cloning the repo is valid?

cd /home/pi git clone https://github.com/milesburton/teslacam

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/milesburton/teslacam/issues/17?email_source=notifications&email_token=AAJGHM3ACBYHO4SLQBGRURTQAB7ZLA5CNFSM4IEWOCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2IXWAI#issuecomment-512850689, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJGHM5GKVFFMPKX4YKL4RLQAB7ZLANCNFSM4IEWOCTQ .

milesburton avatar Jul 18 '19 14:07 milesburton

Ok... I know one of your desires was to get an updated install guide setup. I'd be happy to help flush things out during my initial testing of this. I didn't see anything about the ~/teslacam/installation/sudoers installation so I'll add that to my notes thus far

natrlhy avatar Jul 18 '19 15:07 natrlhy

That would be great. It's still a work in progress so as improvements are made I've neglected to update the docs by mistake.

Just FYI there are two additional branches. One which uses Docker to avoid the pain of installation, and another which uses EXT4 instead of FAT32. You may want to check those out once you have master running.

On Thu, Jul 18, 2019 at 4:17 PM natrlhy [email protected] wrote:

Ok... I know one of your desires was to get an updated install guide setup. I'd be happy to help flush things out during my initial testing of this. I didn't see anything about the ~/teslacam/installation/sudoers installation so I'll add that to my notes thus far

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/milesburton/teslacam/issues/17?email_source=notifications&email_token=AAJGHM3C3WOEF6G4KURMJBLQACCSDA5CNFSM4IEWOCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2I2IBY#issuecomment-512861191, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJGHMZYUXPJEGCTAV6W74DQACCSDANCNFSM4IEWOCTQ .

milesburton avatar Jul 18 '19 15:07 milesburton

I wonder if one of my issues is using this:

2019-07-10-raspbian-buster-lite.zip

natrlhy avatar Jul 18 '19 15:07 natrlhy

Possibly but I doubt it.

On Thu, Jul 18, 2019 at 4:36 PM natrlhy [email protected] wrote:

I wonder if one of my issues is using this:

2019-07-10-raspbian-buster-lite.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/milesburton/teslacam/issues/17?email_source=notifications&email_token=AAJGHMYTAVTPLRW3UDEOARDQACEY5A5CNFSM4IEWOCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2I4HNI#issuecomment-512869301, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJGHM76SA4IJD5PXO5477TQACEY5ANCNFSM4IEWOCTQ .

milesburton avatar Jul 18 '19 15:07 milesburton

When doing the 1st npm install I get this. Is this of concern?

npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN [email protected] requires a peer of react@^15.3.0 || ^16.0.0-alpha but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of react-dom@^15.3.0 || ^16.0.0-alpha but none is installed. You must install peer dependencies yourself. npm WARN [email protected] No repository field.

added 216 packages from 153 contributors and audited 620 packages in 191.416s found 0 vulnerabilities

natrlhy avatar Jul 18 '19 17:07 natrlhy

Re-did everything. Services don't seem to ever start. I tried entering things into the /etc/rc.local but no go. Not sure where I'm going wrong. These are my steps:

Steps to get a Raspberry Pi Zero W setup for TeslaCam on Windows

Hardware:

https://www.amazon.com/gp/product/B013G4EAEI/ https://www.amazon.com/gp/product/B0748MPQT4/ 64GB SDHC Card (already had one I got from Costco)

Download and the latest "lite" Raspbian: https://www.raspberrypi.org/downloads/raspbian/ Download and install Etcher: https://www.balena.io/etcher/

Insert your SDHC card into your PC. Launch Etcher. Point it to the location of the Raspbian .zip file and flash the card. When that is completed, re-insert the SDHC card into your PC

===== Enable OTG on the Pi Zero W =====

Follow this great guide to setup OTG on the Pi Zero W: https://blog.gbaman.info/?p=791

Browse to the /boot partition on the SDHC card on your PC Add this to the bottom of the config.txt file: dtoverlay=dwc2 Save the file

Add this to the cmdline.txt file. Place it right after rootwait with a space at the end of it. Be careful as syntax is critical: modules-load=dwc2,g_ether

Save the file

===== Configure WiFi =====

Follow this guide for WiFi setup: https://www.raspberrypi-spy.co.uk/2017/04/manually-setting-up-pi-wifi-using-wpa_supplicant-conf/

Create a file called wpa_supplicant.conf Paste this for the WiFi Setup:

country=us update_config=1 ctrl_interface=/var/run/wpa_supplicant

network={ scan_ssid=1 ssid="yourwifi" psk="yourpassword" }

Save the file

==== Boot the Pi Zero W for the first time =====

Eject the SDHC card from your PC Place the SDHC card into the proper slot on the Pi Zero W Connect your USB Micro to USB cable to the USB port on the Pi Zero W Connect the this to your PC and wait for the Pi to boot (about 2 minutes. The green light on the Pi will be solid green)

Use an SSH client to SSH to the Pi Zero W

hostname: rasbperrypi.local username: pi password: raspberry

===== Installing daemontools ===== https://isotope11.com/blog/manage-your-services-with-daemontools

SSH back into the Pi to install daemontools:

sudo su - mkdir -p /package chmod 1755 /package cd /package

wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz tar -xpf daemontools-0.76.tar.gz rm -f daemontools-0.76.tar.gz cd admin/daemontools-0.76

ed ./src/conf-cc 1s/$/ -include errno.h/ wq

package/install

apt-get install csh csh -cf '/command/svscanboot &' sed -i "1 a\csh -cf '/command/svscanboot &'" /etc/rc.local chmod +x /etc/rc.local reboot

===== Install Node.js =====

mkdir -p /opt/node; cd /opt/node wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-armv6l.tar.xz tar -xvf node-v10.16.0-linux-armv6l.tar.xz chown -R root:root node-v10.16.0-linux-armv6l ln -s /opt/node/node-v10.16.0-linux-armv6l/bin/* /usr/bin/

===== Install GIT =====

apt-get install git

As the pi User:

cd /home/pi git clone https://github.com/milesburton/teslacam

===== Final Steps =====

As root:

mkdir -p /etc/service;cd /etc/service;ln -s /home/pi/teslacam/services/* . vi /etc/sudoers r /home/pi/teslacam/installation/sudoers reboot

As the pi User:

cd /home/pi/teslacam;npm install cd /home/pi/teslacam/src/remote;npm install

sudo poweroff

Plug the Pi Zero W into the Tesla media USB ports (the front ports). Make sure you use the data port on the Pi, google if you are unsure. Reboot, once the automatic configuration completes (circa 1 minute) the car should detect the Pi as a USB drive.

natrlhy avatar Jul 18 '19 17:07 natrlhy

OK let's try something simple.

Let's start the dashcam-monitor.js directly. To do that, cd /home/pi/teslacam/src; node dashcam-monitor.js // whilst plugged in to your computer.

The services could be something irrelevant. Now you've checked out the code again, what did npm run start do for you from /home/pi/teslacam?

On Thu, Jul 18, 2019 at 6:47 PM natrlhy [email protected] wrote:

Re-did everything. Services don't seem to ever start. I tried entering things into the /etc/rc.local but no go. Not sure where I'm going wrong. These are my steps:

Steps to get a Raspberry Pi Zero W setup for TeslaCam on Windows

Hardware:

https://www.amazon.com/gp/product/B013G4EAEI/ https://www.amazon.com/gp/product/B0748MPQT4/ 64GB SDHC Card (already had one I got from Costco)

Download and the latest "lite" Raspbian: https://www.raspberrypi.org/downloads/raspbian/ Download and install Etcher: https://www.balena.io/etcher/

Insert your SDHC card into your PC. Launch Etcher. Point it to the location of the Raspbian .zip file and flash the card. When that is completed, re-insert the SDHC card into your PC

===== Enable OTG on the Pi Zero W =====

Follow this great guide to setup OTG on the Pi Zero W: https://blog.gbaman.info/?p=791

Browse to the /boot partition on the SDHC card on your PC Add this to the bottom of the config.txt file: dtoverlay=dwc2 Save the file

Add this to the cmdline.txt file. Place it right after rootwait with a space at the end of it. Be careful as syntax is critical: modules-load=dwc2,g_ether

Save the file

===== Configure WiFi =====

Follow this guide for WiFi setup: https://www.raspberrypi-spy.co.uk/2017/04/manually-setting-up-pi-wifi-using-wpa_supplicant-conf/

Create a file called wpa_supplicant.conf Paste this for the WiFi Setup:

country=us update_config=1 ctrl_interface=/var/run/wpa_supplicant

network={ scan_ssid=1 ssid="yourwifi" psk="yourpassword" }

Save the file

==== Boot the Pi Zero W for the first time =====

Eject the SDHC card from your PC Place the SDHC card into the proper slot on the Pi Zero W Connect your USB Micro to USB cable to the USB port on the Pi Zero W Connect the this to your PC and wait for the Pi to boot (about 2 minutes. The green light on the Pi will be solid green)

Use an SSH client to SSH to the Pi Zero W

hostname: rasbperrypi.local username: pi password: raspberry

===== Installing daemontools ===== https://isotope11.com/blog/manage-your-services-with-daemontools

SSH back into the Pi to install daemontools:

sudo su - mkdir -p /package chmod 1755 /package cd /package

wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz tar -xpf daemontools-0.76.tar.gz rm -f daemontools-0.76.tar.gz cd admin/daemontools-0.76

ed ./src/conf-cc 1s/$/ -include errno.h/ wq

package/install

apt-get install csh csh -cf '/command/svscanboot &' sed -i "1 a\csh -cf '/command/svscanboot &'" /etc/rc.local chmod +x /etc/rc.local reboot

===== Install Node.js =====

mkdir -p /opt/node; cd /opt/node wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-armv6l.tar.xz tar -xvf node-v10.16.0-linux-armv6l.tar.xz chown -R root:root node-v10.16.0-linux-armv6l ln -s /opt/node/node-v10.16.0-linux-armv6l/bin/* /usr/bin/

===== Install GIT =====

apt-get install git

As the pi User:

cd /home/pi git clone https://github.com/milesburton/teslacam

===== Final Steps =====

As root:

mkdir -p /etc/service;cd /etc/service;ln -s /home/pi/teslacam/services/* . vi /etc/sudoers r /home/pi/teslacam/installation/sudoers reboot

As the pi User:

cd /home/pi/teslacam;npm install cd /home/pi/teslacam/src/remote;npm install

sudo poweroff

Plug the Pi Zero W into the Tesla media USB ports (the front ports). Make sure you use the data port on the Pi, google if you are unsure. Reboot, once the automatic configuration completes (circa 1 minute) the car should detect the Pi as a USB drive.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/milesburton/teslacam/issues/17?email_source=notifications&email_token=AAJGHMYSZPPFBU2IJ2H32QTQACUD7A5CNFSM4IEWOCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2JIL3Q#issuecomment-512919022, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJGHM2VJNTBSILHMCCNPADQACUD7ANCNFSM4IEWOCTQ .

milesburton avatar Jul 18 '19 18:07 milesburton

I got this error when just using the command:

pi@raspberrypi:~ $ /home/pi/teslacam/src; node dashcam-monitor.js -bash: /home/pi/teslacam/src: Is a directory internal/modules/cjs/loader.js:638 throw err; ^

Error: Cannot find module '/home/pi/dashcam-monitor.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Function.Module.runMain (internal/modules/cjs/loader.js:829:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

But when I cd to the /home/pi/teslacam/src and run node dashcam-monitor.js:

pi@raspberrypi:~/teslacam/src $ node dashcam-monitor.js Starting Tesla Sync script Unmounting image All Running [sudo /sbin/modprobe -r g_mass_storage] Preparing to unmount local image 0 Running [sudo /bin/umount /mnt] umount: /mnt: not mounted. Failed: code [32]: umount: /mnt: not mounted. Running [sudo /sbin/losetup -d /dev/loop0] losetup: /dev/loop0: detach failed: No such device or address Failed: code [1]: losetup: /dev/loop0: detach failed: No such device or address (node:507) ExperimentalWarning: The fs.promises API is experimental Video /home/pi/teslacam/video/.gitkeep is 0 bytes. Deleting file Running [rm /home/pi/teslacam/video/.gitkeep] Running [fallocate -l 1024M /home/pi/teslacam/images/cam0] Running [echo "type=c" | /sbin/sfdisk /home/pi/teslacam/images/cam0] ======================= Success Checking that no-one is using this disk right now ... OK

Disk /home/pi/teslacam/images/cam0: 1 GiB, 1073741824 bytes, 2097152 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

Created a new DOS disklabel with disk identifier 0x7958db6d. /home/pi/teslacam/images/cam0p1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 1023 MiB. /home/pi/teslacam/images/cam0p2: Done.

New situation: Disklabel type: dos Disk identifier: 0x7958db6d

Device Boot Start End Sectors Size Id Type /home/pi/teslacam/images/cam0p1 2048 2097151 2095104 1023M c W95 FAT32 (LBA)

The partition table has been altered. Syncing disks. ======================= /Success Preparing to local mount image 0 Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam0" | tail -1] Success: 1072693248 Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam0" | tail -1] Success: 2095104 Sector size: 512 Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam0" | tail -1] Success: 2048 Running [sudo /sbin/losetup -o 1048576 /dev/loop0 /home/pi/teslacam/images/cam0] Running [sudo /sbin/mkfs.vfat /dev/loop0 -F 32 -I] Success: mkfs.fat 4.1 (2017-01-24) Preparing to unmount local image 0 Running [sudo /bin/umount /mnt] umount: /mnt: not mounted. Failed: code [32]: umount: /mnt: not mounted. Running [sudo /sbin/losetup -d /dev/loop0] Running [fallocate -l 1024M /home/pi/teslacam/images/cam1] Running [echo "type=c" | /sbin/sfdisk /home/pi/teslacam/images/cam1] ======================= Success Checking that no-one is using this disk right now ... OK

Disk /home/pi/teslacam/images/cam1: 1 GiB, 1073741824 bytes, 2097152 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

Created a new DOS disklabel with disk identifier 0xb8117a6c. /home/pi/teslacam/images/cam1p1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 1023 MiB. /home/pi/teslacam/images/cam1p2: Done.

New situation: Disklabel type: dos Disk identifier: 0xb8117a6c

Device Boot Start End Sectors Size Id Type /home/pi/teslacam/images/cam1p1 2048 2097151 2095104 1023M c W95 FAT32 (LBA)

The partition table has been altered. Syncing disks. ======================= /Success Preparing to local mount image 1 Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam1" | tail -1] Success: 1072693248 Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam1" | tail -1] Success: 2095104 Sector size: 512 Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam1" | tail -1] Success: 2048 Running [sudo /sbin/losetup -o 1048576 /dev/loop1 /home/pi/teslacam/images/cam1] Running [sudo /sbin/mkfs.vfat /dev/loop1 -F 32 -I] Success: mkfs.fat 4.1 (2017-01-24) Preparing to unmount local image 1 Running [sudo /bin/umount /mnt] umount: /mnt: not mounted. Failed: code [32]: umount: /mnt: not mounted. Running [sudo /sbin/losetup -d /dev/loop1] Preparing to local mount image 0 Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam0" | tail -1] Success: 1072693248 Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam0" | tail -1] Success: 2095104 Sector size: 512 Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam0" | tail -1] Success: 2048 Running [sudo /sbin/losetup -o 1048576 /dev/loop0 /home/pi/teslacam/images/cam0] Running [sudo /bin/mount -o gid=pi,uid=pi /dev/loop0 /mnt] No files found Preparing to unmount local image 0 Running [sudo /bin/umount /mnt] Running [sudo /sbin/losetup -d /dev/loop0] Preparing to local mount image 1 Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam1" | tail -1] Success: 1072693248 Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam1" | tail -1] Success: 2095104 Sector size: 512 Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam1" | tail -1] Success: 2048 Running [sudo /sbin/losetup -o 1048576 /dev/loop1 /home/pi/teslacam/images/cam1] Running [sudo /bin/mount -o gid=pi,uid=pi /dev/loop1 /mnt] No files found Preparing to unmount local image 1 Running [sudo /bin/umount /mnt] Running [sudo /sbin/losetup -d /dev/loop1] Preparing to mount image 0 Running [sudo /sbin/modprobe g_mass_storage file=/home/pi/teslacam/images/cam0 removable=1 ro=0 stall=0 iSerialNumber=11610] Waiting for video files

As the pi user here's the output for npm:

pi@raspberrypi:~/teslacam $ pwd /home/pi/teslacam pi@raspberrypi:~/teslacam $ npm run start

[email protected] start /home/pi/teslacam node src/services start

Running [sudo svc -u /home/pi/teslacam/./services/dashcam-monitor] svc: warning: unable to control /home/pi/teslacam/./services/dashcam-monitor: file does not exist Running [sudo svc -u /home/pi/teslacam/./services/dropbox-upload] svc: warning: unable to control /home/pi/teslacam/./services/dropbox-upload: file does not exist Running [sudo svc -u /home/pi/teslacam/./services/rotate-video] svc: warning: unable to control /home/pi/teslacam/./services/rotate-video: file does not exist (node:812) ExperimentalWarning: The fs.promises API is experimental

natrlhy avatar Jul 18 '19 19:07 natrlhy

OK the node script you ran looks good, did it mount anything on your machine?

Not sure why npm start isn't playing ball. Let's start with the raw dashcam script to make sure that's doing what it should and go from there

On Thu, Jul 18, 2019 at 8:24 PM natrlhy [email protected] wrote:

I got this error when just using the command:

pi@raspberrypi:~ $ /home/pi/teslacam/src; node dashcam-monitor.js -bash: /home/pi/teslacam/src: Is a directory internal/modules/cjs/loader.js:638 throw err; ^

Error: Cannot find module '/home/pi/dashcam-monitor.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Function.Module.runMain (internal/modules/cjs/loader.js:829:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

But when I cd to the /home/pi/teslacam/src and run node dashcam-monitor.js:

pi@raspberrypi:~/teslacam/src $ node dashcam-monitor.js Starting Tesla Sync script Unmounting image All Running [sudo /sbin/modprobe -r g_mass_storage] Preparing to unmount local image 0 Running [sudo /bin/umount /mnt] umount: /mnt: not mounted. Failed: code [32]: umount: /mnt: not mounted. Running [sudo /sbin/losetup -d /dev/loop0] losetup: /dev/loop0: detach failed: No such device or address Failed: code [1]: losetup: /dev/loop0: detach failed: No such device or address (node:507) ExperimentalWarning: The fs.promises API is experimental Video /home/pi/teslacam/video/.gitkeep is 0 bytes. Deleting file Running [rm /home/pi/teslacam/video/.gitkeep] Running [fallocate -l 1024M /home/pi/teslacam/images/cam0] Running [echo "type=c" | /sbin/sfdisk /home/pi/teslacam/images/cam0] ======================= Success Checking that no-one is using this disk right now ... OK

Disk /home/pi/teslacam/images/cam0: 1 GiB, 1073741824 bytes, 2097152 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

Created a new DOS disklabel with disk identifier 0x7958db6d. /home/pi/teslacam/images/cam0p1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 1023 MiB. /home/pi/teslacam/images/cam0p2: Done.

New situation: Disklabel type: dos Disk identifier: 0x7958db6d

Device Boot Start End Sectors Size Id Type /home/pi/teslacam/images/cam0p1 2048 2097151 2095104 1023M c W95 FAT32 (LBA)

The partition table has been altered. Syncing disks. ======================= /Success Preparing to local mount image 0 Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam0" | tail -1] Success: 1072693248 Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam0" | tail -1] Success: 2095104 Sector size: 512 Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam0" | tail -1] Success: 2048 Running [sudo /sbin/losetup -o 1048576 /dev/loop0 /home/pi/teslacam/images/cam0] Running [sudo /sbin/mkfs.vfat /dev/loop0 -F 32 -I] Success: mkfs.fat 4.1 (2017-01-24) Preparing to unmount local image 0 Running [sudo /bin/umount /mnt] umount: /mnt: not mounted. Failed: code [32]: umount: /mnt: not mounted. Running [sudo /sbin/losetup -d /dev/loop0] Running [fallocate -l 1024M /home/pi/teslacam/images/cam1] Running [echo "type=c" | /sbin/sfdisk /home/pi/teslacam/images/cam1] ======================= Success Checking that no-one is using this disk right now ... OK

Disk /home/pi/teslacam/images/cam1: 1 GiB, 1073741824 bytes, 2097152 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes

Created a new DOS disklabel with disk identifier 0xb8117a6c. /home/pi/teslacam/images/cam1p1: Created a new partition 1 of type 'W95 FAT32 (LBA)' and of size 1023 MiB. /home/pi/teslacam/images/cam1p2: Done.

New situation: Disklabel type: dos Disk identifier: 0xb8117a6c

Device Boot Start End Sectors Size Id Type /home/pi/teslacam/images/cam1p1 2048 2097151 2095104 1023M c W95 FAT32 (LBA)

The partition table has been altered. Syncing disks. ======================= /Success Preparing to local mount image 1 Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam1" | tail -1] Success: 1072693248 Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam1" | tail -1] Success: 2095104 Sector size: 512 Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam1" | tail -1] Success: 2048 Running [sudo /sbin/losetup -o 1048576 /dev/loop1 /home/pi/teslacam/images/cam1] Running [sudo /sbin/mkfs.vfat /dev/loop1 -F 32 -I] Success: mkfs.fat 4.1 (2017-01-24) Preparing to unmount local image 1 Running [sudo /bin/umount /mnt] umount: /mnt: not mounted. Failed: code [32]: umount: /mnt: not mounted. Running [sudo /sbin/losetup -d /dev/loop1] Preparing to local mount image 0 Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam0" | tail -1] Success: 1072693248 Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam0" | tail -1] Success: 2095104 Sector size: 512 Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam0" | tail -1] Success: 2048 Running [sudo /sbin/losetup -o 1048576 /dev/loop0 /home/pi/teslacam/images/cam0] Running [sudo /bin/mount -o gid=pi,uid=pi /dev/loop0 /mnt] No files found Preparing to unmount local image 0 Running [sudo /bin/umount /mnt] Running [sudo /sbin/losetup -d /dev/loop0] Preparing to local mount image 1 Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam1" | tail -1] Success: 1072693248 Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam1" | tail -1] Success: 2095104 Sector size: 512 Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam1" | tail -1] Success: 2048 Running [sudo /sbin/losetup -o 1048576 /dev/loop1 /home/pi/teslacam/images/cam1] Running [sudo /bin/mount -o gid=pi,uid=pi /dev/loop1 /mnt] No files found Preparing to unmount local image 1 Running [sudo /bin/umount /mnt] Running [sudo /sbin/losetup -d /dev/loop1] Preparing to mount image 0 Running [sudo /sbin/modprobe g_mass_storage file=/home/pi/teslacam/images/cam0 removable=1 ro=0 stall=0 iSerialNumber=11610] Waiting for video files

As the pi user here's the output for npm:

pi@raspberrypi:/teslacam $ pwd /home/pi/teslacam pi@raspberrypi:/teslacam $ npm run start

[email protected] start /home/pi/teslacam node src/services start

Running [sudo svc -u /home/pi/teslacam/./services/dashcam-monitor] svc: warning: unable to control /home/pi/teslacam/./services/dashcam-monitor: file does not exist Running [sudo svc -u /home/pi/teslacam/./services/dropbox-upload] svc: warning: unable to control /home/pi/teslacam/./services/dropbox-upload: file does not exist Running [sudo svc -u /home/pi/teslacam/./services/rotate-video] svc: warning: unable to control /home/pi/teslacam/./services/rotate-video: file does not exist (node:812) ExperimentalWarning: The fs.promises API is experimental

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/milesburton/teslacam/issues/17?email_source=notifications&email_token=AAJGHM2KEERZG7EDSG35TATQAC7NBA5CNFSM4IEWOCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2JQUVA#issuecomment-512952916, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJGHM6AAG4ENEWRJ3CTBATQAC7NBANCNFSM4IEWOCTQ .

milesburton avatar Jul 18 '19 19:07 milesburton

Not seeing anything to write to:

pi@raspberrypi:~/teslacam $ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 61133444 3730916 54887156 7% / devtmpfs 217224 0 217224 0% /dev tmpfs 221552 0 221552 0% /dev/shm tmpfs 221552 3124 218428 2% /run tmpfs 5120 4 5116 1% /run/lock tmpfs 221552 0 221552 0% /sys/fs/cgroup /dev/mmcblk0p1 258096 39969 218127 16% /boot tmpfs 44308 0 44308 0% /run/user/1000

natrlhy avatar Jul 18 '19 19:07 natrlhy

The script activates the Raspberry Pi W's OTG port (the second port towards the central of the pi). If you plug that port in to your main computer it should mount as a standard USB Flash Drive.

The idea being we are trying to emulate a thumb drive which the Tesla uses. This fake drive wont show up on the pi, it needs a host machine to be visible. Plug it in to your computer, it should mount after a starting up (ie running the command)

On Thu, Jul 18, 2019 at 8:31 PM natrlhy [email protected] wrote:

Not seeing anything to write to:

pi@raspberrypi:~/teslacam $ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 61133444 3730916 54887156 7% / devtmpfs 217224 0 217224 0% /dev tmpfs 221552 0 221552 0% /dev/shm tmpfs 221552 3124 218428 2% /run tmpfs 5120 4 5116 1% /run/lock tmpfs 221552 0 221552 0% /sys/fs/cgroup /dev/mmcblk0p1 258096 39969 218127 16% /boot tmpfs 44308 0 44308 0% /run/user/1000

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

milesburton avatar Jul 18 '19 19:07 milesburton

So I only have the USB cable connected to my PC now. I don't have external power running to the Pi at the moment. When I run the command connected like this I don't get a drive mounted on my PC. Should I be supplying external power in the outtermost USB port on the Pi then connecting it to a USB port on my PC with 2nd port towards the inside of the pi?

natrlhy avatar Jul 18 '19 20:07 natrlhy

You should be able to power the pi with only a single cable from your PC connected to the OTG port on the pi (the USB port towards the centre of the pi). When you run the node script I mentioned earlier, after a minute or so it should mount a drive on your computer

On Thu, Jul 18, 2019 at 9:20 PM natrlhy [email protected] wrote:

So I only have the USB cable connected to my PC now. I don't have external power running to the Pi at the moment. When I run the command connected like this I don't get a drive mounted on my PC. Should I be supplying external power in the outtermost USB port on the Pi then connecting it to a USB port on my PC with 2nd port towards the inside of the pi?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/milesburton/teslacam/issues/17?email_source=notifications&email_token=AAJGHM3KNU5VIPL7LZXMKW3QADF77A5CNFSM4IEWOCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2JVKAI#issuecomment-512972033, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJGHM6HE2473IP5XKHQYG3QADF77ANCNFSM4IEWOCTQ .

milesburton avatar Jul 18 '19 20:07 milesburton

:( Not doing it with either a single USB cable or externally powered. I'm going to try the stretch-lite flashing and see if that is a culprit. Not sure what I'm doing wrong here otherwise...

A quick breakdown of permission stuff though. I'm doing everything as root except when I clone the repo. I'm doing that as the pi user and I'm also running the node dashcam-monitor.js command as the pi user. I have the sudoers file in place as well....

natrlhy avatar Jul 18 '19 20:07 natrlhy

Strange.

My recommendation is focus on the dashcam script. Don't worry about the permissions if you are running as root.

Assuming the dashcam script doesn't fail (it'll throw up errors in the output) it should be working.

On Thu, Jul 18, 2019 at 9:25 PM natrlhy [email protected] wrote:

:( Not doing it with either a single USB cable or externally powered. I'm going to try the stretch-lite flashing and see if that is a culprit. Not sure what I'm doing wrong here otherwise...

A quick breakdown of permission stuff though. I'm doing everything as root except when I clone the repo. I'm doing that as the pi user and I'm also running the node dashcam-monitor.js command as the pi user. I have the sudoers file in place as well....

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/milesburton/teslacam/issues/17?email_source=notifications&email_token=AAJGHMYG7JHU2YSDQSRLLHLQADGT3A5CNFSM4IEWOCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2JVXIQ#issuecomment-512973730, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJGHM6PLTJQVJ2YTF2W5MLQADGT3ANCNFSM4IEWOCTQ .

milesburton avatar Jul 18 '19 20:07 milesburton

Latest output when starting it:

pi@raspberrypi:~/teslacam/src $ node dashcam-monitor.js Starting Tesla Sync script Unmounting image All Running [sudo /sbin/modprobe -r g_mass_storage] Preparing to unmount local image 0 Running [sudo /bin/umount /mnt] umount: /mnt: not mounted. Failed: code [32]: umount: /mnt: not mounted. Running [sudo /sbin/losetup -d /dev/loop0] losetup: /dev/loop0: detach failed: No such device or address Failed: code [1]: losetup: /dev/loop0: detach failed: No such device or address (node:479) ExperimentalWarning: The fs.promises API is experimental Preparing to local mount image 0 Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam0" | tail -1] Success: 1072693248 Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam0" | tail -1] Success: 2095104 Sector size: 512 Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam0" | tail -1] Success: 2048 Running [sudo /sbin/losetup -o 1048576 /dev/loop0 /home/pi/teslacam/images/cam0] Running [sudo /bin/mount -o gid=pi,uid=pi /dev/loop0 /mnt] No files found Preparing to unmount local image 0 Running [sudo /bin/umount /mnt] Running [sudo /sbin/losetup -d /dev/loop0] Preparing to local mount image 1 Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam1" | tail -1] Success: 1072693248 Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam1" | tail -1] Success: 2095104 Sector size: 512 Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam1" | tail -1] Success: 2048 Running [sudo /sbin/losetup -o 1048576 /dev/loop1 /home/pi/teslacam/images/cam1] Running [sudo /bin/mount -o gid=pi,uid=pi /dev/loop1 /mnt] No files found Preparing to unmount local image 1 Running [sudo /bin/umount /mnt] Running [sudo /sbin/losetup -d /dev/loop1] Preparing to mount image 0 Running [sudo /sbin/modprobe g_mass_storage file=/home/pi/teslacam/images/cam0 removable=1 ro=0 stall=0 iSerialNumber=56691] Waiting for video files

I wait there and don't see any drive getting mounted to my Windows 10 PC.

natrlhy avatar Jul 18 '19 20:07 natrlhy

Those errors are fine, it's basically trying to unmount (detach) the USB drive ... but nothing is mounted. If the error is a real issue the script should crash.

Try running this:

This unmounts the faux USB drive

sudo /sbin/modprobe -r g_mass_storage sudo /bin/umount /mnt sudo /sbin/losetup -d /dev/loop0

This should mount the usb drive and show up on your windows pc

sudo /sbin/modprobe g_mass_storage file=/home/pi/teslacam/images/cam0 removable=1 ro=0 stall=0 iSerialNumber=56691

On Thu, Jul 18, 2019 at 9:29 PM natrlhy [email protected] wrote:

Latest output when starting it:

pi@raspberrypi:~/teslacam/src $ node dashcam-monitor.js Starting Tesla Sync script Unmounting image All Running [sudo /sbin/modprobe -r g_mass_storage] Preparing to unmount local image 0 Running [sudo /bin/umount /mnt] umount: /mnt: not mounted. Failed: code [32]: umount: /mnt: not mounted. Running [sudo /sbin/losetup -d /dev/loop0] losetup: /dev/loop0: detach failed: No such device or address Failed: code [1]: losetup: /dev/loop0: detach failed: No such device or address (node:479) ExperimentalWarning: The fs.promises API is experimental Preparing to local mount image 0 Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam0" | tail -1] Success: 1072693248 Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam0" | tail -1] Success: 2095104 Sector size: 512 Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam0" | tail -1] Success: 2048 Running [sudo /sbin/losetup -o 1048576 /dev/loop0 /home/pi/teslacam/images/cam0] Running [sudo /bin/mount -o gid=pi,uid=pi /dev/loop0 /mnt] No files found Preparing to unmount local image 0 Running [sudo /bin/umount /mnt] Running [sudo /sbin/losetup -d /dev/loop0] Preparing to local mount image 1 Running [sfdisk -l -o Size -q --bytes "/home/pi/teslacam/images/cam1" | tail -1] Success: 1072693248 Running [sfdisk -l -o Sectors -q "/home/pi/teslacam/images/cam1" | tail -1] Success: 2095104 Sector size: 512 Running [sfdisk -l -o Start -q "/home/pi/teslacam/images/cam1" | tail -1] Success: 2048 Running [sudo /sbin/losetup -o 1048576 /dev/loop1 /home/pi/teslacam/images/cam1] Running [sudo /bin/mount -o gid=pi,uid=pi /dev/loop1 /mnt] No files found Preparing to unmount local image 1 Running [sudo /bin/umount /mnt] Running [sudo /sbin/losetup -d /dev/loop1] Preparing to mount image 0 Running [sudo /sbin/modprobe g_mass_storage file=/home/pi/teslacam/images/cam0 removable=1 ro=0 stall=0 iSerialNumber=56691] Waiting for video files

I wait there and don't see any drive getting mounted to my Windows 10 PC.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/milesburton/teslacam/issues/17?email_source=notifications&email_token=AAJGHM4ZSZMNVD6NLMO3DDTQADHA3A5CNFSM4IEWOCT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2JWABA#issuecomment-512974852, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJGHMZR2FGEEKUUMOKSQ4DQADHA3ANCNFSM4IEWOCTQ .

milesburton avatar Jul 18 '19 20:07 milesburton