LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-21-2009, 01:33 PM   #1
ddeeks
LQ Newbie
 
Registered: May 2009
Posts: 11

Rep: Reputation: 0
USB2.0 URB and kmod


I am in the process of writing a User Request Block (URB)driven USB2.0 device driver for a BULK TRANSFER DEVICE.

Already implemented as a NON-URB BULK DEVICE.

I know that this is KERNEL device driver
Several issues that arise:
1) Corbet & Rubini example posted


http://www.ceng.metu.edu.tr/courses/...sb/usbsample.c

has caveat

/* No USB with 2.0, make an explicit error and avoid strange ones */
#if LINUX_VERSION_CODE < 0x020200
# error "This module needs kmod, so it won't run with 2.0"
#else

2) All USB URB examples that I see posted appear to be
USB1.0

3) The KERNEL code that I am writing
I get the /usr/src/kernel/..../ errors


Invoking: GCC C Compiler
gcc -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"PocketPal.d" -MT"PocketPal.d" -o"PocketPal.o" "../PocketPal.c"
In file included from ../PocketPal.c:83:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:4:35: warning: linux/mod_devicetable.h: No such file or directory
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:14:44: warning: linux/delay.h: No such file or directory
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:15:54: warning: linux/interrupt.h: No such file or directory
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:16:52: warning: linux/list.h: No such file or directory
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:17:47: warning: linux/kref.h: No such file or directory
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:18:50: warning: linux/device.h: No such file or directory
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:20:58: warning: linux/completion.h: No such file or directory
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:22:48: warning: linux/mutex.h: No such file or directory
In file included from ../PocketPal.c:84:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:63: error: field ‘urb_list’ has incomplete type
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:172: error: field ‘dev’ has incomplete type
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: In function ‘usb_get_intfdata’:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:182: warning: implicit declaration of function ‘dev_get_drvdata’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:182: warning: return makes pointer from integer without a cast
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: In function ‘usb_set_intfdata’:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:187: warning: implicit declaration of function ‘dev_set_drvdata’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: At top level:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:213: error: field ‘ref’ has incomplete type
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:305: error: expected specifier-qualifier-list before ‘u8’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:431: error: field ‘dev’ has incomplete type
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:443: error: expected specifier-qualifier-list before ‘u8’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:509: error: expected ‘)’ before ‘vendor_id’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: In function ‘usb_interface_claimed’:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:574: warning: control reaches end of non-void function
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: At top level:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:922: error: expected specifier-qualifier-list before ‘spinlock_t’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:927: error: field ‘node’ has incomplete type
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:928: error: field ‘id’ has incomplete type
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:933: warning: ‘struct device_driver’ declared inside parameter list
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:933: warning: its scope is only this definition or declaration, which is probably not what you want
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:941: error: field ‘driver’ has incomplete type
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1010: error: expected declaration specifiers or ‘...’ before ‘pm_message_t’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1052: error: expected declaration specifiers or ‘...’ before ‘pm_message_t’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1083: warning: ‘struct module’ declared inside parameter list
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: In function ‘usb_register’:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1086: error: ‘THIS_MODULE’ undeclared (first use in this function)
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1086: error: (Each undeclared identifier is reported only once
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1086: error: for each function it appears in.)
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1086: error: ‘KBUILD_MODNAME’ undeclared (first use in this function)
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: At top level:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1091: warning: ‘struct module’ declared inside parameter list
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1137: error: field ‘urb_list’ has incomplete type
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1138: error: expected specifier-qualifier-list before ‘wait_queue_head_t’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: In function ‘init_usb_anchor’:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1144: warning: implicit declaration of function ‘INIT_LIST_HEAD’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1145: warning: implicit declaration of function ‘init_waitqueue_head’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1145: error: ‘struct usb_anchor’ has no member named ‘wait’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1146: warning: implicit declaration of function ‘spin_lock_init’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1146: error: ‘struct usb_anchor’ has no member named ‘lock’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: At top level:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1320: error: field ‘kref’ has incomplete type
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1322: error: expected specifier-qualifier-list before ‘atomic_t’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: In function ‘usb_fill_control_urb’:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1378: error: ‘struct urb’ has no member named ‘dev’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1379: error: ‘struct urb’ has no member named ‘pipe’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1380: error: ‘struct urb’ has no member named ‘setup_packet’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1381: error: ‘struct urb’ has no member named ‘transfer_buffer’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1382: error: ‘struct urb’ has no member named ‘transfer_buffer_length’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1383: error: ‘struct urb’ has no member named ‘complete’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1384: error: ‘struct urb’ has no member named ‘context’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: In function ‘usb_fill_bulk_urb’:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1408: error: ‘struct urb’ has no member named ‘dev’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1409: error: ‘struct urb’ has no member named ‘pipe’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1410: error: ‘struct urb’ has no member named ‘transfer_buffer’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1411: error: ‘struct urb’ has no member named ‘transfer_buffer_length’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1412: error: ‘struct urb’ has no member named ‘complete’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1413: error: ‘struct urb’ has no member named ‘context’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: In function ‘usb_fill_int_urb’:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1443: error: ‘struct urb’ has no member named ‘dev’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1444: error: ‘struct urb’ has no member named ‘pipe’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1445: error: ‘struct urb’ has no member named ‘transfer_buffer’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1446: error: ‘struct urb’ has no member named ‘transfer_buffer_length’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1447: error: ‘struct urb’ has no member named ‘complete’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1448: error: ‘struct urb’ has no member named ‘context’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1450: error: ‘struct urb’ has no member named ‘interval’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1452: error: ‘struct urb’ has no member named ‘interval’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1453: error: ‘struct urb’ has no member named ‘start_frame’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: At top level:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1457: error: expected declaration specifiers or ‘...’ before ‘gfp_t’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1461: error: expected declaration specifiers or ‘...’ before ‘gfp_t’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: In function ‘usb_urb_dir_in’:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1480: error: ‘struct urb’ has no member named ‘transfer_flags’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1481: warning: control reaches end of non-void function
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: In function ‘usb_urb_dir_out’:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1492: error: ‘struct urb’ has no member named ‘transfer_flags’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1493: warning: control reaches end of non-void function
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: At top level:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1496: error: expected declaration specifiers or ‘...’ before ‘gfp_t’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1496: error: expected declaration specifiers or ‘...’ before ‘dma_addr_t’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1498: error: expected declaration specifiers or ‘...’ before ‘dma_addr_t’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1579: error: expected specifier-qualifier-list before ‘spinlock_t’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1601: error: expected declaration specifiers or ‘...’ before ‘gfp_t’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: In function ‘usb_maxpacket’:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1686: warning: implicit declaration of function ‘WARN_ON’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1696: warning: implicit declaration of function ‘le16_to_cpu’
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h: At top level:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1706: warning: ‘struct notifier_block’ declared inside parameter list
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usb.h:1707: warning: ‘struct notifier_block’ declared inside parameter list
In file included from ../PocketPal.c:87:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/mod_devicetable.h:310: error: ‘BITS_PER_LONG’ undeclared here (not in a function)
In file included from ../PocketPal.c:98:
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usbdevice_fs.h:46: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘*’ token
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usbdevice_fs.h:53: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘*’ token
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usbdevice_fs.h:63: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘*’ token
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usbdevice_fs.h:100: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘*’ token
/usr/src/kernels/2.6.27.21-170.2.56.fc10.i686/include/linux/usbdevice_fs.h:117: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘*’ token
../PocketPal.c:401: warning: data definition has no type or storage class
../PocketPal.c:401: warning: type defaults to ‘int’ in declaration of ‘MODULE_DEVICE_TABLE’
../PocketPal.c:401: warning: parameter names (without types) in function declaration
../PocketPal.c: In function ‘pp_probe’:
../PocketPal.c:446: error: incompatible types in assignment
../PocketPal.c:447: warning: assignment makes pointer from integer without a cast
make: *** [PocketPal.o] Error 1



Will the URB system work with USB2.0 in LINUX, if so

are there any examples that show URB USB2.0 ??

Last edited by ddeeks; 05-22-2009 at 08:09 AM. Reason: typo
 
  


Reply

Tags
kmod, usb2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
URB (USB Request Block) converion between linux windows barunparichha Linux - Networking 2 10-11-2007 11:15 PM
Multiple pending URB Rajkumar.R Linux - Kernel 1 07-12-2007 12:16 AM
looking for [kmod] rural Linux - Newbie 2 05-31-2005 12:30 AM
What is KMOD? apsn Slackware 2 03-05-2004 03:47 AM
Kmod ? lostboy Linux - General 5 05-12-2003 02:44 PM


All times are GMT -5. The time now is 09:39 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration