acessando pasta /dev [RESOLVIDO]

1. acessando pasta /dev [RESOLVIDO]

Adão Dias
adahox

(usa Debian)

Enviado em 22/03/2013 - 13:14h

boa tarde pessoal,

bom, sou leigo em linux e estou tendo enterresse pelo mesmo recentemente.

recentemente li em um tópico no site http://www.hardware.com.br/dicas/linux-entendendo-arvore-diretorios.html dizendo que para, por exemplo, acessar as teclas do teclado, ou o mouse o desenvolvedor nescessita basicamente de jogar o arquivo do codigo fonte na pasta do drive(nao sei se posso chamar assim) e pronto.

gostaria de saber se é isso mesmo.

teriam como colocar um exemplo pra min? se não for pedir demais.

abraços e viva o LINUX!


  


2. MELHOR RESPOSTA

Uilian Ries
uilianries

(usa Linux Mint)

Enviado em 22/03/2013 - 13:37h

Num sistema baseado em Unix, como Linux, quase tudo nele é arquivo.

Logo você acessar um driver como um arquivo de texto, lendo e escrevendo informações.

Leia esse artigo do VOL que abre/fecha a bandeja do CD-ROM. Isso vai te dar uma ideia:

http://www.vivaolinux.com.br/script/Abrir-cdrom-pedindo-direto-ao-sistema.

3. Re: acessando pasta /dev [RESOLVIDO]

Alberto Federman Neto.
albfneto

(usa openSUSE)

Enviado em 22/03/2013 - 13:49h

Não são fontess, são scripts e arquivos de texto.
o Windows tem muitos drivers, que são compilados,são binários ou DLLs, bibliotecas.
em Unix e Linux, quase tudo é controloado por arquivos de texto puro ou por scripts, emuito bem bolado e simplificado.

Uma recomendação. exatamente por causa disso, é umpouco delicado, se vc editar errado, Bau-Bau, Adeus Linux ou Boot.

Se vc for mexer com isso para praticar.... antes de editar, faça uma copia do arquivo funcionante,e de preferencia num pendrive por ex.

exemplo, vc quer mudar o Boot, ele é automático e vc o quer Interativo, isto é com a tecla I, iniciar cada serviço manualmente...

faça assim:

cd /
cd etc
sudo cp rc.conf rc.conf.salvo (Faz uma copia)

agora edita:

gksu gedit (ou outro editor) rc.conf

verá isto


# Global OpenRC configuration settings

# Set to "YES" if you want the rc system to try and start services
# in parallel for a slight speed improvement. When running in parallel we
# prefix the service output with its name as the output will get
# jumbled up.
# WARNING: whilst we have improved parallel, it can still potentially lock
# the boot process. Don't file bugs about this unless you can supply
# patches that fix it without breaking other things!
rc_parallel="YES"

# Set rc_interactive to "YES" and you'll be able to press the I key during
# boot so you can choose to start specific services. Set to "NO" to disable
# this feature. This feature is automatically disabled if rc_parallel is
# set to YES.
rc_interactive="YES"

# If we need to drop to a shell, you can specify it here.
# If not specified we use $SHELL, otherwise the one specified in /etc/passwd,
# otherwise /bin/sh
# Linux users could specify /sbin/sulogin
rc_shell=/sbin/sulogin

# Do we allow any started service in the runlevel to satisfy the dependency
# or do we want all of them regardless of state? For example, if net.eth0
# and net.eth1 are in the default runlevel then with rc_depend_strict="NO"
# both will be started, but services that depend on 'net' will work if either
# one comes up. With rc_depend_strict="YES" we would require them both to
# come up.
#rc_depend_strict="YES"

# rc_hotplug is a list of services that we allow to be hotplugged.
# By default we do not allow hotplugging.
# A hotplugged service is one started by a dynamic dev manager when a matching
# hardware device is found.
# This service is intrinsically included in the boot runlevel.
# To disable services, prefix with a !
# Example - rc_hotplug="net.wlan !net.*"
# This allows net.wlan and any service not matching net.* to be plugged.
# Example - rc_hotplug="*"
# This allows all services to be hotplugged
rc_hotplug="!net.*"

# rc_logger launches a logging daemon to log the entire rc process to
# /var/log/rc.log
# NOTE: Linux systems require the devfs service to be started before
# logging can take place and as such cannot log the sysinit runlevel.
rc_logger="NO"

# Through rc_log_path you can specify a custom log file.
# The default value is: /var/log/rc.log
#rc_log_path="/var/log/rc.log"

# By default we filter the environment for our running scripts. To allow other
# variables through, add them here. Use a * to allow all variables through.
#rc_env_allow="VAR1 VAR2"

# By default we assume that all daemons will start correctly.
# However, some do not - a classic example is that they fork and return 0 AND
# then child barfs on a configuration error. Or the daemon has a bug and the
# child crashes. You can set the number of milliseconds start-stop-daemon
# waits to check that the daemon is still running after starting here.
# The default is 0 - no checking.
#rc_start_wait=100

# rc_nostop is a list of services which will not stop when changing runlevels.
# This still allows the service itself to be stopped when called directly.
#rc_nostop=""

# rc will attempt to start crashed services by default.
# However, it will not stop them by default as that could bring down other
# critical services.
#rc_crashed_stop=NO
#rc_crashed_start=YES

##############################################################################
# MISC CONFIGURATION VARIABLES
# There variables are shared between many init scripts

# Set unicode to YES to turn on unicode support for keyboards and screens.
unicode="YES"

# Below is the default list of network fstypes.
#
# afs cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre ncpfs
# nfs nfs4 ocfs2 shfs smbfs
#
# If you would like to add to this list, you can do so by adding your
# own fstypes to the following variable.
#extra_net_fs_list=""

##############################################################################
# SERVICE CONFIGURATION VARIABLES
# These variables are documented here, but should be configured in
# /etc/conf.d/foo for service foo and NOT enabled here unless you
# really want them to work on a global basis.
# If your service has characters in its name which are not legal in
# shell variable names and you configure the variables for it in this
# file, those characters should be replaced with underscores in the
# variable names as shown below.

# Some daemons are started and stopped via start-stop-daemon.
# We can set some things on a per service basis, like the nicelevel.
#export SSD_NICELEVEL="-19"

# Pass ulimit parameters
#rc_ulimit="-u 30"

# It's possible to define extra dependencies for services like so
#rc_config="/etc/foo"
#rc_need="openvpn"
#rc_use="net.eth0"
#rc_after="clock"
#rc_before="local"
#rc_provide="!net"

# You can also enable the above commands here for each service. Below is an
# example for service foo.
#rc_foo_config="/etc/foo"
#rc_foo_need="openvpn"
#rc_foo_after="clock"

# Below is an example for service foo-bar. Note that the '-' is illegal
# in a shell variable name, so we convert it to an underscore.
# example for service foo-bar.
#rc_foo_bar_config="/etc/foo-bar"
#rc_foo_bar_need="openvpn"
#rc_foo_bar_after="clock"

# You can also remove dependencies.
# This is mainly used for saying which servies do NOT provide net.
#rc_net_tap0_provide="!net"

##############################################################################
# LINUX SPECIFIC OPTIONS

# This is the subsystem type. Valid options on Linux:
# "" - nothing special
# "lxc" - Linux Containers
# "openvz" - Linux OpenVZ
# "prefix" - Prefix
# "uml" - Usermode Linux
# "vserver" - Linux vserver
# "xen0" - Xen0 Domain
# "xenU" - XenU Domain
# If this is commented out, automatic detection will be used.
#
# This should be set to the value representing the environment this file is
# PRESENTLY in, not the virtualization the environment is capable of.
#rc_sys=""

# This is the number of tty's used in most of the rc-scripts (like
# consolefont, numlock, etc ...)
rc_tty_number=12

# If you have cgroups turned on in your kernel, this switch controls
# whether or not a group for each controller is mounted under
# /sys/fs/cgroup.
# Support for process management by cgroups is planned in the future,
# so if you turn this off, be aware that you may not be able to use that
# feature.
#rc_controller_cgroups="YES"


procure por uma linha de RC paralelo, tipo:

# rc_interactive="YES"

OU

rc_interactive="NO"

e deixe-a assim:

rc_interactive="YES"


aí salva, re inicia e pronto!

Assim como com o RC (os serviços iniciados no Boot, ANTES DO KERNEL ENTRAR, depois do kernel estão em /etc/conf.d), quaser todo o resto é assim, hardware, video, rede etc...

é muito legal! Vai gostar de Linux, fazem 6 anos que uso todo dia, não troco por nada, nem Windows, nem Mac.




4. Re: acessando pasta /dev [RESOLVIDO]

Alberto Federman Neto.
albfneto

(usa openSUSE)

Enviado em 22/03/2013 - 14:03h

acessar pasta dev, muito simples:

cd /
cd dev

cuidado a pasta não tem as configs, mas os devices, os dispositivos de hardware,os periféricos.

mexa com bastante cuidado,se quiser, e lembre, não altere permissões de arquivos de sistema, fora do /home,

pq linux trabalha com permissões de acesso e leitura, escrita,rígidas e controladas, acessáveis pelo root e por outros GRUPOS e usuários adequados...
tem ainda mais, seu linux, ao funcionar, vai ESCREVER nesses arquivos automáticamente...., para isso usa o Root, com permissões de acesso e nos grupos, adequadas, feita auto, quando vc instalou seu linux.

aí num exemplo, vc muda o acesso do /dev, do root pro usuario comum, vc , oiu tira o /dev do grupo Root, e tchau.... não vai mais ler o hardware...

é muito bem feito, é um trabalho de programação bacana.


5. Re: acessando pasta /dev [RESOLVIDO]

Uilian Ries
uilianries

(usa Linux Mint)

Enviado em 22/03/2013 - 14:30h

Não movendo o driver para o /dev/null tá no lucro :p


6. obrigado

Adão Dias
adahox

(usa Debian)

Enviado em 15/08/2017 - 17:28h

galera, 4 anos depois eu volto só para agradecer as respostas. vlw d+ a ajuda.

vlw!






Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts