Re: [AD] linux hotplugging

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 05/24/2012 09:22 PM, Jon Rafkind wrote:
> On 05/24/2012 09:21 PM, Peter Wang wrote:
>> On Thu, 24 May 2012 21:01:45 -0600, Trent Gamblin <trent@xxxxxxxxxx> wrote:
>>> I'd have to try it first. It has worked for me for quite some time now.
>>>
>>> Trent
>>>
>>> On 2012-05-24, at 8:51 PM, Jon Rafkind wrote:
>>>
>>>> Line 527 of src/linux/ljoynu.c adds an inotify watch on /dev but the joystick scanning code in ljoy_scan looks in /dev/input for joysticks. inotify does not produce events for sub-directories so new js* devices added in /dev/input won't cause an inotify event to be sent due to only /dev being scanned.
>>>>
>>>> Changing /dev to /dev/input on line 527 fixes this. A user in #allegro confirms it as well. Any objections to me changing this?
>> Go ahead.
>>
>> The only reason to watch on /dev was an attempt to detect /dev/jsN
>> devices.  But those have been obsolete for ages and a recent kernel with
>> inotify support is unlikely to be used on a system with those obsolete
>> names.
>>
>> It's strange that it worked for me and Trent, though.  I suppose /dev
>> must have been touched in other ways when a device is plugged in,
>> triggering the watch.
> Yea, examples/ex_joystick_hotplugging is working for me too but I can't figure out why..

Ok I printed out the filename that gets touched and its /dev/hidraw0, which is not 'hi draw' but 'HID raw 0'. I think this only gets made for usb devices which is why it probably worked for most people. The user on #allegro was using a 'zeemote' which probably uses some different interface.

Anyway if I change the inotify call to monitor /dev/input then I see events for 'js0' instead, so I think this is a better choice.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/