From: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
To: Brian Magnuson <bdmagnuson@gmail.com>
Cc: linux-input@atrey.karlin.mff.cuni.cz
Subject: Re: [PATCH] new driver for wireless xbox receiver for review
Date: Tue, 29 May 2007 11:59:39 -0400 [thread overview]
Message-ID: <d120d5000705290859k63f9110akba428332a5557a21@mail.gmail.com> (raw)
In-Reply-To: <20070529043957.GB6157@rcn.com>
Hi Brian,
On 5/29/07, Brian Magnuson <bdmagnuson@gmail.com> wrote:
> Hi,
>
> This patch implements a driver for the "Microsoft Xbox 360 Wireless Receiver
> for Windows" that was recently released. It seems to mostly "just work" for
> the basics at this point and I'd like to get some feedback on it since this is
> my first attempt at driver development.
>
> It borrows heavily from xpad.c since it's basically the same controller with
> new wireless magic. The difference being that the receiever can host multiple
> controllers through the same device and the driver manages them coming and
> going. In particular I moved the input device creation/deletion out of the
> probe function and into workqueues kicked off by usb interrupts. That would
> probably be a good place for prospective reviewers to start finding issues. :)
>
Thnk you for the patch. Looking at the code I do not see one device
supporintg multiple controllers... You have one input device per usb
device/interface and the properties of said device are known
beforehand. So I would just create and register input device right
there in xboxrcvr_probe() and get rid of your build and teardown
works. The fact that is it a wireless device and at transmitter may at
times be out of range is not important.
Overall I would like support for this wireless receiver to be
incorporated into xpad.c driver.
I also have some more comments, see below.
> +
> +static unsigned long debug = 0;
You do not need to initialize statig variables to 0. It only increases
size of the image.
> +module_param(debug, ulong, 0644);
> +MODULE_PARM_DESC(debug, "debug level");
> +
> +
> + if(debug) {
Please use spaces between statement (if,for, while) and opening paren.
> +
> + /* Valid pad data */
> + if(!(sdata[1] & 0x1) || !xboxrcvr->open)
> + return;
Why are we generating interrupts if device is not used? Have the
->open() method submit urbs and then you don't need to check it here.
> +
> + /* FIXME: Yuck. Need to make sure this doesn't get truncated */
> + usb_make_path(xboxrcvr->udev, path, sizeof(xboxrcvr->phys));
> + snprintf(xboxrcvr->phys, sizeof(xboxrcvr->phys), "%s/input%d", path, xboxrcvr->id);
> + snprintf(xboxrcvr->uniq, sizeof(xboxrcvr->uniq), "xpad%d", xboxrcvr->id >> 1);
Uniq is used to carry identificator unique for the device, not within
a particular system. It is property of device itself and should not
change if moved to a different box so do not try to come up with
artificial data for it.
> +
> + input_dev->name = xboxrcvr_device[0].name;
Hmm....
> + input_dev->phys = xboxrcvr->phys;
> + input_dev->uniq = xboxrcvr->uniq;
> + input_dev->cdev.dev = &(xboxrcvr->intf->dev);
Please use
input_dev->dev.parent = &xboxrcvr->intf->dev;
- input devices are meving moved from class_device to struct device.
> + input_dev->private = xboxrcvr;
input_set_drvdata(input_dev, xboxrcvr); And use input_get_drvdata()
instead of accessing dev->private directly.
--
Dmitry
next prev parent reply other threads:[~2007-05-29 15:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-29 4:39 [PATCH] new driver for wireless xbox receiver for review Brian Magnuson
2007-05-29 15:59 ` Dmitry Torokhov [this message]
2007-05-30 0:28 ` Brian Magnuson
2007-05-30 12:40 ` Dmitry Torokhov
2007-05-30 13:47 ` Brian Magnuson
2007-05-30 14:24 ` Jan Kratochvil
2007-05-30 14:51 ` Brian Magnuson
2007-05-30 15:02 ` Dmitry Torokhov
2007-05-30 15:31 ` Brian Magnuson
2007-05-30 9:51 ` Jiri Kosina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d120d5000705290859k63f9110akba428332a5557a21@mail.gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=bdmagnuson@gmail.com \
--cc=linux-input@atrey.karlin.mff.cuni.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).