Sponsored Content
Top Forums Shell Programming and Scripting Detect USB keyboard and other peripherals Post 302331378 by pludi on Monday 6th of July 2009 03:40:06 AM
Old 07-06-2009
Depending on how current your Debian installation is you might have DBUS & HAL installed. There's a command-line tool for DBUS which you can instruct to listen for added devices: (example is a flash drive)
Code:
> dbus-monitor --system --profile 'interface=org.freedesktop.Hal.Manager, member=DeviceAdded'
sig     1246865406      537113  2       /org/freedesktop/DBus   org.freedesktop.DBus    NameAcquired
sig     1246865413      849690  6387    /org/freedesktop/Hal/Manager    org.freedesktop.Hal.Manager     DeviceAdded
sig     1246865413      898142  6390    /org/freedesktop/Hal/Manager    org.freedesktop.Hal.Manager     DeviceAdded
sig     1246865414      883198  6393    /org/freedesktop/Hal/Manager    org.freedesktop.Hal.Manager     DeviceAdded
sig     1246865414      883255  6394    /org/freedesktop/Hal/Manager    org.freedesktop.Hal.Manager     DeviceAdded
sig     1246865414      903331  6403    /org/freedesktop/Hal/Manager    org.freedesktop.Hal.Manager     DeviceAdded
sig     1246865415      53744   6430    /org/freedesktop/Hal/Manager    org.freedesktop.Hal.Manager     DeviceAdded
sig     1246865415      97264   6449    /org/freedesktop/Hal/Manager    org.freedesktop.Hal.Manager     DeviceAdded

If you pipe this into a loop you should be able to detect just about any HW change.
 

9 More Discussions You Might Find Interesting

1. Programming

mont of peripherals

hello i'm working on redhat linux which is installed with windows on the same hard disk i would like to get access to windows files throw linux the question is: how to mount hard disk and peripherals ? think you (0 Replies)
Discussion started by: selim
0 Replies

2. UNIX for Dummies Questions & Answers

USB keyboard in Solaris

I have a USB keyboard/mouse combo hooked up to an x86 box and when it loads the mouse works fine, but the ctrl, shift, alt, and i think the function keys don't do anything. Is there a setting I need to change, or a way to manually configure them. There are no drivers, it is supposed to emulate a... (0 Replies)
Discussion started by: Winzernotman
0 Replies

3. UNIX for Dummies Questions & Answers

Can't detect usb thumbdrive anymore

hey everyone! i have a Solaris 8 box with me, and i had been using my usb thrumbdrive on it all the time. one day, i was in a rush and i pulled out the thumbdrive without ejecting it or anything. and now i can't detect any thumbdrives at all. i had tried using another thumbdrive, but with no... (2 Replies)
Discussion started by: feef
2 Replies

4. Programming

How to detect usb storage arrival and its mount path from C

Hi, I am a newbi to linux, i wana to write a program in C that can detect arrival of a usb flash memory. I want also to find the actual mount point of new inserted flash disk. can anyone help me? thanks a lot (6 Replies)
Discussion started by: aghashahi
6 Replies

5. Shell Programming and Scripting

BASH Script to Detect and List USB Flash Drives

Hello. This is my first post to this forum. I've read many of the posts over the last two or three years and I've learned a lot. I'm creating a live Linux distribution using the Linux Live Scripts -- just as a hobby project -- and I'm wanting to create an automated way for a user to copy the... (7 Replies)
Discussion started by: godzillarama
7 Replies

6. Linux

How to read keys from USB keyboard on AT91SAM9260

Hi Everyone, I am using 2.6.26.3-olimex kernel(Embedded system) running on AT91SAM9260. I am using a Logitech USB keyboard. It is detected as "/dev/input/event0". I don't know how to detect key press events and read the keys? Why can't I read the keys using scanf() like funtions? ... (7 Replies)
Discussion started by: siva4ever
7 Replies

7. Shell Programming and Scripting

script to detect a file from inserted usb and puts into a Variable

There is a same named log file that I have on my 2 different android phones. When I plug it into my computer, it appears in the media folder, For example the first android phone: /media/F6BA-0AF5/folder/A.log I want to put that into a variable to be manipulated.... (3 Replies)
Discussion started by: tobenguyen
3 Replies

8. OS X (Apple)

Detect active usb device used by app

I've searched a number of sites but thought I'd post it here. I'm want to a detect certain usb device (external camera) that is actively being used by an app on a mac. My search has led me through looking at the system events log to see if there is a ProductID indicator logged. The device is... (2 Replies)
Discussion started by: dallas88
2 Replies

9. HP-UX

Configure X windows with both keyboard and USB barcode reader

Greetings. Seeking guidance on adding a USB barcode reader (BCR) to an HP c3750 workstation with HP-UX 11.11 which is essentially configuring X windows to accept input from both a primary keyboard and a secondary keyboard that happens to be the BCR. Historically, I have successfully added a BCR... (2 Replies)
Discussion started by: mnkaltenbach
2 Replies
UKBD(4) 						   BSD Kernel Interfaces Manual 						   UKBD(4)

NAME
ukbd -- USB keyboard driver SYNOPSIS
To compile this driver into the kernel, place the following line in your kernel configuration file: device ukbd Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): ukbd_load="YES" DESCRIPTION
The ukbd driver provides support for keyboards that attach to the USB port. usb(4) and one of uhci(4) or ohci(4) must be configured in the kernel as well. CONFIGURATION
By default, the keyboard subsystem does not create the appropriate devices yet. Make sure you reconfigure your kernel with the following option in the kernel config file: options KBD_INSTALL_CDEV If both an AT keyboard USB keyboards are used at the same time, the AT keyboard will appear as kbd0 in /dev. The USB keyboards will be kbd1, kbd2, etc. You can see some information about the keyboard with the following command: kbdcontrol -i < /dev/kbd1 or load a keymap with kbdcontrol -l keymaps/pt.iso < /dev/kbd1 See kbdcontrol(1) for more possible options. You can swap console keyboards by using the command kbdcontrol -k /dev/kbd1 From this point on, the first USB keyboard will be the keyboard to be used by the console. If you want to use a USB keyboard as your default and not use an AT keyboard at all, you will have to remove the device atkbd line from the kernel configuration file. Because of the device initialization order, the USB keyboard will be detected after the console driver initial- izes itself and you have to explicitly tell the console driver to use the existence of the USB keyboard. This can be done in one of the fol- lowing two ways. Run the following command as a part of system initialization: kbdcontrol -k /dev/kbd0 < /dev/ttyv0 > /dev/null (Note that as the USB keyboard is the only keyboard, it is accessed as /dev/kbd0) or otherwise tell the console driver to periodically look for a keyboard by setting a flag in the kernel configuration file: device sc0 at isa? flags 0x100 With the above flag, the console driver will try to detect any keyboard in the system if it did not detect one while it was initialized at boot time. DRIVER CONFIGURATION
options KBD_INSTALL_CDEV Make the keyboards available through a character device in /dev. options UKBD_DFLT_KEYMAP makeoptions UKBD_DFLT_KEYMAP=fr.iso The above lines will put the French ISO keymap in the ukbd driver. You can specify any keymap in /usr/share/syscons/keymaps with this option. options KBD_DISABLE_KEYMAP_LOADING Do not allow the user to change the keymap. Note that these options also affect the AT keyboard driver, atkbd(4). FILES
/dev/kbd* blocking device nodes EXAMPLES
device ukbd Add the ukbd driver to the kernel. SEE ALSO
kbdcontrol(1), ohci(4), syscons(4), uhci(4), usb(4), config(8) AUTHORS
The ukbd driver was written by Lennart Augustsson <augustss@cs.chalmers.se> for NetBSD and was substantially rewritten for FreeBSD by Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>. This manual page was written by Nick Hibma <n_hibma@FreeBSD.org> with a large amount of input from Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>. BSD
November 22, 2006 BSD
All times are GMT -4. The time now is 01:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy