DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 24th January 2022
cinux cinux is offline
New User
 
Join Date: Jan 2022
Posts: 3
Default How to disable DVD optical drive?

Is there a way to disable CD-DVD optical drive inside OpenBSD?

I used to disable it via bios menu. However I installed coreboot recently and there is no options for me to disable it. I am curious whether it is possible to disable my optical driver inside OpenBSD?

The reason I would like to disable it because my hardware got some issue, and just a little pressure to the optical drive would activate or trigger my laptop to eject it, really annoying. I don't want to take it apart either cause it make my laptop uglier and less sturdy. My workaround was tape it, but the optical drive still activate randomly.

My laptop is Thinkpad T430.
Reply With Quote
  #2   (View Single Post)  
Old 24th January 2022
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,984
Default

Hello, and welcome!


You can disable the cd(4) driver with config(8). This will also disable kernel address randomization (KARL).
Reply With Quote
  #3   (View Single Post)  
Old 24th January 2022
cinux cinux is offline
New User
 
Join Date: Jan 2022
Posts: 3
Default

#2 I made changed to the kernel and boot from a bsd.newl. I check with cdio eject and it couldn't eject the disk which is a good thing. However when I press the physical button to eject disk, it still activate the CD/DVD optical drive. I think disable it within the OS doesn't disable the hardware.
Even though the problem not solved, I did learn more about OpenBSD kernel things, and it wasn't hard as I imagined.
Thank you @iggimi

Code:
Script started on Sun Jan 23 21:57:41 2022
]0;cinux@openbsd:~[32mcinux@openbsd[0m:[34m~[32m$[0m PS1=""

doas -e  config -e /bsd.new


doas (cinux@openbsd) password: 
WARNING no output file specified
OpenBSD 7.0 (GENERIC.MP) #4: Tue Jan 18 05:38:49 MST 2022
    root@syspatch-70-amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
Enter 'help' for information
ukc> s find 40
 40 cd* at scsibus* disable target -1 lun -1 flags 0x0
ukc> exit
^D


Script done on Sun Jan 23 21:58:28 2022
dmesg

Last edited by cinux; 24th January 2022 at 03:07 AM. Reason: add dmesg
Reply With Quote
  #4   (View Single Post)  
Old 24th January 2022
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,984
Default

Quote:
Originally Posted by cinux View Post
I think disable it within the OS doesn't disable the hardware.
The OS will ignore the device, but it seems that manual ejection is still possible without OS control.

The cd(4) man page has a reference to CDIOCPREVENT, an IOCTL designed to "Tell the drive to (prevent) manual ejection of the CD-ROM disc. Not all drives support this feature." I will guess that if you re-enabled the driver and wrote a program that issued the CDIOCPREVENT IOCTL, such a program might not stop the button from manually ejecting the device drawer.
Reply With Quote
  #5   (View Single Post)  
Old 24th January 2022
cinux cinux is offline
New User
 
Join Date: Jan 2022
Posts: 3
Default

Quote:
Originally Posted by jggimi View Post
The OS will ignore the device, but it seems that manual ejection is still possible without OS control.

The cd(4) man page has a reference to CDIOCPREVENT, an IOCTL designed to "Tell the drive to (prevent) manual ejection of the CD-ROM disc. Not all drives support this feature." I will guess that if you re-enabled the driver and wrote a program that issued the CDIOCPREVENT IOCTL, such a program might not stop the button from manually ejecting the device drawer.
I'm not familiar with programming except for some simple shell scripts to extract information for the status bar. I planning to learn C soon, but for now the tape tricks make it much less annoying so I might as well live with it for a little while.

And thank you a lot.
Reply With Quote
  #6   (View Single Post)  
Old 24th January 2022
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,984
Default

This particular IOCTL is not used by any userland application in the OS, according to find(1). But once you've learned a little C you may be able to add a custom function to the cdio(1) tool for your personal use. This program's source code resides in /usr/src/usr.bin/cdio/.
Reply With Quote
  #7   (View Single Post)  
Old 24th January 2022
fvgit's Avatar
fvgit fvgit is offline
Spikes in tights
 
Join Date: May 2016
Location: perl -MMIME::Base64 -le 'print decode_base64("U2hlcndvb2QgRm9yZXN0")'
Posts: 314
Default

Quote:
Originally Posted by jggimi View Post
Hello, and welcome!


You can disable the cd(4) driver with config(8). This will also disable kernel address randomization (KARL).
There's also bsd.re-config(5) which was introduced in 7.0, allowing you to do the same thing without sacrificing KARL functionality:
Quote:
Introduced /etc/bsd.re-config(5), which can be used to configure the kernel using config(8), allowing use of KARL while making changes to the GENERIC kernel.
src: https://www.openbsd.org/70.html
Reply With Quote
  #8   (View Single Post)  
Old 25th January 2022
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,984
Default

I'd forgotten about that. Thank you!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get optical spdif sound output psypro OpenBSD General 0 21st December 2016 10:58 AM
Disable DHCP: is it at all possible? WeoNat OpenBSD General 14 29th March 2016 01:38 AM
FBSD 8.1 install; no floppy, no optical Mantazz FreeBSD Installation and Upgrading 3 29th January 2011 01:04 PM
Creating USB flash drive drive image from FreeBSD disc1.iso FBSD Guides 1 10th February 2010 04:42 PM
Wired/Optical Microsoft IntelliMouse Explorer 3.0 installation vigol FreeBSD General 2 17th November 2009 12:34 PM


All times are GMT. The time now is 05:56 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick