Where is sdparm?

Tutorials like https://openwrt.org/docs/guide-user/network/wan/wwan/3gdongle?s[]=sdparm, many threads talk about sdparm, it is listed in this old packages collection, but apparently it is vanished and can't be installed in any way.

opkg install sdparm is an illusion.

Where is it? Is there something that superseceded it?

Probably kmod-scsi-*
https://openwrt.org/packages/table/start?dataflt[Name_pkg-dependencies*~]=scsi

1 Like

Just tried all of those, no signs of sdparm or eject.

What function do you want?

Those references are all rather old (and not very numerous), from my quick scan.

I was interested in eject, as that is what I need for the tutorial up there, apparently.

If your device doesn't work with usb_modeswitch, try the sdparm method.

[...]

This method uses sdparm to issue SCSI eject command to the emulated CDROM device. This is enough to put some modems into modem mode (tested on Ovation MC935D).

Did you already find that USB modeswitch wasn't able to get your device switched into the proper mode? At least as I read that page, sdparam is only needed if the "normal" way of managing a USB WWAN device fails.

1 Like

I don't have a usb_modeswitch command. Apparently that was removed also. I have usbmode which apparently is a more automated thing and that doesn't detect my device. So I'm trying to move to the next step, sdparm.

1 Like

Final summary with probably a lot of wrong information I was able to compile in my head, written here for the future troubled users

The eject/sdparm technique I saw in tutorials was used mainly to somehow trigger mode-changing in USB devices. I don't understand this, but apparently there are a bunch of USB devices that are detected in one way and then if you eject them or send some other command it will have its mode changed (each one has its own specific set of commands that will trigger that mode change, see /etc/usb-mode.json for a list of devices and their spec, that list is built from the collection of devices at http://www.draisberghof.de/usb_modeswitch/ and apparently not used only in OpenWrt, but in other linuxes also).

Maybe it is because of that that sdparm and eject were removed (although this last one seems to have a comeback planned). If your device is listed in /etc/usb-mode.json and you have usbmode/usb_modeswitch installed it will be automatically ejected (or triggered with its specific command) and you'll never have to manually call eject -- or you can manually call usbmode -s and if it's there on the list it will be triggered.

The list identifies devices using pairs or idVendor:idProduct, which are supposed to be the same for devices of the same model. You can list all devices along with their ids by calling cat /sys/kernel/debug/usb/devices.

My problem

My device wasn't on the list. Apparently all devices in the world are on the list, so no one knows what to do when they aren't, except for bmork, who helped me in this thread: 3g/4g USB dongle not showing up

For reference: it's common for 3G dongles (and some smartphones) to show up as a virtual CD drive offering drivers and utilities to use them on Windows/Mac, then after you have dismissed this somehow then it will switch to the "useful" mode.

2 Likes

I have not tried this with a WWAN modem!

From https://unix.stackexchange.com/questions/35508/eject-usb-drives-eject-command/129282

Manual steps for unmounting disk /dev/sdb (Requires sudo):

echo 'offline' > /sys/block/sdb/device/state
echo '1' > /sys/block/sdb/device/delete

With a USB stick that happened to have been attached to one of my OpenWrt devices:

root@OpenWrt:~# cat /sys/block/sda/device/state 
running

root@OpenWrt:~# echo offline > /sys/block/sda/device/state 
root@OpenWrt:~# cat /sys/block/sda/device/state 
offline

root@OpenWrt:~# echo 1 > /sys/block/sda/device/delete 

root@OpenWrt:~# ls /sys/block/sda
ls: /sys/block/sda: No such file or directory
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.