Как отключить устройство linux

How do I turn off PCI devices?

..without turning them off in my BIOS like they are now, if possible, because then I have to restart my computer to use any of them. As it stands, I still haven’t managed to power down:

Firewire USB connection to webcam sound card

How do I tell Linux to disable and power down these devices? Is it true that any PCI slot can be physically powered down?

My current idle power consumption is 7.9 watts plus the screen. (10.0W at min. brightness)

Also, how do I set the screen timeout to ten seconds? gconf editor isn’t honoring it when I set it to that. Will switching from nVidia to Nouveau save any significant amount of power?

2 Answers 2

Try echo 0 > /sys/bus/pci/slot/$N/power for appropriate slot.

lspci -vv may help to identify the device. This is not very well documented.

There’s /sys/bus/pci/slots available on Linux 4.0.x, so it might be a type or has changed. However, there doesn’t seem to be a power file by default.

@hanshenrik this REMOVES the device from view in the OS, but does not change the P state on the actual device. Your device might still be on and consuming power, sometimes even more than when loading its driver.

Linux kernel documentation states explicitly that the sysfs pci ‘remove’ file «does not involve any kind of hot-plug functionality, e.g. powering off the device» kernel.org/doc/Documentation/filesystems/sysfs-pci.txt

I could be wrong (if you think I am, just leave a comment) but I always thought that things that were plugged in (or soldered on, as is the case in most laptops) are always «on» and available unless disabled in the BIOS.

However most of these devices will only be using significant power when they’re actively being used. The only real exception to this is wireless but you have a hardware switch for this. USB ports also power their plugees so you need to unplug USB things but that doesn’t sound like an unreasonable request.

You can, of course, unload certain kernel modules which stops software having access to hardware but I doubt this would turn them off.

You use the word ‘significant’ and ‘reasonable’ but in my case, 1.3 watts mean one whole hour of battery life. And I need that hour, so I need those 1.3 watts.

If I can confirm that it is not physically possible I will stop pursuing it. but I’d prefer not to give up prematurely. Does the bios have access to hardware features that the operating system does not?

If hardware can be turned of (not just disabled) by BIOS it means that any software can do the same — however this might mean low-level memory manipulation if it is not supported via the standard ACPI interface for doing those things — there is multiple kernel modules available for such things for HP and Asus machines — however they are not always bug free to say the least.

Читайте также:  Linux wifi support list

Источник

Отключить устройство в linux? Какие есть способы?

Читал про modprobe и blacklist, проблему этим не получилось решить, и вот почему. Начну по порядку.
Имею беспроводную (паленую) мышь с радио модулем. У мыши есть три кнопки, вместе с мидл-клик, но при этом, радиомодуль несет в себе контроллер клавиатуры, который мне крайне нежелателен. Его я и хотел бы дезактивировать. Все это вглядит вот так:

Oct 9 02:38:14 asus kernel: [ 7456.489811] usb 6-4: new full-speed USB device number 3 using ohci-pci
Oct 9 02:38:14 asus kernel: [ 7456.676848] usb 6-4: New USB device found, idVendor=25a7, idProduct=fa23
Oct 9 02:38:14 asus kernel: [ 7456.676851] usb 6-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Oct 9 02:38:14 asus kernel: [ 7456.676852] usb 6-4: Product: 2.4G Receiver
Oct 9 02:38:14 asus kernel: [ 7456.676853] usb 6-4: Manufacturer: Compx
Oct 9 02:38:14 asus kernel: [ 7456.683165] input: Compx 2.4G Receiver as /devices/pci0000:00/0000:00:12.0/usb6/6-4/6-4:1.0/0003:25A7:FA23.0003/input/input13
Oct 9 02:38:14 asus kernel: [ 7456.742022] hid-generic 0003:25A7:FA23.0003: input,hidraw0: USB HID v1.10 Keyboard [Compx 2.4G Receiver] on usb-0000:00:12.0-4/input0
Oct 9 02:38:14 asus kernel: [ 7456.747470] input: Compx 2.4G Receiver as /devices/pci0000:00/0000:00:12.0/usb6/6-4/6-4:1.1/0003:25A7:FA23.0004/input/input14
Oct 9 02:38:14 asus kernel: [ 7456.806007] hid-generic 0003:25A7:FA23.0004: input,hiddev0,hidraw1: USB HID v1.10 Mouse [Compx 2.4G Receiver] on usb-0000:00:12.0-4/input1
Oct 9 02:38:14 asus mtp-probe: checking bus 6, device 3: «/sys/devices/pci0000:00/0000:00:12.0/usb6/6-4»
Oct 9 02:38:14 asus mtp-probe: bus: 6, device: 3 was not an MTP device

Из этого видно, что оба устройства работают на одном драйвере — hid-generic. Отключить его или добавить в блэклист modprobe — убивает и мышь и кнопочную доску. Можно что-то придумать? Заткнуть другим драйвером или что то вроде? Заранее извините я дилетант.

P.S. Но вот мой сосед — настоящий технофашист. Распологает всем необходимым, от радио-электронного оборудования до софта на любую фантазию.
Будем условно считать, что интерес здесь чисто спортивный. Буду рад любым советам 🙂

Средний 1 комментарий

Источник

Power on/off USB ports

Is it possible to on/off a specific USB port using the terminal in Ubuntu? lsusb displays the following result:

Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 003: ID 2232:1020 Bus 002 Device 009: ID 0bc2:a013 Seagate RSS LLC Bus 002 Device 003: ID 0a5c:219c Broadcom Corp. 

Seagate is my external hard disk drive. Can I power it off in the terminal? I tried Controlling a USB power supply (on/off) with Linux. But I am confused about what should be replaced in place of usbX .

4 Answers 4

All of the previous answers talk about a USB suspend mechanism, i.e. a «logical power-off», they will never physically cut the VBUS +5V from the USB port.

Читайте также:  Astra linux удалить приложение

Only a few hubs can actually cut VBUS as described here.

The hubpower tool can do it (if the hub supports it).

After running into the same problem, I found that the commands should be entered differently so that «sudo» would apply rights appropriately.

echo 0 | sudo tee /sys/bus/usb/devices/usb2/power/autosuspend_delay_ms 

will apply root rights to the «tee» command which will write the 0 into the specified file, replacing anything that is currently there. To append, use the tee command with option -a.

for info see the man page of tee

The tee command will have the side effect of also printing to the screen. If you want, dd of=/sys/bus/. will write only to the file, and nowhere else.

Actually usbX is nothing but the USB ports numbers where X denotes the number like 1 or 2 and so on. For example, usb1 and usb2 for ports 1 and 2. In general, a laptop may have three or four USB ports with USB 2.0 and USB 3.0 ports.

In Ubuntu, usb1 , usb2 . usbX are the links to /sys/devices/pci000:00/* . To understand it well, run this command:

So to enable/disable USB ports usbX will be replaced with usb1 when you want to enable/disable USB Port Number 1 (or refer Stack Exchange):

Edit: Thanks to Stefan Denchev to tell the correct way to echo some text to a file using sudo. (Check his comment also.) You should not get the permission denied message now.

sudo sh -c "echo '0' > /sys/bus/usb/devices/usb1/power/autosuspend_delay_ms" sudo sh -c "echo 'auto' > /sys/bus/usb/devices/usb1/power/control" 

After seeing your lsusb result, it looks like your Seagate device is connected to Port No. 2 , so you need to disable usb2 . Then the commands would be:

sudo sh -c "echo '0' > /sys/bus/usb/devices/usb2/power/autosuspend_delay_ms" sudo sh -c "echo 'auto' > /sys/bus/usb/devices/usb2/power/control" 

Thanks. If I try echo «0» > «/sys/bus/usb/devices/usb2/power/autosuspend_delay_ms» the output is bash: /sys/bus/usb/devices/usb2/power/autosuspend_delay_ms: Permission denied

Actually I didn’t try to enable/disable any ports in Linux.. My motto was to make you clear about usbX problem. If you are much clear about the commands that you grabbed from StackOverflow then only you should give it a try. Any way now I am also interested to know which is actual command to enable/disable ports. I’ll reply you soon, when it works for me. Tell then you unplug your device and try again. or try the first answer given at stackoverflow .

udisksctl has power-off flag, which I suggest you use in conjunction with unmount

power-off Arranges for the drive to be safely removed and powered off. On the OS side this includes ensuring that no process is using the drive, then requesting that in-flight buffers and caches are committed to stable storage. The exact steps for powering off the drive depends on the drive itself and the interconnect used. For drives connected through USB, the effect is that the USB device will be deconfigured followed by disabling the upstream hub port it is connected to 

Here’s me unmounting my USB jumpdrive and then powering it off

testdir:$ lsusb Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 009: ID 154b:007a PNY Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub testdir:$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 111.8G 0 disk └─sda1 8:1 0 111.8G 0 part / sdb 8:16 1 30G 0 disk └─sdb1 8:17 1 30G 0 part /media/xieerqi/6A32C4555E1C5B4D sr0 11:0 1 1024M 0 rom testdir:$ udisksctl unmount -b /dev/sdb1 && udisksctl power-off -b /dev/sdb1 Unmounted /dev/sdb1. testdir:$ lsusb Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub testdir:$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 111.8G 0 disk └─sda1 8:1 0 111.8G 0 part / sr0 11:0 1 1024M 0 rom testdir:$ 

Источник

Читайте также:  Система управления пакетами линукс

Как отключить устройство в ubuntu?

В windows была возможность отключить необходимое устройство через device manager:

4036c58aa6464bc19fdd9a46b2c4811a.png

Оценить 1 комментарий

zmoe

Купил блютус клавиатуру с тачпадом, а он там ужасный, реагирует на все взмах руки, в Windows отключаю легко, а в линукс так и не пойму как это сделать.

1) Выполнить lspci, найти в выводе нужное устройство, посмотреть его PCI-адрес в первой колонке.
Например (я экспериментирую с контроллером FireWire):

$ lspci . 0d:00.3 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 PCIe IEEE 1394 Controller (rev 04) . 

2) Отключить устройство на уровне шины PCI:

$ echo 1 | sudo tee /sys/bus/pci/devices/0000\:0d\:00.3/remove 1

Разумеется, это действует только до перезагрузки.

А как сохранить эффект?
То есть как сказать ядру не инициализируй вот это pci оборудование.
blocklist modprobe не подходит
имеется оборудование которое использует те же драйвера.
оборудование которое необходимо отключить распаяно на плате.

jcmvbkbc, единственное ядро успеет проинициализировать оборудование.
интересно отключить инициализацию.
просто есть две видеокарты
одна дискретная на плате ноутбука
вторая подключена через riser майнерский
в lspci самое интересное вижу и ту и ту.
но не идет изображение на монитор с видеокарты подключенной через riser

попробуйте так:
1) sudo lsmod — список устройств
2) sudo modprobe -r device — отключить необходимое уст-во.

Странно, но именно устройство nvidia он не хочет отключать.
sudo modprobe -r nvidia — никакой реакции.

amatory10:
rmmod: ERROR: ../libkmod/libkmod-module.c:793 kmod_module_remove_module() could not remove ‘nvidia’: Resource temporarily unavailable
rmmod: ERROR: could not remove module nvidia: Resource temporarily unavailable

Войдите, чтобы написать ответ

Как выполнить команду на хосте после загрузки ОС в virtualbox?

Источник

Оцените статью
Adblock
detector