Controlling a USB port

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

	I have a USB device being used on a headless router which I need to
shut down and power back up from time to time under control by system
scripts.  The router is running Debian "Lenny" (4.3.2-1.1) on an old Dell
Optiplex 260 under kernel 2.6.26-2-686.  I searched the Debian repositories,
but I could not find a likely candidate for something to handle this, so I
then searched the web for a good candidate.  I found hub-ctrl-2.c from 2006
by NIIBE Yutaka, which looks promising.  I'm having problems getting it to
compile, however.  I've only written a handful of programs in C, so forgive
me if I making some rookie mistakes.  I'm compiling using gcc version 4.3.2.

	The source code requires the headers usb.h and mod_devicetable.h, so
I downloaded them, as well, placing usb.h in usr/include/ and placing
mod_devicetable.h in /usr/include/linux. When I tied to compile the program,
it complained about, "expected specifier-qualifier-list before 'xxxx`", so I
added "#include <inttypes.h>" to the hub-ctrl-2-1.c source file. When that
didn't work, I also tried adding it to mod_devicetable.h. I still get the
same sorts of errors.  Here is the output from gcc:

AlarmClock:/Downloads# gcc -o hub-ctrl hub-ctrl-2-1.c -lusb
In file included from /usr/include/usb.h:4,
                 from hub-ctrl-2-1.c:12:
/usr/include/linux/mod_devicetable.h:18: error: expected
specifier-qualifier-list before '__u32'
/usr/include/linux/mod_devicetable.h:31: error: expected
specifier-qualifier-list before '__u32'
/usr/include/linux/mod_devicetable.h:100: error: expected
specifier-qualifier-list before '__u16'
/usr/include/linux/mod_devicetable.h:137: error: expected
specifier-qualifier-list before '__u16'
/usr/include/linux/mod_devicetable.h:147: error: expected
specifier-qualifier-list before '__u16'
/usr/include/linux/mod_devicetable.h:164: error: expected
specifier-qualifier-list before '__u16'
/usr/include/linux/mod_devicetable.h:175: error: expected
specifier-qualifier-list before '__u8'
/usr/include/linux/mod_devicetable.h:186: error: expected
specifier-qualifier-list before '__u8'
/usr/include/linux/mod_devicetable.h:194: error: expected
specifier-qualifier-list before '__u8'
/usr/include/linux/mod_devicetable.h:199: error: expected
specifier-qualifier-list before '__u8'
/usr/include/linux/mod_devicetable.h:210: error: expected
specifier-qualifier-list before '__u8'
/usr/include/linux/mod_devicetable.h:227: error: expected
specifier-qualifier-list before 'kernel_ulong_t'
/usr/include/linux/mod_devicetable.h:240: error: expected
specifier-qualifier-list before '__u16'
/usr/include/linux/mod_devicetable.h:314: error: expected
specifier-qualifier-list before 'kernel_ulong_t'
/usr/include/linux/mod_devicetable.h:341: error: expected
specifier-qualifier-list before 'kernel_ulong_t'
/usr/include/linux/mod_devicetable.h:347: error: expected
specifier-qualifier-list before '__u8'
/usr/include/linux/mod_devicetable.h:363: error: expected
specifier-qualifier-list before '__u8'
/usr/include/linux/mod_devicetable.h:372: error: expected
specifier-qualifier-list before '__u16'
/usr/include/linux/mod_devicetable.h:386: error: expected
specifier-qualifier-list before '__u32'
/usr/include/linux/mod_devicetable.h:398: error: expected
specifier-qualifier-list before 'kernel_ulong_t'
/usr/include/linux/mod_devicetable.h:409: error: expected
specifier-qualifier-list before 'kernel_ulong_t'
/usr/include/linux/mod_devicetable.h:444: error: expected
specifier-qualifier-list before 'kernel_ulong_t'
/usr/include/linux/mod_devicetable.h:473: error: expected
specifier-qualifier-list before 'kernel_ulong_t'
hub-ctrl-2-1.c: In function 'main':
hub-ctrl-2-1.c:64: warning: incompatible implicit declaration of built-in
function 'exit'
hub-ctrl-2-1.c:73: warning: incompatible implicit declaration of built-in
function 'exit'
hub-ctrl-2-1.c:82: warning: incompatible implicit declaration of built-in
function 'exit'
hub-ctrl-2-1.c:105: warning: incompatible implicit declaration of built-in
function 'exit'
hub-ctrl-2-1.c:112: warning: assignment makes pointer from integer without a
cast
hub-ctrl-2-1.c:116: warning: incompatible implicit declaration of built-in
function 'exit'
hub-ctrl-2-1.c:119: error: dereferencing pointer to incomplete type
hub-ctrl-2-1.c:120: error: dereferencing pointer to incomplete type
hub-ctrl-2-1.c:123: error: 'usb_dev_handle' undeclared (first use in this
function)
hub-ctrl-2-1.c:123: error: (Each undeclared identifier is reported only once
hub-ctrl-2-1.c:123: error: for each function it appears in.)
hub-ctrl-2-1.c:123: error: 'uh' undeclared (first use in this function)
hub-ctrl-2-1.c:127: error: dereferencing pointer to incomplete type
hub-ctrl-2-1.c:130: error: dereferencing pointer to incomplete type
hub-ctrl-2-1.c:130: error: dereferencing pointer to incomplete type
hub-ctrl-2-1.c:132: error: dereferencing pointer to incomplete type
hub-ctrl-2-1.c:135: error: dereferencing pointer to incomplete type
hub-ctrl-2-1.c:138: warning: incompatible implicit declaration of built-in
function 'exit'
hub-ctrl-2-1.c:151: error: 'USB_DT_HUB' undeclared (first use in this
function)
hub-ctrl-2-1.c:195: warning: incompatible implicit declaration of built-in
function 'exit'
hub-ctrl-2-1.c:200: warning: incompatible implicit declaration of built-in
function 'exit'

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux