Go to advanced search

by davethomaspilot
Wed Apr 18, 2018 8:06 pm
Forum: General discussion
Topic: Pi Zero W at higher price?
Replies: 5
Views: 696

Pi Zero W at higher price?

I'm using multiple pi zero w's in my irrigation system. I'd be happy to pay more, even more than a pi B+ for a pi zero w.

But, I can no longer buy the zeros, at any price.

Is this a "Forever" thing, or just until there is a better supply of zeros?

Anyone want to trade RPI B+
by davethomaspilot
Tue Apr 10, 2018 12:06 pm
Forum: Advanced users
Topic: Can't write to a file from udev Run+=
Replies: 17
Views: 2659

Re: Can't write to a file from udev Run+=

I found a script that uses inotify to turn off wifi when a bluetooth device connects (and vice-versa). I can hack it to execute the commands I want at bluetooth disconnect time. case $1 in start) while true do RES=`inotifywait -q -e CREATE,DELETE /dev/input/` case "$RES" in "/dev/input/ DELETE event...
by davethomaspilot
Sat Apr 07, 2018 8:59 pm
Forum: Advanced users
Topic: Can't write to a file from udev Run+=
Replies: 17
Views: 2659

Re: Can't write to a file from udev Run+=

I see this record when I do dmesg:

[ 1.448736] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.


Is this normal?
by davethomaspilot
Sat Apr 07, 2018 8:51 pm
Forum: Advanced users
Topic: Can't write to a file from udev Run+=
Replies: 17
Views: 2659

Re: Can't write to a file from udev Run+=

Duplicated same issue on a fresh install of 3/13/2018 stretch-lite. Only things done to the "stock" image: headless config--added wpa_supplicant.conf and ssh file to /boot raspi-config stuff added /home/pi/.ssh directory (for ssh keys) Created a bt_connected script in /home/pi: #!/bin/bash logger "B...
by davethomaspilot
Sat Apr 07, 2018 8:00 pm
Forum: Advanced users
Topic: Can't write to a file from udev Run+=
Replies: 17
Views: 2659

Re: Can't write to a file from udev Run+=

Another user which seems like the same issue on rpi, stretch: https://unix.stackexchange.com/questions/401394/udev-rule-triggers-but-any-run-command-fails/401445?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa I'll try duplicating the issue on a clean stretch lite image, as ...
by davethomaspilot
Sat Apr 07, 2018 11:46 am
Forum: Advanced users
Topic: Can't write to a file from udev Run+=
Replies: 17
Views: 2659

Re: Can't write to a file from udev Run+=

Don't I know it. (Developed software for a living for decades)
by davethomaspilot
Sat Apr 07, 2018 11:11 am
Forum: Advanced users
Topic: Can't write to a file from udev Run+=
Replies: 17
Views: 2659

Re: Can't write to a file from udev Run+=

First thing I'd do is get a second SDCard so you can build a "throw-away" system that can be mucked about with and when you break it you can start again from a fresh Raspbian download. That removes the risk of leaving your normal system unbootable. Set that up with exactly the same stuff you've got...
by davethomaspilot
Sat Apr 07, 2018 11:06 am
Forum: Advanced users
Topic: Can't write to a file from udev Run+=
Replies: 17
Views: 2659

Re: Can't write to a file from udev Run+=

Reading your posts again, perhaps you were assuming the script triggered by udev was trying to write to a newly attached device. Just to clarify, all the script does is append a record to a file in /tmp. Another service will (not running yet) will read that file and decide whether to attempt to reco...
by davethomaspilot
Sat Apr 07, 2018 11:00 am
Forum: Advanced users
Topic: Can't write to a file from udev Run+=
Replies: 17
Views: 2659

Re: Can't write to a file from udev Run+=

You need to look deeper at why a udev restart is needed. So, that implies to me that the filesystem should NOT be readonly (for udev) after boot? So, normally the file system should be read/write after boot? And that there must be a bug somewhere if it is? Any suggestion on how to do that (look dee...
by davethomaspilot
Fri Apr 06, 2018 11:01 pm
Forum: Advanced users
Topic: Can't write to a file from udev Run+=
Replies: 17
Views: 2659

Re: Can't write to a file from udev Run+=

Rereading your post--maybe you meant the restart of udev would be better done in a system service, rather than in /etc/rc.local? I would agree with that! I think it's always better to use a service rather than launching scripts in /etc/rc.local, .bashrc, etc. I was just making the point that given t...
by davethomaspilot
Fri Apr 06, 2018 10:26 pm
Forum: Advanced users
Topic: Can't write to a file from udev Run+=
Replies: 17
Views: 2659

Re: Can't write to a file from udev Run+=

Thanks for the reply, but-- The filesystem is forever read-only (as seen by udev), not just at boot time. Any time the rule triggers, even hours after reboot. Restarting udev once in /etc/rc.local fixes the issue. Sure, I could poll from a systemd service to look for the bluetooth disconnect/connect...
by davethomaspilot
Fri Apr 06, 2018 2:37 pm
Forum: Advanced users
Topic: Can't write to a file from udev Run+=
Replies: 17
Views: 2659

Re: Can't write to a file from udev Run+=

Found a workaround: sudo /etc/init.d/udev restart Apparently, the filesystem as seen by udev is read-only until that command is executed. Doesn't make much sense to me, but it works! Got the idea from this post: https://askubuntu.com/questions/883843/udev-rules-scripts-has-only-read-only-access-to-u...
by davethomaspilot
Fri Apr 06, 2018 11:37 am
Forum: Advanced users
Topic: Can't write to a file from udev Run+=
Replies: 17
Views: 2659

Can't write to a file from udev Run+=

rpi zero w, stretch-lite I have a udev rule that matches when a bluetooth device disconnects: ACTION=="remove", KERNEL=="input[0-9]*", RUN+="/home/pi/bt_disconnected" The script bt_disconnected runs when the device is disconnected, but fails if it tries to write to a file. Here's the script: #!/bin/...
by davethomaspilot
Wed Apr 04, 2018 9:49 pm
Forum: Troubleshooting
Topic: Bluetooth does not automatically connect trusted device
Replies: 8
Views: 7547

Re: Bluetooth does not automatically connect trusted device

Is there a bluetoothctl command that will cause that file to be deleted? I had previously tried the "remove" command in bluetoothctl and got a message about the device being unavailable. Turns out I hadn't run bluetoothctl under sudo. When I do that, the directory in /var/lib/bluetooth/$CONTROLLER_...
by davethomaspilot
Wed Apr 04, 2018 9:36 pm
Forum: Troubleshooting
Topic: Bluetooth does not automatically connect trusted device
Replies: 8
Views: 7547

Re: Bluetooth does not automatically connect trusted device

Ok, I see. Thanks for the reply. In my case, the Bluetooth device doesn't try to connect at all. Not sure why--it's an Ipad. So, I think the best I can do is to require the user to to manually connect on the Ipad once. That connection will trigger a udev rule that will cause a slightly modified vers...
by davethomaspilot
Wed Apr 04, 2018 2:20 pm
Forum: Troubleshooting
Topic: Bluetooth does not automatically connect trusted device
Replies: 8
Views: 7547

Re: Bluetooth does not automatically connect trusted device

ManOki, Could you elaborate on using a udev rule instead of a cronjob? This is what confuses me: Another trick to prevent permanent cronjob is using a udev rule, which runs the script (ideally as systemd service), if a bluetooth connection occurs. So, you Bluetooth connect to start the autoconnect o...
by davethomaspilot
Sun Sep 17, 2017 11:49 am
Forum: Advanced users
Topic: rpi-clone, but from usb to SD
Replies: 18
Views: 2557

Re: rpi-clone, but from usb to SD

The rpi-clone author, Bill Winston has updated it to support cloning to mmcblk0.

It works great and makes it easy to create a usb bootable clone. When you boot from that clone, you can clone back to the sd.
by davethomaspilot
Sat Sep 16, 2017 2:13 pm
Forum: Advanced users
Topic: rpi-clone, but from usb to SD
Replies: 18
Views: 2557

Re: rpi-clone, but from usb to SD

I got it working again, invocation is like: sudo hacked_rpi-clone -src=sda -dst=mmc I haven't tested it for anything other than what I need (usb to mmc). The original script used SRC_BOOT_PARTITION=`fgrep " /boot " /etc/mtab | cut -f 1 -d ' ' ` SRC_DISK=${SRC_BOOT_PARTITION:5:3} But, that didn't wor...
by davethomaspilot
Thu Sep 14, 2017 5:58 pm
Forum: Advanced users
Topic: rpi-clone, but from usb to SD
Replies: 18
Views: 2557

Re: rpi-clone, but from usb to SD

Yes, I'll share it after it's complete. I need to add some code to parse the $SRC_DISK from the invocation. Right now, it's just hard-coded to be sda. I'm also adding some code that would do the sed to mmcblk0p2 /boot/cmdline.txt for sda2 and install a run-once service to do the clone from usb to th...
by davethomaspilot
Wed Sep 13, 2017 10:37 pm
Forum: Advanced users
Topic: rpi-clone, but from usb to SD
Replies: 18
Views: 2557

Re: rpi-clone, but from usb to SD

I just added a $SRC_DISK and used that instead of the hard-coded mmcblk0. The only "trick" was to make a SUFFIX either "p" or "" depending on whether the referenced partition was on mmcblk0 or sdN mmcblk0p2 versus sda2 Not a lot of testing yet, but seems to be working ok. Thanks for the replies!
by davethomaspilot
Wed Sep 13, 2017 10:59 am
Forum: Advanced users
Topic: rpi-clone, but from usb to SD
Replies: 18
Views: 2557

Re: rpi-clone, but from usb to SD

The default is boot from SDCard if it's there, else boot from USB. So you can override USB by inserting SDCard, not the other way round Thanks for confirming that. So, I guess the script will be manually started on usb stick. That script will edit /boot/cmdline.txt (it's on the sd file system at th...
by davethomaspilot
Tue Sep 12, 2017 11:15 pm
Forum: Advanced users
Topic: rpi-clone, but from usb to SD
Replies: 18
Views: 2557

Re: rpi-clone, but from usb to SD

No, it doesn't seem to work that way. I can boot from either the usb stick or the sd card, if I edit root=xxx in /boot/cmdline.txt on the sd card. But, simply having root=sda2 in cmdline.txt on the usb stick file system doesn't seem to affect anything. It just boots from the sd card. In other words,...
by davethomaspilot
Tue Sep 12, 2017 11:05 pm
Forum: Advanced users
Topic: rpi-clone, but from usb to SD
Replies: 18
Views: 2557

Re: rpi-clone, but from usb to SD

Hmm, didn't seem to work that way for me. I thought it only booted from the usb stick when I edited cmdline.txt to change root=mmcblk0p2 to sda2. But, it gets confusing--if the usb stick had /boot/cmdline.txt with root pointing to mmcblk0p2, I guess it would end up booting from the rpi sd card. Mayb...

Go to advanced search