How to send ioctl command to my Linux USB driver?

April 03rd, 2012 - 04:45 am ET by bluestar | Report spam
Dear Sir:

In my USB driver, I use "usb_register" and "usb_register_dev"
to register usb_driver and usb_class_driver to usb core. I
also create some attribute files for my driver

When the device plugging in, its init and probe functions had
no error and work well

I found the attribute files under /sys/bus/usb/devices/1-1:1.0
, the name of usb_driver under /sys/bus/usb/drivers, the name
of usb_class_driver under /sys/class/usb. But I can't see the
anything under /dev

I tried to open the name of full-path of of usb_class_driver to
send ioctl commands, but it shows message:"can't open"

How to open device node for sending ioctl commands? After
using "usb_register" and "usb_register_dev", where do
system create device node?

Please give me some information

Thank you!

ps: I use kernel version is 3.0.8 and platform is Galaxy Nexus

BR,
Alan
email Follow the discussionReplies 3 repliesReplies Make a reply

Similar topics

Replies

#1 Tauno Voipio
April 03rd, 2012 - 05:45 am ET | Report spam
On 3.4.12 11:45 , bluestar wrote:
Dear Sir:

In my USB driver, I use "usb_register" and "usb_register_dev"
to register usb_driver and usb_class_driver to usb core. I
also create some attribute files for my driver

When the device plugging in, its init and probe functions had
no error and work well

I found the attribute files under /sys/bus/usb/devices/1-1:1.0
, the name of usb_driver under /sys/bus/usb/drivers, the name
of usb_class_driver under /sys/class/usb. But I can't see the
anything under /dev

I tried to open the name of full-path of of usb_class_driver to
send ioctl commands, but it shows message:"can't open"

How to open device node for sending ioctl commands? After
using "usb_register" and "usb_register_dev", where do
system create device node?

Please give me some information

Thank you!

ps: I use kernel version is 3.0.8 and platform is Galaxy Nexus

BR,
Alan




If your system is using the udev daemon for creating the /dev entries,
you are very probably missing the udev scripts for your device.

The location of the scripts may vary according to the Linux
distribution. In Ubuntu 10.04 they are in /etc/udev/rules.d.

Here is an example for the Amontec JTAG key on USB:

clip clip

# Rules to enable USB read/write to Amontec JTAGkey

ACTION!="add", GOTO="amontec_rules_end"
SUBSYSTEM!=="usb_device", GOTO="amontec_rules_end"

ATTR{idProduct}=="cff8", ATTR{idVendor}=="0403", MODE="0666"

LABEL="amontec_rules_end"

clip clip

HTH (hope this helps)


Tauno Voipio
Replies Reply to this message
#2 bluestar
April 05th, 2012 - 02:22 am ET | Report spam
Dear Sir:

Thank you for your suggestion

I tried to find the file you point to, but don't find

I do some experiment for registering functions

(1) misc_register can auto-create device node under /dev
(2) register_chrdev don't auto-create device node under /dev,
but I can use "cat /proc/devices" to find
(3) usb_register_dev don't create any device node under /dev
and /proc/devices

I tried to use "mknod" to manual-create device node unde /
dev, but android kernel can't support this command

Above 3 functions for registering device, can they auto-
create device node under /dev? Or some can and some can't ?

I just want to send my ioctl command into my usb driver, but
I don't find out correct device node to open

Thank you

BR,
Alan

On 4月3日, 下午5時45分, Tauno Voipio
wrote:
On 3.4.12 11:45 , bluestar wrote:

If your system is using the udev daemon for creating the /dev entries,
you are very probably missing the udev scripts for your device.

The location of the scripts may vary according to the Linux
distribution. In Ubuntu 10.04 they are in /etc/udev/rules.d.

Here is an example for the Amontec JTAG key on USB:

 clip clip

#  Rules to enable USB read/write to Amontec JTAGkey

ACTION!="add", GOTO="amontec_rules_end"
SUBSYSTEM!=="usb_device", GOTO="amontec_rules_end"

ATTR{idProduct}=="cff8", ATTR{idVendor}=="0403", MODE="0666"

LABEL="amontec_rules_end"

clip clip

HTH (hope this helps)


Tauno Voipio
Replies Reply to this message
#3 bluestar
April 22nd, 2012 - 10:20 pm ET | Report spam
Dear Sir:

I can find the same minor number at /dev/bus/usb/002/065
,but I don't know how to find correct number(002, 065) of
path

Do you have any idea to get thme?

Thank you!

BR,
Alan
email Follow the discussion Replies Reply to this message
Help Create a new topicReplies Make a reply
Search Make your own search