On 30/08/15 07:18, ToddAndMargo wrote: > On 08/29/2015 09:45 PM, Brandon Vincent wrote: >> On Sat, Aug 29, 2015 at 8:14 PM, ToddAndMargo <[email protected]> wrote: >>> I was looking for an easier way to tell if my write protect switches >>> were in the read only position. There are other ways, like trying to >>> mount it and see what happens, but I would like to get the information >>> more directly. >> >> Try querying the block device with udevadm(8). >> >> udevadm info -a -n /dev/sdc >> >> Brandon Vincent >> > > Rats! > > looking at device > '/devices/pci0000:00/0000:00:1d.7/usb2/2-4/2-4.2/2-4.2:1.0/host7/target7:0:0/7:0:0:0/block/sdc': > > KERNEL=="sdc" > SUBSYSTEM=="block" > DRIVER=="" > ATTR{ro}=="1" > ATTR{size}=="61767680" > ATTR{stat}==" 360 3 2904 376 0 0 > 0 0 0 376 376" > ATTR{range}=="16" > ATTR{discard_alignment}=="0" > ATTR{events}=="media_change" > ATTR{ext_range}=="256" > ATTR{events_poll_msecs}=="-1" > ATTR{alignment_offset}=="0" > ATTR{inflight}==" 0 0" > ATTR{removable}=="1" > ATTR{capability}=="51" > ATTR{events_async}==""
Also double check if "echo /sys/block/sdc/ro" gives you what you want. I believe that should be '1' on read only and '0' on read/write. -- kind regards, David Sommerseth
