Re: [PLUG] how to make folders/files read only

2023-10-27 Thread John Jason Jordan
On Fri, 27 Oct 2023 17:25:18 -0500
Bill Barry  dijo:

>On Fri, Oct 27, 2023 at 4:41 PM John Jason Jordan 
>wrote:
>
>> On Fri, 27 Oct 2023 15:26:10 -0500
>> Bill Barry  dijo:
>>  
>> >> Stay tuned for the rest of the saga. :)  
>>  
>> >You could just do a few mp3 files to begin with to find out if it
>> >works and then copy them all over after you have perfected a
>> >solution.  

>> I am also curious how Android knew to refuse to display the corrupted
>> ones. Maybe Android is smarter than I thought. :)

>Rsync can check to see if the files are corrupt and only copy over the
>ones that need copying over.

I have several backup scripts that use rsync, but otherwise I rarely
use it, so I'm far from an expert. Thanks for the tip that it can tell
if a file is corrupt. 

As a sort of conclusion for this mess, I have concluded that the new
256GB Samsung Evo card is defective. It's going back to the eBay seller
or to Samsung, as soon as I figure out which one to send it to. Part of
the reason for my decision is that my other 256GB card is working
perfectly in both the computer and the phone. My only complaint is that
it's exFAT, so I have to put up with Android writing unnecessary and
useless folders to it. But that's a complaint about Android, not the
fault of Samsung's quality control.


Re: [PLUG] how to make folders/files read only

2023-10-27 Thread Ben Koenig





-Ben


--- Original Message ---
On Friday, October 27th, 2023 at 3:33 PM, John Jason Jordan  
wrote:


> On Fri, 27 Oct 2023 15:26:10 -0500
> Bill Barry waba...@gmail.com dijo:
> 
> > You could just do a few mp3 files to begin with to find out if it
> > works and then copy them all over after you have perfected a solution.
> 
> 
> Since I no longer get a bounce from my own posts I can't quote myself.
> 
> Further information. After my previous post I went back to work. I had
> completed all the A and B files, so I resumed work starting with the C
> files. As I continued, every single C file played perfectly, no
> corrupted files at all. Then I randomly checked 20-30 more files in the
> rest of the alphabet, and all played perfectly.
> 
> New theory: The problem has something to do with how the card is
> mounted. In the laptop it has to be placed in an adapter, and from
> previous experience, SD card adapters can be problematic. But, also
> from previous experience, if the adapter has a problem then the entire
> drive fails to appear. Ditto for mounting; it either works 100% or it
> fails 100%. I've never had a drive mounted, but show only some of its
> contents.
> 
> I'm wondering if there is something sketchy about this brand new
> Samsung 256GB Evo card. I have another 256GB card, a Samsung Pro, so
> for my next exercise I'm going to leave the Evo card aside and redo
> everything on the Pro card. Stay tuned. :)
> 
> One unrelated bit of additional information. After pulling the Evo card
> from the phone and re-mounting it in the laptop, I find that Android
> added many new folders on the card, all with 0 contents:
> 
> Alarms
> Android
> Audiobooks
> DCIM
> Documents
> Download
> Movies
> Music
> Notifications
> Pictures
> Podcasts
> Recordings
> Ringtones
> .android_secure
> 
> Hey, Android! If I want a folder, I will create it!
> 
> At least now we have a clue why Android refused to mount cards
> formatted with any restrictions on being written to, including cards
> with any ext# filesystems. Dang, I need an open source phone!

Yeah the automatic folder creation is a pain. As a quick observation, I've 
noticed that android technically does have the ability to mount and interact 
with ext2/3/4 filesystems. My Nokia 6.1 handles a USB-C SSD without any issues, 
aside from the creation of folders I have no interest in.

However, since filesystems drivers are modules that ship with the kernel, you 
are at the mercy of the OEM. Even on so called "Android One" phones, there is 
an entire partition dedicated to vendor specific driver modules. In my case, 
Nokia ships the kernel and drivers (including ext*), then Google ships the OS 
(user-space tools to mount and interact with ext*).


Maybe the reason my nokia phone can talk to an ext4 USB drive is because they 
are using ext4 for the phones root filesystem.
-Ben


Re: [PLUG] how to make folders/files read only

2023-10-27 Thread John Jason Jordan
On Fri, 27 Oct 2023 15:26:10 -0500
Bill Barry  dijo:

>You could just do a few mp3 files to begin with to find out if it
>works and then copy them all over after you have perfected a solution.

Since I no longer get a bounce from my own posts I can't quote myself.

Further information. After my previous post I went back to work. I had
completed all the A and B files, so I resumed work starting with the C
files. As I continued, every single C file played perfectly, no
corrupted files at all. Then I randomly checked 20-30 more files in the
rest of the alphabet, and all played perfectly.

New theory: The problem has something to do with how the card is
mounted. In the laptop it has to be placed in an adapter, and from
previous experience, SD card adapters can be problematic. But, also
from previous experience, if the adapter has a problem then the entire
drive fails to appear. Ditto for mounting; it either works 100% or it
fails 100%. I've never had a drive mounted, but show only some of its
contents.

I'm wondering if there is something sketchy about this brand new
Samsung 256GB Evo card. I have another 256GB card, a Samsung Pro, so
for my next exercise I'm going to leave the Evo card aside and redo
everything on the Pro card. Stay tuned. :)

One unrelated bit of additional information. After pulling the Evo card
from the phone and re-mounting it in the laptop, I find that Android
added many new folders on the card, all with 0 contents:

Alarms
Android
Audiobooks
DCIM
Documents
Download
Movies
Music
Notifications
Pictures
Podcasts
Recordings
Ringtones
.android_secure

Hey, Android! If I want a folder, *I* will create it!

At least now we have a clue why Android refused to mount cards
formatted with any restrictions on being written to, including cards
with any ext# filesystems. Dang, I need an open source phone!


Re: [PLUG] how to make folders/files read only

2023-10-27 Thread Bill Barry
On Fri, Oct 27, 2023 at 4:41 PM John Jason Jordan  wrote:

> On Fri, 27 Oct 2023 15:26:10 -0500
> Bill Barry  dijo:
>
> >> Stay tuned for the rest of the saga. :)
>
> >You could just do a few mp3 files to begin with to find out if it
> >works and then copy them all over after you have perfected a solution.
>
> OK, you have a good point. The MP3s are in three folders, labeled Jazz,
> Symphonic, and Zarzuelas, the latter being Spanish sort-of operettas.
>
> After checking out all the Symphonic folder files starting with A and B
> (215 of the 1348 total), I pulled the card from the laptop and put it
> in the phone. Android saw all the files in the Jazz and Zarzuelas
> folders, but only 814 of the Symphonic files. It doesn't take a genius
> to figure out that the missing files are the ones that won't play,
> ones that I am going through to re-copy from the TB3 source.
>
> Your point made me perform a good exercise. I now know that the exFAT
> drive is acceptable to Android, and also that at least all the files on
> two of the folders are OK.
>
> I still have to go through the remaining 1,100+ files in the card's
> Symphonic folder, which will take a while. They look perfect in the
> file manager, exactly as they appear in the source folder. The only way
> I know to determine if they are somehow corrupted is to double-click on
> one, which opens it in Exaile. Exaile either starts playing it or pops
> up an error message. With the error messages I delete the file from the
> folder on the card, then drag and drop the same file from the
> source, and finally, double-click on the replacement. Out of the 50+
> that I have replaced so far, absolutely 100% of the replacements have
> played perfectly. Something happened to some of them as they were
> copied last night. The corrupted ones appear to be totally random; I
> can see no patterns to give me clues about the reason.
>
> It would be nice if I could automate my procedure somehow, but I don't
> know any way to do it. I'm using Exaile as my test instrument, but I've
> tried several other players, and all of them refuse to play any of the
> corrupted files, just as Android refused to recognize them.
>
> I am also curious how Android knew to refuse to display the corrupted
> ones. Maybe Android is smarter than I thought. :)
>

Rsync can check to see if the files are corrupt and only copy over the ones
that need copying over.

Bill


Re: [PLUG] how to make folders/files read only

2023-10-27 Thread John Jason Jordan
On Fri, 27 Oct 2023 15:26:10 -0500
Bill Barry  dijo:

>> Stay tuned for the rest of the saga. :)

>You could just do a few mp3 files to begin with to find out if it
>works and then copy them all over after you have perfected a solution.

OK, you have a good point. The MP3s are in three folders, labeled Jazz,
Symphonic, and Zarzuelas, the latter being Spanish sort-of operettas.

After checking out all the Symphonic folder files starting with A and B
(215 of the 1348 total), I pulled the card from the laptop and put it
in the phone. Android saw all the files in the Jazz and Zarzuelas
folders, but only 814 of the Symphonic files. It doesn't take a genius
to figure out that the missing files are the ones that won't play,
ones that I am going through to re-copy from the TB3 source.

Your point made me perform a good exercise. I now know that the exFAT
drive is acceptable to Android, and also that at least all the files on
two of the folders are OK.

I still have to go through the remaining 1,100+ files in the card's
Symphonic folder, which will take a while. They look perfect in the
file manager, exactly as they appear in the source folder. The only way
I know to determine if they are somehow corrupted is to double-click on
one, which opens it in Exaile. Exaile either starts playing it or pops
up an error message. With the error messages I delete the file from the
folder on the card, then drag and drop the same file from the
source, and finally, double-click on the replacement. Out of the 50+
that I have replaced so far, absolutely 100% of the replacements have
played perfectly. Something happened to some of them as they were
copied last night. The corrupted ones appear to be totally random; I
can see no patterns to give me clues about the reason.

It would be nice if I could automate my procedure somehow, but I don't
know any way to do it. I'm using Exaile as my test instrument, but I've
tried several other players, and all of them refuse to play any of the
corrupted files, just as Android refused to recognize them.

I am also curious how Android knew to refuse to display the corrupted
ones. Maybe Android is smarter than I thought. :)


Re: [PLUG] how to make folders/files read only

2023-10-27 Thread Bill Barry
On Fri, Oct 27, 2023 at 3:09 PM John Jason Jordan  wrote:

> On Fri, 27 Oct 2023 07:43:41 -0700
> Michael Ewan  dijo:
>
> >The best way to make something read only (even by root) is using the
> >chattr immutable (i) flag, i.e. sudo chattr +i file
>
> Copying ~2,000 MP3 files onto a 256GB SD card to be inserted into an
> Android phone has turned into a major project. Part of the problem is
> copying the files from an external Thunderbolt 3 drive to the SD card
> takes five or six hours, so each time usually ends up happening
> overnight.
>
> Another problem is inserting the card into the phone, because it
> usually fails to connect, so the phone doesn't even see it. If whoever
> did the engineering on that tiny tray and its connections were working
> for me, they would be looking for a new job.
>
> Regarding Android and the filesystems, forget ext4. All the literature
> swears that ext4 is supported, in fact, apparently Android uses ext4
> itself, but for external storage to be ext# the phone has to be rooted,
> and I mean 'rooted,' not just unlocked.
>
> Other choices are FAT32 or exFAT, but only models from the last few
> years can do exFAT. My phone can handle exFAT, but if there's any
> restriction on its ability to write to the medium I get 'unsupported
> drive.' I found that out after I formatted the card exFAT, but accepted
> the utility's offer to make the filesystem require my password. The
> utility was Gnome-Disks, sort of Gnome's answer to GParted.
>
> Last night I reformatted the card yet again, at least the sixth or
> seventh time, and this time did just plain exFAT. Then overnight I
> copied all the files to it (yet again), and this morning I discovered
> that about one in four won't play from the card. If I play the same
> file from the TB3 drive it works fine, and it also works fine if I
> delete the copy on the card and then copy it back from the TB3 drive.
> For the overnight copy I used drag and drop from a GUI file manager,
> which appeared to be working fine when I went to bed.
>
> Today's job is going to be figuring out which of the files won't play
> and re-copying them from the source. This will take several hours, but
> less time than wiping them all out and re-copying. I considered doing
> 'cp -R' from the command line instead of GUI drag and drop, but I
> suspect that I'd still end up with a quarter of them unplayable. I
> should add that 100% of the source files play perfectly, so the problem
> was caused by something in the copy process. For why I have no clues.
>
> In all of this I discovered that my phone has a feature to connect to a
> network file server via its wifi. All of the MP3s are on my Synology
> NAS and, amazingly, I got the phone to connect to it and I can see all
> the files. I considered the idea of just putting the card into the
> phone with nothing on it, then filling it up over wifi from the
> Synology, but doing that from a tiny screen on the phone is maddening.
> It might not be so bad if I could find a command line where I could do
> the Android version of 'cp -R,' but I don't know if that is even
> possible.
>
> Stay tuned for the rest of the saga. :)
>

You could just do a few mp3 files to begin with to find out if it works and
then copy them all over after you have perfected a solution.

Bill


Re: [PLUG] how to make folders/files read only

2023-10-27 Thread John Jason Jordan
On Fri, 27 Oct 2023 07:43:41 -0700
Michael Ewan  dijo:

>The best way to make something read only (even by root) is using the
>chattr immutable (i) flag, i.e. sudo chattr +i file

Copying ~2,000 MP3 files onto a 256GB SD card to be inserted into an
Android phone has turned into a major project. Part of the problem is
copying the files from an external Thunderbolt 3 drive to the SD card
takes five or six hours, so each time usually ends up happening
overnight.

Another problem is inserting the card into the phone, because it
usually fails to connect, so the phone doesn't even see it. If whoever
did the engineering on that tiny tray and its connections were working
for me, they would be looking for a new job.

Regarding Android and the filesystems, forget ext4. All the literature
swears that ext4 is supported, in fact, apparently Android uses ext4
itself, but for external storage to be ext# the phone has to be rooted,
and I mean 'rooted,' not just unlocked.

Other choices are FAT32 or exFAT, but only models from the last few
years can do exFAT. My phone can handle exFAT, but if there's any
restriction on its ability to write to the medium I get 'unsupported
drive.' I found that out after I formatted the card exFAT, but accepted
the utility's offer to make the filesystem require my password. The
utility was Gnome-Disks, sort of Gnome's answer to GParted.

Last night I reformatted the card yet again, at least the sixth or
seventh time, and this time did just plain exFAT. Then overnight I
copied all the files to it (yet again), and this morning I discovered
that about one in four won't play from the card. If I play the same
file from the TB3 drive it works fine, and it also works fine if I
delete the copy on the card and then copy it back from the TB3 drive.
For the overnight copy I used drag and drop from a GUI file manager,
which appeared to be working fine when I went to bed.

Today's job is going to be figuring out which of the files won't play
and re-copying them from the source. This will take several hours, but
less time than wiping them all out and re-copying. I considered doing
'cp -R' from the command line instead of GUI drag and drop, but I
suspect that I'd still end up with a quarter of them unplayable. I
should add that 100% of the source files play perfectly, so the problem
was caused by something in the copy process. For why I have no clues.

In all of this I discovered that my phone has a feature to connect to a
network file server via its wifi. All of the MP3s are on my Synology
NAS and, amazingly, I got the phone to connect to it and I can see all
the files. I considered the idea of just putting the card into the
phone with nothing on it, then filling it up over wifi from the
Synology, but doing that from a tiny screen on the phone is maddening.
It might not be so bad if I could find a command line where I could do
the Android version of 'cp -R,' but I don't know if that is even
possible.

Stay tuned for the rest of the saga. :)


Re: [PLUG] Simultaneously horrifying and amazing!

2023-10-27 Thread Ben Koenig


--- Original Message ---
On Friday, October 27th, 2023 at 10:20 AM, Bill Barry  
wrote:


> On Fri, Oct 27, 2023 at 12:15 PM Russell Senior russ...@personaltelco.net
> 
> wrote:
> 
> > It wasn't the RS-232 that surprised me, it was the combination of RS-232
> > and PCI-E, when I expected that modern RS-232 interfaces to just use a USB
> > converter. It is kind of like finding someone putting a Pratt and Whitney
> > turbo fan on a Sopwith Camel.
> > 
> > And here I was just about to reply and ask what would be the advantage of
> 
> a PCI-E card over the much cheaper USB converters :)
> 
> Bill

USB is designed as a user-friendly Plug 'n Play connection. There is a lot of 
variety in how it is implemented and it tends to do weird things when used for 
long term connectivity. 

I encountered this in the storage world. People who use USB for backup storage 
typically leave the external HDD connected indefinitely, which eventually 
causes problems. At some point the USB host controller will reset the port. 
There are also issues with power management where host controllers will put a 
port to "sleep" and issues with the amount of power delivered to the port not 
being consistent. 

PCIe on the other hand, is a much more robust interface. Once you plug it in 
and power it on, it stays that way until the rapture. Less variance in how 
vendors implement it. 

In Linux, the USB host controller drivers include a system of "quirks" which 
are enabled/disabled based on the make/model of the chip. For example, here's a 
bit of code from the latest stable kernel where they describe enabling one of 
these quirks for Intel hosts.


/* Existing Intel xHCI controllers require a delay of 1 mS,
* after setting the CMD_RESET bit, and before accessing any
* HC registers. This allows the HC to complete the
* reset operation and be ready for HC register access.
* Without this delay, the subsequent HC register access,
* may result in a system hang very rarely.
*/
if (xhci->quirks & XHCI_INTEL_HOST)
udelay(1000);


Note how this specifically calls out Intel. As if other vendors don't implement 
this same 1ms delay? 
-Ben


Re: [PLUG] Simultaneously horrifying and amazing!

2023-10-27 Thread Paul Heinlein

On Fri, 27 Oct 2023, Russell Senior wrote:


It wasn't the RS-232 that surprised me, it was the combination of RS-232
and PCI-E, when I expected that modern RS-232 interfaces to just use a USB
converter. It is kind of like finding someone putting a Pratt and Whitney
turbo fan on a Sopwith Camel.


I'd say it's the opposite, more like putting Model T engine in a 
Formula One chassis. :-)


Of course, most IPMI controllers emulate serial communications over 
ethernet (serial-over-LAN), because out-of-band serial connections are 
ever-so helpful, even (especially?) today.


--
Paul Heinlein
heinl...@madboa.com
45°22'48" N, 122°35'36" W


Re: [PLUG] Simultaneously horrifying and amazing!

2023-10-27 Thread Bill Barry
On Fri, Oct 27, 2023 at 12:15 PM Russell Senior 
wrote:

> It wasn't the RS-232 that surprised me, it was the combination of RS-232
> and PCI-E, when I expected that modern RS-232 interfaces to just use a USB
> converter. It is kind of like finding someone putting a Pratt and Whitney
> turbo fan on a Sopwith Camel.
>
> And here I was just about to reply and ask what would be the advantage of
a PCI-E card over the much cheaper USB converters :)

Bill


Re: [PLUG] Simultaneously horrifying and amazing!

2023-10-27 Thread Russell Senior
It wasn't the RS-232 that surprised me, it was the combination of RS-232
and PCI-E, when I expected that modern RS-232 interfaces to just use a USB
converter. It is kind of like finding someone putting a Pratt and Whitney
turbo fan on a Sopwith Camel.

On Fri, Oct 27, 2023 at 8:16 AM Chuck Hast  wrote:

> In the medical and industrial fields RS-232 and RS-485 are
> still alive and kicking.
>
> I have numerous machines that I service which still have
> RS-232 ports on them. I see RS-232 and RS-485 on
> industrial equipment. They were good solid standards and
> I guess if it ain't broke don't break it.
>
> On Fri, Oct 27, 2023 at 1:26 AM Derek Loree  wrote:
>
> > On Thu, 2023-10-26 at 22:30 -0700, Russell Senior wrote:
> > > I love RS232 and UARTs generally, I use them all the time and for me
> > > they
> > > will never go out of style, but I was wondering today about a
> > > specific
> > > marriage of the ancient and the modern, and it was hard to believe,
> > > what
> > > with USB being a pretty pervasive thing, they might exist, AND YET:
> > >
> > >https://www.startech.com/en-us/cards-adapters/pex1s953lp
> > >
> > > THEY DO.
> >
> > I've been using the two port version of this card for years.  Very
> > robust cards, never had one fail.  I use them to control the drive
> > motors in a medical device that helps doctors treat vertigo.  USB
> > devices literally burn up when we tried them in this application.
> >
> > >
> > > Meanwhile, parallel SCSI (which I've been using all week) has pretty
> > > much
> > > vanished from the modern world.
> > >
> >
> > Same with Firewire, cables and all, gone, not to be found anywhere.
> >
> > Derek Loree
> >
>


Re: [PLUG] Simultaneously horrifying and amazing!

2023-10-27 Thread Chuck Hast
In the medical and industrial fields RS-232 and RS-485 are
still alive and kicking.

I have numerous machines that I service which still have
RS-232 ports on them. I see RS-232 and RS-485 on
industrial equipment. They were good solid standards and
I guess if it ain't broke don't break it.

On Fri, Oct 27, 2023 at 1:26 AM Derek Loree  wrote:

> On Thu, 2023-10-26 at 22:30 -0700, Russell Senior wrote:
> > I love RS232 and UARTs generally, I use them all the time and for me
> > they
> > will never go out of style, but I was wondering today about a
> > specific
> > marriage of the ancient and the modern, and it was hard to believe,
> > what
> > with USB being a pretty pervasive thing, they might exist, AND YET:
> >
> >https://www.startech.com/en-us/cards-adapters/pex1s953lp
> >
> > THEY DO.
>
> I've been using the two port version of this card for years.  Very
> robust cards, never had one fail.  I use them to control the drive
> motors in a medical device that helps doctors treat vertigo.  USB
> devices literally burn up when we tried them in this application.
>
> >
> > Meanwhile, parallel SCSI (which I've been using all week) has pretty
> > much
> > vanished from the modern world.
> >
>
> Same with Firewire, cables and all, gone, not to be found anywhere.
>
> Derek Loree
>


Re: [PLUG] how to make folders/files read only

2023-10-27 Thread Michael Ewan
The best way to make something read only (even by root) is using the chattr
immutable (i) flag, i.e.
sudo chattr +i file
This will prevent casual changes by every user including root.  Change it
back with the -i flag.
Any attempt to change the file or directory will get an operation not
permitted error.
Use lsattr to find the extended attributes of a file or directory.  See the
man page for all the other attributes.

On Fri, Oct 27, 2023 at 6:12 AM Rich Shepard 
wrote:

> On Thu, 26 Oct 2023, Bill Barry wrote:
>
> > You want them read only, 600 is read/write.  Read by world would be good
> > might work better
>
> Bill,
>
> I considered that but limiting both reading and writing to 'user' doesn't
> hurt.
>
> > chmod -R 004   *
>
> Shouldn't that be 400 (user, group, other)?
>
> Rich
>


Re: [PLUG] how to make folders/files read only

2023-10-27 Thread Rich Shepard

On Thu, 26 Oct 2023, Bill Barry wrote:


You want them read only, 600 is read/write.  Read by world would be good
might work better


Bill,

I considered that but limiting both reading and writing to 'user' doesn't
hurt.


chmod -R 004   *


Shouldn't that be 400 (user, group, other)?

Rich


Re: [PLUG] how to make folders/files read only

2023-10-27 Thread Vince Winter
I am not sure if Android supports the immutable sticky but on files?

On Thu, Oct 26, 2023, 8:09 PM John Jason Jordan  wrote:

> On Thu, 26 Oct 2023 19:24:31 -0500
> Bill Barry  dijo:
>
> >On Thu, Oct 26, 2023 at 7:21 PM Bill Barry  wrote:
> >
> >>
> >> You want them read only, 600 is read/write.  Read by world would be
> >> good might work better
> >> chmod -R 004   *
> >Or better chmod -R 0444 *
>
> I tried man chmod, but it had zero about the numbers, although it had a
> link to a web page that was supposed to give examples of usage, but it
> turned out to be just a site proclaiming the virtues of gnu. I did
> learn that the numbers are called 'octal numbers' and stand for who can
> read, write an execute the file. There is evidently a system for how to
> assemble the octal number, but it remains a mystery to me.
>
> After applying 600 to all the files in a folder I did 'ls -la' and
> every file had -rw---. I take it that means that I can read or
> write the file, but everyone else gets a dash, so they have to suck
> eggs.
>
> However I gave the command with sudo, so I don't know if the 'rw'
> applies to me or to some computer god. They're all .mp3 files, and if I
> double-click on one in the file manager it plays, so no worries.
>
> After applying the 600 I got a popup on my screen 'Writing data to the
> drive -- do not unplug.' Right now the popup has remained there for a
> couple hours, so my guess is that it's a lie. I'm just going to umount
> it and put it in the phone.
>
> Edit: I'm afraid I lost this play. I had to reinsert the SD card six
> times before it finally connected, and when the phone came up it said:
>
> Unsupported SD card
> This device doesn't support this SD
>
> There was no problem before when it was exFAT. Of course, exFAT can't
> do permissions, so Android is free to delete anything on the card.
> FAT32 won't help either, but I wonder if Android can read NTFS.
>